[PATCH] D42790: [ELF] Ensure that Elf_Rela addends are always written with -r
Simon Atanasyan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 1 07:18:37 PST 2018
atanasyan added a comment.
In https://reviews.llvm.org/D42790#994808, @grimar wrote:
> In https://reviews.llvm.org/D42790#994774, @arichardson wrote:
>
> > I originally discovered this issue because in our CHERI fork of LLD we set `Config->IsRela = false` when linking MIPS64 code. We do this because the FreeBSD MIPS rtld only understands Elf_Rel relocations and does not process Elf_Rela.
>
>
> It sounds like FreeBSD MIPS rtld bug honestly and probably should be fixed on their side.
MIPS O32 ABI uses the Elf_Rel format in object files, while N32 and N64 ABIs uses the Elf_Rela. But originally in case of all ABIs output relocations in executable files and DSO are written in the Elf_Rel format. I think the goal was to reduce a file size. In case of embedded systems with small amount of memory it can be a benefit. Maybe there are some other reasons. When I implement MIPS LLD backend I used the same format for input and output files, i.e. Elf_Rel for O32 ABI and Elf_Rela for N32 and N64 ABIs. It works for Linux because the dynamic linker accepts all formats. It looks like FreeBSD linker is more stricter.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D42790
More information about the llvm-commits
mailing list