]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
pa.c (pa_output_addr_vec): Align address table.
authorJohn David Anglin <danglin@gcc.gnu.org>
Sun, 29 Jul 2018 16:11:34 +0000 (16:11 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sun, 29 Jul 2018 16:11:34 +0000 (16:11 +0000)
* config/pa/pa.c (pa_output_addr_vec): Align address table.
* config/pa/pa.h (JUMP_TABLES_IN_TEXT_SECTION): Revise comment.
* config/pa/pa32-linux.h (JUMP_TABLES_IN_TEXT_SECTION): Define.

From-SVN: r263054

gcc/ChangeLog
gcc/config/pa/pa.c
gcc/config/pa/pa.h
gcc/config/pa/pa32-linux.h

index eb5e9996787752b54a8d57be3cd2fcb33f354f43..40af297e4d07f3616c1800682cad77e16357ff7d 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-29  John David Anglin  <danglin@gcc.gnu.org>
+
+       * config/pa/pa.c (pa_output_addr_vec): Align address table.
+       * config/pa/pa.h (JUMP_TABLES_IN_TEXT_SECTION): Revise comment.
+       * config/pa/pa32-linux.h (JUMP_TABLES_IN_TEXT_SECTION): Define.
+
 2018-07-17  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        Backport from mainline
index ffa30641f8fcf1e956a5ce92c86fb8302e41084b..9946ae8a663e4fd4e4d7cc40598b68ceb49169d4 100644 (file)
@@ -10598,6 +10598,8 @@ pa_output_addr_vec (rtx lab, rtx body)
 {
   int idx, vlen = XVECLEN (body, 0);
 
+  if (!TARGET_SOM)
+    fputs ("\t.align 4\n", asm_out_file);
   targetm.asm_out.internal_label (asm_out_file, "L", CODE_LABEL_NUMBER (lab));
   if (TARGET_GAS)
     fputs ("\t.begin_brtab\n", asm_out_file);
index c58bd87fdb51940546efbd7ef7b6e0dfe8f41018..f6dd60293be18aa46da69858f5bc908319ab5cfa 100644 (file)
@@ -1188,21 +1188,23 @@ do {                                                                         \
 #define ASM_OUTPUT_ASCII(FILE, P, SIZE)  \
   pa_output_ascii ((FILE), (P), (SIZE))
 
-/* Jump tables are always placed in the text section.  Technically, it
-   is possible to put them in the readonly data section.  This has the
-   benefit of getting the table out of .text and reducing branch lengths
-   as a result.
+/* Jump tables are always placed in the text section.  We have to do
+   this for the HP-UX SOM target as we can't switch sections in the
+   middle of a function.
 
-   The downside is that an additional insn (addil) is needed to access
+   On ELF targets, it is possible to put them in the readonly-data section.
+   This would get the table out of .text and reduce branch lengths.
+
+   A downside is that an additional insn (addil) is needed to access
    the table when generating PIC code.  The address difference table
-   also has to use 32-bit pc-relative relocations.  Currently, GAS does
-   not support these relocations, although it is easily modified to do
-   this operation.
+   also has to use 32-bit pc-relative relocations.
 
    The table entries need to look like "$L1+(.+8-$L0)-$PIC_pcrel$0"
    when using ELF GAS.  A simple difference can be used when using
-   SOM GAS or the HP assembler.  The final downside is GDB complains
-   about the nesting of the label for the table when debugging.  */
+   the HP assembler.
+
+   The final downside is GDB complains about the nesting of the label
+   for the table.  */
 
 #define JUMP_TABLES_IN_TEXT_SECTION 1
 
index 9c3ec00dcb9c0c0a6edc3f6f09cbcf477f7c20a0..dce2bf21d37b08288d4d846be66c1680d37a0570 100644 (file)
@@ -62,3 +62,12 @@ call_ ## FUNC (void)                                 \
 
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
+
+/* Place jump tables in the text section except when generating non-PIC
+   code.  When generating non-PIC code, the relocations needed to load the
+   address of the jump table result in a text label in the final executable
+   if the jump table is placed in the text section.  This breaks the unwind
+   data for the function.  Thus, the jump table needs to be placed in
+   rodata when generating non-PIC code.  */
+#undef JUMP_TABLES_IN_TEXT_SECTION
+#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)