RFC: Risc-V: Allow assembler to adjust relocs against symbols in mergeable sections
Jan Beulich
jbeulich@suse.com
Fri Jan 23 11:57:23 GMT 2026
On 23.01.2026 12:44, Jan Beulich wrote:
> On 23.01.2026 09:41, Jan Beulich wrote:
>> Hence I wonder: Shouldn't we at least warn about the use of labels in
>> mergeable sections, when their use needs representing in the object (e.g.
>> by way of a relocation [1])? And shouldn't we hence strive to replace as
>> many of the uses as possible by section symbols? Afaict that would then
>> eliminate the need for a RISC-V-specific code change (which may otherwise
>> be similarly required for at least all other ELF targets presently
>> defining tc_fix_adjustable() to constant 0 / false).
>
> Which I notice would go entirely against what tc_i386_fix_adjustable() has
> at the beginning for x86-64, and against
>
> /* Never adjust a reloc against local symbol in a merge section
> with non-zero addend. */
> if ((symsec->flags & SEC_MERGE) != 0
> && (fixp->fx_offset != 0 || fixp->fx_subsy != NULL))
> continue;
>
> in adjust_reloc_syms(). IOW while on one hand labels are problematic in
> mergeable sections, otoh we force their use.
Thinking of it: Shouldn't "PC-relative" also count as "non-zero addend",
for actually adding in the PC? That would then cover x86-64 without its
interesting extra conditional.
Jan
More information about the Binutils
mailing list