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

Nick Clifton nickc@redhat.com
Thu Jan 15 13:48:56 GMT 2026


Hi Jan,

> On 15.01.2026 12:17, Nick Clifton wrote:
>>    Attached is a small patch which allows the Risc-V assembler to adjust
>>    fixups against symbols in mergeable sections.  Doing this results in
>>    relocations against the section's symbol instead of local symbols.

> Doesn't whether to adjust also depend on relocation type?

Maybe...

> For example, the
> very first thing checked on x86 is
> 
>    /* Don't adjust pc-relative references to merge sections in 64-bit
>       mode.  */
>    if (use_rela_relocations
>        && (S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0
>        && fixP->fx_pcrel)
>      return 0;

I saw that, but I could not work out why it was there.  What is special
about pc-relative relocations against symbols in mergeable sections ?
Is it an x86 specific thing ?  (Or do pc-relative relocations in mergeable
sections only happen for x86 specific reasons ?)

Cheers
   Nick






More information about the Binutils mailing list