public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/giulianob/heads/pfe_backport_clean)] Backport: ICE: segmentation fault with patchable_function_entry attribute for msp430-elf -mlarge)
@ 2021-10-19 18:12 Giuliano Belinassi
  0 siblings, 0 replies; only message in thread
From: Giuliano Belinassi @ 2021-10-19 18:12 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a672b0f4f3f9dcc59ffc563de98092b832fd2153

commit a672b0f4f3f9dcc59ffc563de98092b832fd2153
Author: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date:   Fri Nov 16 23:53:30 2018 +0000

    Backport: ICE: segmentation fault with patchable_function_entry attribute for msp430-elf -mlarge)
    
    2021-10-07  Giuliano Belinassi  <gbelinassi@suse.de>
    
            Backport from mainline
            2018-11-16  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
    
            PR target/87927
            * target-def.h: Initialize TARGET_ASM_{,UN}ALIGNED_P{S,D,T}I_OP.
            Add them to the TARGET_ASM_{,UN}ALIGNED_INT_OP structs.
            * target.def: Enumerate TARGET_ASM_{,UN}ALIGNED_P{S,D,T}I_OP in
            the byte_op hook.
            * target.h: Add psi, pdi, pti to struct asm_int_op definition.
            * targhooks.c (default_print_patchable_function_entry): Assert
            asm_int_op does not return a NULL string.
            * varasm.c (integer_asm_op): Return the op for a partial int type
            when the requested size does not correspond to an integer type.
            * config/msp430/msp430.c: Initialize TARGET_ASM_{,UN}ALIGNED_PSI_OP.
            * doc/tm.texi: Regenerate.

Diff:
---
 gcc/config/msp430/msp430.c |  5 +++++
 gcc/doc/tm.texi            |  6 ++++++
 gcc/target-def.h           | 15 +++++++++++++++
 gcc/target.def             |  6 ++++++
 gcc/target.h               |  3 +++
 gcc/targhooks.c            |  4 +++-
 gcc/varasm.c               | 14 ++++++++++++++
 7 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index c1f0d5b0026..3ad552d9e94 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -3391,6 +3391,11 @@ msp430_print_operand_raw (FILE * file, rtx op)
     }
 }
 
+#undef  TARGET_ASM_ALIGNED_PSI_OP
+#define TARGET_ASM_ALIGNED_PSI_OP "\t.long\t"
+#undef  TARGET_ASM_UNALIGNED_PSI_OP
+#define TARGET_ASM_UNALIGNED_PSI_OP TARGET_ASM_ALIGNED_PSI_OP
+
 #undef  TARGET_PRINT_OPERAND_ADDRESS
 #define TARGET_PRINT_OPERAND_ADDRESS	msp430_print_operand_addr
 
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index b4456f7cd40..cb9fabb4295 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -7798,12 +7798,18 @@ hook.
 
 @deftypevr {Target Hook} {const char *} TARGET_ASM_BYTE_OP
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PSI_OP
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PDI_OP
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PTI_OP
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PSI_OP
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PDI_OP
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PTI_OP
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OP
 These hooks specify assembly directives for creating certain kinds
 of integer object.  The @code{TARGET_ASM_BYTE_OP} directive creates a
diff --git a/gcc/target-def.h b/gcc/target-def.h
index c99bfaa0105..cbd9fe6b967 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -47,6 +47,15 @@
 #define TARGET_ASM_UNALIGNED_TI_OP NULL
 #endif /* OBJECT_FORMAT_ELF */
 
+/* There is no standard way to handle P{S,D,T}Imode, targets must implement them
+   if required.  */
+#define TARGET_ASM_ALIGNED_PSI_OP NULL
+#define TARGET_ASM_UNALIGNED_PSI_OP NULL
+#define TARGET_ASM_ALIGNED_PDI_OP NULL
+#define TARGET_ASM_UNALIGNED_PDI_OP NULL
+#define TARGET_ASM_ALIGNED_PTI_OP NULL
+#define TARGET_ASM_UNALIGNED_PTI_OP NULL
+
 #if !defined(TARGET_ASM_CONSTRUCTOR) && !defined(USE_COLLECT2)
 # ifdef CTORS_SECTION_ASM_OP
 #  define TARGET_ASM_CONSTRUCTOR default_ctor_section_asm_out_constructor
@@ -89,14 +98,20 @@
 
 #define TARGET_ASM_ALIGNED_INT_OP				\
 		       {TARGET_ASM_ALIGNED_HI_OP,		\
+			TARGET_ASM_ALIGNED_PSI_OP,		\
 			TARGET_ASM_ALIGNED_SI_OP,		\
+			TARGET_ASM_ALIGNED_PDI_OP,		\
 			TARGET_ASM_ALIGNED_DI_OP,		\
+			TARGET_ASM_ALIGNED_PTI_OP,		\
 			TARGET_ASM_ALIGNED_TI_OP}
 
 #define TARGET_ASM_UNALIGNED_INT_OP				\
 		       {TARGET_ASM_UNALIGNED_HI_OP,		\
+			TARGET_ASM_UNALIGNED_PSI_OP,		\
 			TARGET_ASM_UNALIGNED_SI_OP,		\
+			TARGET_ASM_UNALIGNED_PDI_OP,		\
 			TARGET_ASM_UNALIGNED_DI_OP,		\
+			TARGET_ASM_UNALIGNED_PTI_OP,		\
 			TARGET_ASM_UNALIGNED_TI_OP}
 
 #if !defined (TARGET_FUNCTION_INCOMING_ARG)
diff --git a/gcc/target.def b/gcc/target.def
index bea79404836..c50ed9445cd 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -45,12 +45,18 @@ DEFHOOKPODX (close_paren, const char *, ")")
 DEFHOOKPOD
 (byte_op,
  "@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_HI_OP\n\
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PSI_OP\n\
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_SI_OP\n\
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PDI_OP\n\
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_DI_OP\n\
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_PTI_OP\n\
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_ALIGNED_TI_OP\n\
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_HI_OP\n\
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PSI_OP\n\
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_SI_OP\n\
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PDI_OP\n\
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_DI_OP\n\
+@deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_PTI_OP\n\
 @deftypevrx {Target Hook} {const char *} TARGET_ASM_UNALIGNED_TI_OP\n\
 These hooks specify assembly directives for creating certain kinds\n\
 of integer object.  The @code{TARGET_ASM_BYTE_OP} directive creates a\n\
diff --git a/gcc/target.h b/gcc/target.h
index 393de408b97..5f2b1d6d9cc 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -158,8 +158,11 @@ extern bool stmt_in_inner_loop_p (struct _stmt_vec_info *);
 struct asm_int_op
 {
   const char *hi;
+  const char *psi;
   const char *si;
+  const char *pdi;
   const char *di;
+  const char *pti;
   const char *ti;
 };
 
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 77ca69105d0..c57967966c5 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -1636,13 +1636,15 @@ default_print_patchable_function_entry (FILE *file,
       char buf[256];
       static int patch_area_number;
       section *previous_section = in_section;
+      const char *asm_op = integer_asm_op (POINTER_SIZE_UNITS, false);
 
+      gcc_assert (asm_op != NULL);
       patch_area_number++;
       ASM_GENERATE_INTERNAL_LABEL (buf, "LPFE", patch_area_number);
 
       switch_to_section (get_section ("__patchable_function_entries",
 				      0, NULL));
-      fputs (integer_asm_op (POINTER_SIZE_UNITS, false), file);
+      fputs (asm_op, file);
       assemble_name_raw (file, buf);
       fputc ('\n', file);
 
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 6e9a8c3133e..5711ba69555 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2713,10 +2713,24 @@ integer_asm_op (int size, int aligned_p)
       return targetm.asm_out.byte_op;
     case 2:
       return ops->hi;
+    case 3:
+      return ops->psi;
     case 4:
       return ops->si;
+    case 5:
+    case 6:
+    case 7:
+      return ops->pdi;
     case 8:
       return ops->di;
+    case 9:
+    case 10:
+    case 11:
+    case 12:
+    case 13:
+    case 14:
+    case 15:
+      return ops->pti;
     case 16:
       return ops->ti;
     default:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-19 18:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 18:12 [gcc(refs/users/giulianob/heads/pfe_backport_clean)] Backport: ICE: segmentation fault with patchable_function_entry attribute for msp430-elf -mlarge) Giuliano Belinassi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).