[PATCH] D63383: [ELF][ARM][AARCH64][MIPS][PPC] Simplify the logic to create R_*_RELATIVE for absolute relocation types in writable sections
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 16 01:46:39 PDT 2019
MaskRay created this revision.
MaskRay added reviewers: atanasyan, grimar, peter.smith, ruiu, sfertile.
Herald added subscribers: llvm-commits, jsji, jrtc27, kbarton, kristof.beyls, arichardson, javed.absar, nhaehnle, jvesely, nemanjai, sdardis, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
Our rule to create R_*_RELATIVE for absolute relocation types were
loose. D63121 <https://reviews.llvm.org/D63121> made it stricter but it failed to create R_*_RELATIVE for
R_ARM_TARGET1 and R_PPC64_TOC. The original behavior of ARM and PPC64 is
restored by rLLD363236 <https://reviews.llvm.org/rLLD363236>.
This patch is an attempt to simplify the logic.
Note, in ld.bfd, R_ARM_TARGET2 --target2=abs also creates
R_ARM_RELATIVE. This seems a very uncommon scenario (moreover,
--target2=got-rel is the default), so I do not implement any logic
related to it.
Also, delete R_AARCH64_ABS32 from AArch64::getDynRel. We don't have
working ILP32 support yet. Allowing it would create an incorrect
R_AARCH64_RELATIVE.
For MIPS, the (if SymbolRel, then RelativeRel) code is to keep its
behavior unchanged.
Note, in ppc64-abs64-dyn.s, R_PPC64_TOC gets an incorrect addend because
computeAddend() doesn't compute the correct address. We seem to have the
wrong behavior for a long time. The important thing seems that we should
not create a dynamic relocation R_PPC64_TOC as that the dynamic loader
will error that relocation type is not supported.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D63383
Files:
ELF/Arch/AArch64.cpp
ELF/Arch/AMDGPU.cpp
ELF/Arch/Mips.cpp
ELF/Arch/PPC.cpp
ELF/Arch/PPC64.cpp
ELF/Relocations.cpp
ELF/Target.h
test/ELF/arm-abs32-dyn.s
test/ELF/ppc64-abs32-dyn.s
test/ELF/ppc64-abs64-dyn.s
test/ELF/relative-dynamic-reloc-ppc64.s
test/ELF/shared-ppc64.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63383.204940.patch
Type: text/x-patch
Size: 11075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190616/6e37b5d5/attachment.bin>
More information about the llvm-commits
mailing list