public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, rs6000] Enable absolute jump table by default
@ 2022-01-12 12:22 HAO CHEN GUI
  2022-01-12 14:44 ` David Edelsohn
  0 siblings, 1 reply; 4+ messages in thread
From: HAO CHEN GUI @ 2022-01-12 12:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool, David, Bill Schmidt

Hi,
   This patch enables absolute jump table by default on rs6000. The relative jump tables are used when
   it's explicit set by "rs6000_relative_jumptables",
   or jump tables are placed in text section but global relocation is required.

   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-12 Haochen Gui <guihaoc@linux.ibm.com>

gcc/
	* config/rs6000/linux64.h (JUMP_TABLES_IN_TEXT_SECTION): Define.
	* config/rs6000/rs6000.c (rs6000_gen_pic_addr_diff_vec): Return
	true when relative jump table is explicit required or jump tables have
	to be put in text section but global relocation is also required.
	* config/rs6000/rs6000.opt (rs6000_relative_jumptables): Disable.

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..9fba893a27a 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -28465,7 +28465,9 @@ rs6000_emit_xxspltidp_v2df (rtx dst, long value)
 static bool
 rs6000_gen_pic_addr_diff_vec (void)
 {
-  return rs6000_relative_jumptables;
+  return rs6000_relative_jumptables
+	 || (JUMP_TABLES_IN_TEXT_SECTION
+	     && targetm.asm_out.reloc_rw_mask () == 3);
 }

 void
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index c2a77182a9e..75e3fa86829 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -630,7 +630,7 @@ Target Mask(MMA) Var(rs6000_isa_flags)
 Generate (do not generate) MMA instructions.

 mrelative-jumptables
-Target Undocumented Var(rs6000_relative_jumptables) Init(1) Save
+Target Undocumented Var(rs6000_relative_jumptables) Init(0) Save

 mrop-protect
 Target Var(rs6000_rop_protect) Init(0)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-13  1:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-12 12:22 [PATCH, rs6000] Enable absolute jump table by default HAO CHEN GUI
2022-01-12 14:44 ` David Edelsohn
2022-01-13  1:40   ` HAO CHEN GUI
2022-01-13  1:53     ` David Edelsohn

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).