forked from OSchip/llvm-project
parent
af3e93ac93
commit
0afcef27a1
|
@ -526,7 +526,6 @@ template <class ELFT> static void addCopyRelSymbol(SharedSymbol *SS) {
|
|||
// dynamic symbol for each one. This causes the copy relocation to correctly
|
||||
// interpose any aliases.
|
||||
for (SharedSymbol *Sym : getSymbolsAt<ELFT>(SS)) {
|
||||
Sym->NeedsCopy = true;
|
||||
Sym->CopyRelSec = Sec;
|
||||
Sym->CopyRelSecOff = Off;
|
||||
Sym->symbol()->IsUsedInRegularObj = true;
|
||||
|
@ -579,7 +578,7 @@ static RelExpr adjustExpr(SymbolBody &Body, RelExpr Expr, uint32_t Type,
|
|||
if (Body.isObject()) {
|
||||
// Produce a copy relocation.
|
||||
auto *B = cast<SharedSymbol>(&Body);
|
||||
if (!B->NeedsCopy) {
|
||||
if (!B->CopyRelSec) {
|
||||
if (Config->ZNocopyreloc)
|
||||
error("unresolvable relocation " + toString(Type) +
|
||||
" against symbol '" + toString(*B) +
|
||||
|
|
|
@ -106,7 +106,7 @@ static uint64_t getSymVA(const SymbolBody &Body, int64_t &Addend) {
|
|||
cast<DefinedCommon>(Body).Offset;
|
||||
case SymbolBody::SharedKind: {
|
||||
auto &SS = cast<SharedSymbol>(Body);
|
||||
if (SS.NeedsCopy)
|
||||
if (SS.CopyRelSec)
|
||||
return SS.CopyRelSec->getParent()->Addr + SS.CopyRelSec->OutSecOff +
|
||||
SS.CopyRelSecOff;
|
||||
if (SS.NeedsPltAddr)
|
||||
|
@ -125,7 +125,7 @@ static uint64_t getSymVA(const SymbolBody &Body, int64_t &Addend) {
|
|||
|
||||
SymbolBody::SymbolBody(Kind K, StringRefZ Name, bool IsLocal, uint8_t StOther,
|
||||
uint8_t Type)
|
||||
: SymbolKind(K), NeedsCopy(false), NeedsPltAddr(false), IsLocal(IsLocal),
|
||||
: SymbolKind(K), NeedsPltAddr(false), IsLocal(IsLocal),
|
||||
IsInGlobalMipsGot(false), Is32BitMipsGot(false), IsInIplt(false),
|
||||
IsInIgot(false), Type(Type), StOther(StOther), Name(Name) {}
|
||||
|
||||
|
@ -138,8 +138,8 @@ bool SymbolBody::isPreemptible() const {
|
|||
// Shared symbols resolve to the definition in the DSO. The exceptions are
|
||||
// symbols with copy relocations (which resolve to .bss) or preempt plt
|
||||
// entries (which resolve to that plt entry).
|
||||
if (isShared())
|
||||
return !NeedsCopy && !NeedsPltAddr;
|
||||
if (auto *SS = dyn_cast<SharedSymbol>(this))
|
||||
return !SS->CopyRelSec && !NeedsPltAddr;
|
||||
|
||||
// Only symbols that appear in dynsym can be preempted.
|
||||
if (!symbol()->includeInDynsym())
|
||||
|
@ -220,7 +220,7 @@ OutputSection *SymbolBody::getOutputSection() const {
|
|||
}
|
||||
|
||||
if (auto *S = dyn_cast<SharedSymbol>(this)) {
|
||||
if (S->NeedsCopy)
|
||||
if (S->CopyRelSec)
|
||||
return S->CopyRelSec->getParent();
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -104,10 +104,6 @@ protected:
|
|||
const unsigned SymbolKind : 8;
|
||||
|
||||
public:
|
||||
// True if the linker has to generate a copy relocation.
|
||||
// For SharedSymbol only.
|
||||
unsigned NeedsCopy : 1;
|
||||
|
||||
// True the symbol should point to its PLT entry.
|
||||
// For SharedSymbol only.
|
||||
unsigned NeedsPltAddr : 1;
|
||||
|
|
Loading…
Reference in New Issue