[lld] r314954 - Refactor duplicated code.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 4 17:35:47 PDT 2017
Author: rafael
Date: Wed Oct 4 17:35:47 2017
New Revision: 314954
URL: http://llvm.org/viewvc/llvm-project?rev=314954&view=rev
Log:
Refactor duplicated code.
Since VisibleToRegularObj is weaker than LinkerRedefined, this should
have no functionality change.
Modified:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/test/ELF/lto/wrap-1.ll
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=314954&r1=314953&r2=314954&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Oct 4 17:35:47 2017
@@ -162,8 +162,6 @@ template <class ELFT> void SymbolTable::
Symbol *Real = addUndefined<ELFT>(Saver.save("__real_" + Name));
Symbol *Wrap = addUndefined<ELFT>(Saver.save("__wrap_" + Name));
- // Tell LTO not to eliminate this symbol.
- Wrap->IsUsedInRegularObj = true;
defsym(Real, Sym);
defsym(Sym, Wrap);
}
@@ -177,8 +175,6 @@ void SymbolTable::addSymbolAlias(StringR
return;
}
- // Tell LTO not to eliminate this symbol.
- B->symbol()->IsUsedInRegularObj = true;
defsym(addUndefined<ELFT>(Alias), B->symbol());
}
@@ -529,6 +525,10 @@ void SymbolTable::defsym(Symbol *Dst, Sy
// We want to tell LTO not to inline Dst symbol because LTO doesn't
// know the final symbol contents after renaming.
Dst->CanInline = false;
+
+ // Tell LTO not to eliminate this symbol.
+ Src->IsUsedInRegularObj = true;
+
Defsyms.push_back({Dst, Src, Dst->Binding});
}
Modified: lld/trunk/test/ELF/lto/wrap-1.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/wrap-1.ll?rev=314954&r1=314953&r2=314954&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/wrap-1.ll (original)
+++ lld/trunk/test/ELF/lto/wrap-1.ll Wed Oct 4 17:35:47 2017
@@ -19,7 +19,7 @@
; Make sure that the 'r' (linker redefined) bit is set for bar and __wrap_bar
; in the resolutions file.
-; RESOLS: ,bar,r
+; RESOLS: ,bar,xr
; RESOLS: ,__wrap_bar,px
; RESOLS: ,__real_bar,pxr
More information about the llvm-commits
mailing list