Hi, This patch sets "relocatable" of jump table to true when targets require local relocation to be placed in a read-write section - bit 0 is set in reloc_rw_mask. Jump tables are in local relocation, so they should be placed in RELRO only when both global and local relocation need to be placed in a read-write section. Bit 1 is always set when bit 0 is set. Bootstrapped and tested on powerpc64-linux BE/LE and x86 with no regressions. Is this okay for trunk? Any recommendations? Thanks a lot.
ChangeLog 2022-01-12 Haochen Gui <guih...@linux.ibm.com> gcc/ * final.c (jumptable_relocatable): Set relocatable to true when targets require local relocation to be placed in a read-write section. patch.diff diff --git a/gcc/final.c b/gcc/final.c index 296a9382e91..e86223cb96b 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -2141,7 +2141,7 @@ jumptable_relocatable (void) if (!CASE_VECTOR_PC_RELATIVE && !targetm.asm_out.generate_pic_addr_diff_vec () && targetm_common.have_named_sections) - relocatable = targetm.asm_out.reloc_rw_mask (); + relocatable = targetm.asm_out.reloc_rw_mask () == 3; return relocatable; }