aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUtils.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2021-06-10 13:25:16 -0700
committerFangrui Song <i@maskray.me>2021-06-10 13:25:16 -0700
commitc03b6305d8419fda84a67f4fe357b69a86e4b54f (patch)
tree638ffc93c437d642422c3eb8e3b6fd0cc1bc3ca0 /llvm/lib/Transforms/Utils/LoopUtils.cpp
parentaaaeb4b160fe94e0ad3bcd6073eea4807f84a33a (diff)
downloadllvm-c03b6305d8419fda84a67f4fe357b69a86e4b54f.zip
llvm-c03b6305d8419fda84a67f4fe357b69a86e4b54f.tar.gz
llvm-c03b6305d8419fda84a67f4fe357b69a86e4b54f.tar.bz2
[ELF][RISCV] Resolve branch relocations referencing undefined weak to current location if not using PLT
In a -no-pie link we optimize R_PLT_PC to R_PC. Currently we resolve a branch relocation to the link-time zero address. However such a choice tends to cause relocation overflow possibility for RISC architectures. * aarch64: GNU ld: rewrite the instruction to a NOP; ld.lld: branch to the next instruction * mips: GNU ld: branch to the start of the text segment (?); ld.lld: branch to zero * ppc32: GNU ld: rewrite the instruction to a NOP; ld.lld: branch to the current instruction * ppc64: GNU ld: rewrite the instruction to a NOP; ld.lld: branch to the current instruction * riscv: GNU ld: branch to the absolute zero address (with instruction rewriting) * i386/x86_64: GNU ld/ld.lld: branch to the link-time zero address I think that resolving to the same location is a good choice. The instruction, if triggered, is clearly an undefined behavior. Resolving to the same location can cause an infinite loop (making the user aware of the issue) while ensuring no overflow. Reviewed By: jrtc27 Differential Revision: https://reviews.llvm.org/D103001
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
0 files changed, 0 insertions, 0 deletions