forked from OSchip/llvm-project
parent
791e9f9c59
commit
76e24ea955
|
@ -83,7 +83,8 @@ SymbolBody *elf2::ObjectFile<ELFT>::createSymbolBody(StringRef StringTable,
|
|||
return new (Alloc) Undefined(Name);
|
||||
return new (Alloc) DefinedRegular(Name);
|
||||
case STB_WEAK:
|
||||
// FIXME: add support for weak undefined
|
||||
if (Sym->isUndefined())
|
||||
return new (Alloc) UndefinedWeak(Name);
|
||||
return new (Alloc) DefinedWeak(Name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ int SymbolBody::compare(SymbolBody *Other) {
|
|||
return 0;
|
||||
case DefinedWeakKind:
|
||||
case UndefinedKind:
|
||||
case UndefinedWeakKind:
|
||||
return 1;
|
||||
}
|
||||
llvm_unreachable("unknown symbol kind");
|
||||
|
|
|
@ -39,7 +39,8 @@ public:
|
|||
DefinedRegularKind = 0,
|
||||
DefinedWeakKind = 1,
|
||||
DefinedLast = 1,
|
||||
UndefinedKind = 2
|
||||
UndefinedWeakKind = 2,
|
||||
UndefinedKind = 3
|
||||
};
|
||||
|
||||
Kind kind() const { return static_cast<Kind>(SymbolKind); }
|
||||
|
@ -112,6 +113,15 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class UndefinedWeak : public SymbolBody {
|
||||
public:
|
||||
explicit UndefinedWeak(StringRef N) : SymbolBody(UndefinedWeakKind, N) {}
|
||||
|
||||
static bool classof(const SymbolBody *S) {
|
||||
return S->kind() == UndefinedWeakKind;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace elf2
|
||||
} // namespace lld
|
||||
|
||||
|
|
|
@ -13,3 +13,6 @@ local:
|
|||
foo:
|
||||
|
||||
.long bar
|
||||
|
||||
.weak zed
|
||||
.long zed
|
||||
|
|
Loading…
Reference in New Issue