On 1/12/2022 12:20 AM, HAO CHEN GUI via Gcc-patches wrote:
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.
It seems unwise to me to rely on the fact that bit1 is already on when
bit0 is on. I realize that's likely just preserving existing
behavior, but unless there's a compelling reason, I'd rather do:
relocatable = (targetm.asm_out.reloc_rw_mask () & 1) != 0;
Which avoids the assumption that if bit0 is on, then bit 1 will always
be on.
jeff