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

Alex Richardson via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 13:56:15 PST 2018


On 01/02/2018 21:17, Rafael Avila de Espindola wrote:
> Alexander Richardson via Phabricator <reviews at reviews.llvm.org> writes:
>
>> arichardson added a comment.
>>
>> 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.
>>
>> The issue here is not speicific to MIPS. It only depends on an input file containing Elf_Rela for a target that has Elf_Rel as the default output format.
>>
>> I added the command line flag since this makes it possible to test this issue without fabricating .o files. Additionally, it will make it possible to use LLD for operating systems where rtld doesn't use Rela and the `IsRela = Config->Is64 || IsX32 || Config->MipsN32Abi || Machine == EM_PPC`. check is not correct.
> Could you instead add an option to llvm-mc to force it to use Elf_Rela?
> That way you can test this by creating a x86 or arm .o file with
> Elf_Rela.
>
> Cheers,
> Rafael
That sounds like a good solution. I will try to implement that tomorrow 
and post a patch.

Thanks,
Alex


More information about the llvm-commits mailing list