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

Jan Beulich jbeulich@suse.com
Thu Jan 15 11:27:00 GMT 2026


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.
> 
>   In theory this would workaround the problem reported in PR 33723 and
>   PR 33789, although I have not actually checked this.  In addition I do
>   not know if the change would break something important for Risc-V.
>   (Although the change does not introduce any new testsuite failures,
>   but I am testing in a cross-compilation environment so native tests
>   were not run).

Doesn't whether to adjust also depend on relocation type? 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;

Jan


More information about the Binutils mailing list