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

Maciej W. Rozycki macro@orcam.me.uk
Thu Jan 15 18:38:06 GMT 2026


On Thu, 15 Jan 2026, Jan Beulich wrote:

> >> 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 ?)
> 
> I don't know; it has been like that for over 20 years. The commit introducing
> it, as usual, doesn't say why. But Andreas, the author, is still around. So,
> Andreas: Do you recall any details?

 Cf. <https://inbox.sourceware.org/binutils/hoy9i0lyj2.fsf@gee.suse.de/>.

  Maciej


More information about the Binutils mailing list