[PATCH] D42790: [ELF] Ensure that Elf_Rela addends are always written with -r

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 07:21:55 PST 2018


arichardson added a comment.

In https://reviews.llvm.org/D42790#994808, @grimar wrote:

> I guess it currently works with GNU linkers because they always write the addend to output, even when output is .rela. 
>  We faced something like that before when worked on x64 target. And it was fixed on FreeBSD side.


I have been working on adding RELA support to the mips rtld but 
I don't know if the MIPS specifies that Elf_Rela should to be used for n64. I believe this choice is up to the operating system but I could be wrong.

> I do not think we want to add command line option like that in LLD. One possible option in theory would be to have
>  the same behavior as gnu linkers do, but it is also unclear it is needed, because seem helps to hide an issue instead of fixing it.

This is actually fixing an issue since compilers other than clang are not required to use the same relocation kind as LLD for the object files.
I can also add a patch to completely reject any Elf_Rel relocations if `Config->IsRela` is set but I don't think that is the right way forward. Right now we are producing broken object files if this is the case and I would very much like to avoid that.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42790





More information about the llvm-commits mailing list