Hi,
   This patch enables absolute jump table on PPC Linux. When PIC is set, the 
absolute jump tables are
placed in RELRO section. Otherwise, they're placed in rodata section.

   Bootstrapped and tested on powerpc64-linux BE and LE with no regressions. Is 
this okay for trunk?
Any recommendations? Thanks a lot.

ChangeLog
2022-01-18 Haochen Gui <guih...@linux.ibm.com>

gcc/
        * config/rs6000/linux64.h (JUMP_TABLES_IN_TEXT_SECTION): Define.
        (rs6000_linux64_override_options): Define rs6000_relative_jumptables.


patch.diff
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index d617f346f81..2e257c60f8c 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -239,7 +239,7 @@ extern int dot_symbols;

 /* Indicate that jump tables go in the text section.  */
 #undef  JUMP_TABLES_IN_TEXT_SECTION
-#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
+#define JUMP_TABLES_IN_TEXT_SECTION 0

 /* The linux ppc64 ABI isn't explicit on whether aggregates smaller
    than a doubleword should be padded upward or downward.  You could
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 319182e94d9..7e196e8a43b 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -3576,6 +3576,8 @@ rs6000_linux64_override_options ()
          error (INVALID_32BIT, "cmodel");
        }
     }
+
+  rs6000_relative_jumptables = 0;
 }
 #endif

Reply via email to