[PATCH] D34691: [LLD][ELF] Introduce range extension thunks for ARM

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 07:29:36 PDT 2017


peter.smith added inline comments.


================
Comment at: ELF/Relocations.cpp:1020
+    uint64_t TSLimit = TSBase + TS->getSize();
+    if (Target->inBranchRange(Type, Src, (Src > TSLimit) ? TSBase : TSLimit))
+      return TS;
----------------
ruiu wrote:
> Does this mean that this would use the upper bound if a referrer's address is greater than a thunk? Is it guaranteed that a thunk for this symbol is created within a range this way?
If I'm reading the expression correctly; if the address of the referrer is greater than the ThunkSection we can insert a Thunk into the ThunkSection if we are in range of its lower bound. If the address of the referrer is lower than that of the ThunkSection we need to be in range of its upper bound.

Given that we process referrers and ThunkSections in ascending order of address this should mean that on that pass we are in range. 

```
referrer low (want to check that we are in range of upper bound of ThunkSection)
...
ThunkSection Base (TSBase lower bound)
    Thunks
ThunkSection Limit (TSLimit upper bound)
...
referrer high (want to check that we are in range of lower bound of ThunkSection) 
``` 


https://reviews.llvm.org/D34691





More information about the llvm-commits mailing list