[PATCH] D42843: Ensure that Elf_Rel addends are always written for dynamic relocations

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 2 07:11:25 PST 2018


arichardson created this revision.
arichardson added reviewers: ruiu, rafael, atanasyan, grimar.
Herald added subscribers: llvm-commits, emaste.
arichardson added a dependency: D42839: [MC] Allow overriding whether to output Elf_Rel or Elf_Rela relocations.
arichardson added inline comments.


================
Comment at: test/ELF/convert-rel-rela-addends.s:103
+.data
+.ifdef IS_64
+.quad foo + 0x5544
----------------
This ugly hack is needed because LLD will reject R_X86_64_32 relocations in shared objects but 16 and 64 bit is fine. Not sure why this is the case as the dynamic linker can just write the correct value to data section.


This follows up on r321889 where writing of Elf_Rel addends was partially
moved to RelocationBaseSection. This patch ensures that the addends are
always written to the output section when a input section uses RELA but the
output is REL.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42843

Files:
  ELF/InputSection.cpp
  ELF/Relocations.cpp
  ELF/Relocations.h
  ELF/SyntheticSections.cpp
  ELF/SyntheticSections.h
  test/ELF/convert-rel-rela-addends.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42843.132582.patch
Type: text/x-patch
Size: 14154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180202/53297da8/attachment.bin>


More information about the llvm-commits mailing list