RFC: Risc-V: Allow assembler to adjust relocs against symbols in mergeable sections

Jan Beulich jbeulich@suse.com
Fri Jan 23 11:44:07 GMT 2026


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.

Jan

> [1] Arguably already the entering into a symbol table is a problem, as
> the corresponding symbol in the final object's symbol table would then
> also likely be wrong.



More information about the Binutils mailing list