[lld] r292614 - [ELF] Cleanup createThunks() NFC.
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 20 07:25:45 PST 2017
Author: psmith
Date: Fri Jan 20 09:25:45 2017
New Revision: 292614
URL: http://llvm.org/viewvc/llvm-project?rev=292614&view=rev
Log:
[ELF] Cleanup createThunks() NFC.
Include removal of call to getThunkExpr() as it has already been
called and recorded by scanRelocs()
Cleanup suggestions by Rafael.
Modified:
lld/trunk/ELF/Relocations.cpp
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=292614&r1=292613&r2=292614&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Fri Jan 20 09:25:45 2017
@@ -808,25 +808,20 @@ template <class ELFT> void scanRelocatio
template <class ELFT>
void createThunks(ArrayRef<OutputSectionBase *> OutputSections) {
for (OutputSectionBase *Base : OutputSections) {
- if (auto *OS = dyn_cast<OutputSection<ELFT>>(Base)) {
- for (InputSection<ELFT> *IS : OS->Sections) {
- for (const Relocation &Rel : IS->Relocations) {
- if (Rel.Sym == nullptr) {
- continue;
- }
- SymbolBody &Body = *Rel.Sym;
- uint32_t Type = Rel.Type;
- RelExpr Expr = Rel.Expr;
- if (!isPreemptible(Body, Type) && needsPlt(Expr))
- Expr = fromPlt(Expr);
- Expr = Target->getThunkExpr(Expr, Type, IS->getFile(), Body);
- // Some targets might require creation of thunks for relocations.
- // Now we support only MIPS which requires LA25 thunk to call PIC
- // code from non-PIC one, and ARM which requires interworking.
- if (Expr == R_THUNK_ABS || Expr == R_THUNK_PC ||
- Expr == R_THUNK_PLT_PC)
- addThunk<ELFT>(Type, Body, *IS);
- }
+ auto *OS = dyn_cast<OutputSection<ELFT>>(Base);
+ if (OS == nullptr)
+ continue;
+ for (InputSection<ELFT> *IS : OS->Sections) {
+ for (const Relocation &Rel : IS->Relocations) {
+ if (Rel.Sym == nullptr)
+ continue;
+ RelExpr Expr = Rel.Expr;
+ // Some targets might require creation of thunks for relocations.
+ // Now we support only MIPS which requires LA25 thunk to call PIC
+ // code from non-PIC one, and ARM which requires interworking.
+ if (Expr == R_THUNK_ABS || Expr == R_THUNK_PC ||
+ Expr == R_THUNK_PLT_PC)
+ addThunk<ELFT>(Rel.Type, *Rel.Sym, *IS);
}
}
}
More information about the llvm-commits
mailing list