RISC-V: About relaxation without internal reloc numbers reserved in psABI
Fangrui Song
i@maskray.me
Mon Nov 6 06:01:59 GMT 2023
On Sun, Nov 5, 2023 at 8:04 PM Tatsuyuki Ishi <ishitatsuyuki@gmail.com> wrote:
>
> Hi,
>
> I'm currently working on implementing relaxation for the TLS
> Descriptor extensions [1]. Previously, relaxation was implemented by
> first converting the relocation into an internal relocation number in
> _bfd_riscv_relax_section, then overwriting the instruction with the
> resolved offset in riscv_elf_relocate_section. However, according to
> [2], these numbers are no longer considered reserved in the
> specification, and we should move away from using numbers in the
> reserved range for internal purposes, at least for any new relaxation
> implementation.
>
> If I need to implement a new relaxation now, what is the recommended
> approach? Perhaps I could use a relocation number >= 256 for internal
> relocation, assuming the relocation number is not cast to uint8_t
> (need to confirm this assumption).
Yes, if you can use relocation type numbers >= 256, do that.
Even better, use numbers >= 1024 in case the psABI decides to use
ELF64-specific relocation types unsupported by ELF32 (>=256).
> I welcome suggestions for alternative solutions as well.
>
> Regards,
> Tatsuyuki
>
> [1]: https://inbox.sourceware.org/binutils/20230817180852.121628-2-ishitatsuyuki@gmail.com/
> [2]: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/398
More information about the Binutils
mailing list