public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: HAO CHEN GUI <guihaoc@linux.ibm.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Segher Boessenkool <segher@kernel.crashing.org>,
	David <dje.gcc@gmail.com>, Bill Schmidt <wschmidt@linux.ibm.com>
Subject: [PATCH, rs6000] Enable absolute jump table by default
Date: Wed, 12 Jan 2022 20:22:19 +0800	[thread overview]
Message-ID: <7672daad-b86e-df92-bf9a-f3f4e489d5e3@linux.ibm.com> (raw)

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)

             reply	other threads:[~2022-01-12 12:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 12:22 HAO CHEN GUI [this message]
2022-01-12 14:44 ` David Edelsohn
2022-01-13  1:40   ` HAO CHEN GUI
2022-01-13  1:53     ` David Edelsohn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7672daad-b86e-df92-bf9a-f3f4e489d5e3@linux.ibm.com \
    --to=guihaoc@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).