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

Nick Clifton nickc@redhat.com
Fri Jan 16 10:02:41 GMT 2026


Hi Guys,

>>>> 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/>.
> 
> Thanks for digging this out. Nick, the discussion there clearly suggests
> that in principle this shouldn't be x86-64-only. I guess I'll need to do
> some experimenting ...

Please do.

I also found that only a few targets (that use fix_adjustable) have special
code for pc-relative relocations referencing mergeable sections.

For what it is worth I tested a version of the patch (attached) that does
treat pc-relative relocations specially and it did not prevent the desired
effect of eliminating local symbols in the .debug_line_str section.

Cheers
   Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: riscv-gas-adjust-merge-section-symbols.patch.2
Type: application/x-troff-man
Size: 1288 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260116/9b8c8a01/attachment.2>


More information about the Binutils mailing list