[PATCH] D26240: [LLD][ARM][AArch64] ARM and AArch64 undefined weak reference values for relative relocations
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 2 05:16:52 PDT 2016
peter.smith created this revision.
peter.smith added reviewers: ruiu, rafael.
peter.smith added a subscriber: llvm-commits.
Herald added subscribers: rengolin, aemerson.
The ARM 32 and 64-bit ABI does not use 0 for undefined weak references that are used in PC relative relocations. In particular:
- A branch relocation to an undefined weak resolves to the next instruction.
- In all other cases the symbol resolves to the place so that S + A - P resolves to A.
The branch relocation resolving to the next instruction is the most important as it is a common idiom in statically linked ARM and AArch64 code to use branches to weak references to initialization functions of optional parts of the program. More importantly it can also cause spurious relocation out of range errors as the (S + A) - P of the branch relocation evaluates to (0 + A) - P which is often a large negative number.
- ARM: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdf
- Section 18.104.22.168 Weak references and 22.214.171.124 Static ARM Relocations, search for Call and Jump Relocations
- AArch64: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0056c/IHI0056C_beta_aaelf64.pdf
- Section 126.96.36.199 Weak references and Section 4.6.7 Call and Jump Relocations
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7479 bytes
Desc: not available
More information about the llvm-commits