re PR target/87927 (ICE: segmentation fault with patchable_function_entry attribute...
authorJozef Lawrynowicz <jozef.l@mittosystems.com>
Fri, 16 Nov 2018 23:53:30 +0000 (23:53 +0000)
committerJozef Lawrynowicz <jozefl@gcc.gnu.org>
Fri, 16 Nov 2018 23:53:30 +0000 (23:53 +0000)
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.

From-SVN: r266226

gcc/ChangeLog
gcc/config/msp430/msp430.c
gcc/doc/tm.texi
gcc/target-def.h
gcc/target.def
gcc/target.h
gcc/targhooks.c
gcc/varasm.c

index 4b87c43a2ea4a5873c0cac14336d5873be34dfa3..43b854451cc0cf43d7f00d279874bb5a17df32fd 100644 (file)
@@ -1,3 +1,18 @@
+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.
+
 2018-11-12  Jason Merrill  <jason@redhat.com>
 
        * gimplify.c (gimplify_case_label_expr): Handle hot/cold attributes.
index 7d305b1bece516d319abf7ddf5a15f04614c00c4..3a41cc011e7516f25f244bb724cfb7fd800b81b3 100644 (file)
@@ -3469,6 +3469,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
 
index 0a2ad9a745e5c6ada069d864b5b1394b7c5165c4..e348f0a7da6fad46033d951273b135295a5a89a3 100644 (file)
@@ -8036,12 +8036,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
index 695198b9555ff0bc3cbe54aa9fd623a32855269a..fb968e666169db47aa200f2f0a2c1799e690cf4a 100644 (file)
 #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
 
 #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)
index f9469d69cb0775d1f74a94856d815a25f6d33d85..96f37e0462bc7d8c63769abfded19da5f67a136e 100644 (file)
@@ -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\
index 8968580e43232274c853e050c1bdde2a4dac3e39..663926b0896a99d98ae411e65dd6c66d1c096071 100644 (file)
@@ -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;
 };
 
index bcbd534e32d7c6c80f4c42ff0f8a04e3d577027d..41ccffe86451d5eb3959dcf9c118b619278d3222 100644 (file)
@@ -1807,13 +1807,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);
 
index 545e13fef6aa071689261c9c77b593e103b8c95e..243d205c1f5e9d95c221f807be6c23f96261b16f 100644 (file)
@@ -2733,10 +2733,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: