forked from OSchip/llvm-project
Refactor duplicated code.
Since VisibleToRegularObj is weaker than LinkerRedefined, this should have no functionality change. llvm-svn: 314954
This commit is contained in:
parent
60433b682f
commit
c29b24d524
|
@ -162,8 +162,6 @@ template <class ELFT> void SymbolTable::addSymbolWrap(StringRef Name) {
|
|||
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(StringRef Alias, StringRef Name) {
|
|||
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, Symbol *Src) {
|
|||
// 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});
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue