forked from OSchip/llvm-project
parent
8db87291ef
commit
0509876f3f
|
@ -236,7 +236,8 @@ template <class ELFT>
|
||||||
std::pair<Symbol *, bool>
|
std::pair<Symbol *, bool>
|
||||||
SymbolTable<ELFT>::insert(StringRef &Name, uint8_t Type, uint8_t Visibility,
|
SymbolTable<ELFT>::insert(StringRef &Name, uint8_t Type, uint8_t Visibility,
|
||||||
bool CanOmitFromDynSym, bool HasUnnamedAddr,
|
bool CanOmitFromDynSym, bool HasUnnamedAddr,
|
||||||
bool IsUsedInRegularObj, InputFile *File) {
|
InputFile *File) {
|
||||||
|
bool IsUsedInRegularObj = !File || File->kind() == InputFile::ObjectKind;
|
||||||
Symbol *S;
|
Symbol *S;
|
||||||
bool WasInserted;
|
bool WasInserted;
|
||||||
std::tie(S, WasInserted) = insert(Name);
|
std::tie(S, WasInserted) = insert(Name);
|
||||||
|
@ -283,8 +284,7 @@ Symbol *SymbolTable<ELFT>::addUndefined(StringRef Name, uint8_t Binding,
|
||||||
Symbol *S;
|
Symbol *S;
|
||||||
bool WasInserted;
|
bool WasInserted;
|
||||||
std::tie(S, WasInserted) =
|
std::tie(S, WasInserted) =
|
||||||
insert(Name, Type, StOther & 3, CanOmitFromDynSym, HasUnnamedAddr,
|
insert(Name, Type, StOther & 3, CanOmitFromDynSym, HasUnnamedAddr, File);
|
||||||
/*IsUsedInRegularObj*/ !File || !isa<BitcodeFile>(File), File);
|
|
||||||
if (WasInserted) {
|
if (WasInserted) {
|
||||||
S->Binding = Binding;
|
S->Binding = Binding;
|
||||||
replaceBody<Undefined>(S, Name, StOther, Type, File);
|
replaceBody<Undefined>(S, Name, StOther, Type, File);
|
||||||
|
@ -349,9 +349,8 @@ Symbol *SymbolTable<ELFT>::addCommon(StringRef N, uint64_t Size,
|
||||||
bool HasUnnamedAddr, InputFile *File) {
|
bool HasUnnamedAddr, InputFile *File) {
|
||||||
Symbol *S;
|
Symbol *S;
|
||||||
bool WasInserted;
|
bool WasInserted;
|
||||||
std::tie(S, WasInserted) =
|
std::tie(S, WasInserted) = insert(
|
||||||
insert(N, Type, StOther & 3, /*CanOmitFromDynSym*/ false, HasUnnamedAddr,
|
N, Type, StOther & 3, /*CanOmitFromDynSym*/ false, HasUnnamedAddr, File);
|
||||||
!isa<BitcodeFile>(File), File);
|
|
||||||
int Cmp = compareDefined(S, WasInserted, Binding);
|
int Cmp = compareDefined(S, WasInserted, Binding);
|
||||||
if (Cmp > 0) {
|
if (Cmp > 0) {
|
||||||
S->Binding = Binding;
|
S->Binding = Binding;
|
||||||
|
@ -390,10 +389,10 @@ Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, const Elf_Sym &Sym,
|
||||||
InputSectionBase<ELFT> *Section) {
|
InputSectionBase<ELFT> *Section) {
|
||||||
Symbol *S;
|
Symbol *S;
|
||||||
bool WasInserted;
|
bool WasInserted;
|
||||||
std::tie(S, WasInserted) = insert(
|
std::tie(S, WasInserted) =
|
||||||
Name, Sym.getType(), Sym.getVisibility(),
|
insert(Name, Sym.getType(), Sym.getVisibility(),
|
||||||
/*CanOmitFromDynSym*/ false, /*HasUnnamedAddr*/ false,
|
/*CanOmitFromDynSym*/ false, /*HasUnnamedAddr*/ false,
|
||||||
/*IsUsedInRegularObj*/ true, Section ? Section->getFile() : nullptr);
|
Section ? Section->getFile() : nullptr);
|
||||||
int Cmp = compareDefinedNonCommon(S, WasInserted, Sym.getBinding());
|
int Cmp = compareDefinedNonCommon(S, WasInserted, Sym.getBinding());
|
||||||
if (Cmp > 0)
|
if (Cmp > 0)
|
||||||
replaceBody<DefinedRegular<ELFT>>(S, Name, Sym, Section);
|
replaceBody<DefinedRegular<ELFT>>(S, Name, Sym, Section);
|
||||||
|
@ -409,7 +408,7 @@ Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, uint8_t Binding,
|
||||||
bool WasInserted;
|
bool WasInserted;
|
||||||
std::tie(S, WasInserted) =
|
std::tie(S, WasInserted) =
|
||||||
insert(Name, STT_NOTYPE, StOther & 3, /*CanOmitFromDynSym*/ false,
|
insert(Name, STT_NOTYPE, StOther & 3, /*CanOmitFromDynSym*/ false,
|
||||||
/*HasUnnamedAddr*/ false, /*IsUsedInRegularObj*/ true, nullptr);
|
/*HasUnnamedAddr*/ false, nullptr);
|
||||||
int Cmp = compareDefinedNonCommon(S, WasInserted, Binding);
|
int Cmp = compareDefinedNonCommon(S, WasInserted, Binding);
|
||||||
if (Cmp > 0)
|
if (Cmp > 0)
|
||||||
replaceBody<DefinedRegular<ELFT>>(S, Name, StOther);
|
replaceBody<DefinedRegular<ELFT>>(S, Name, StOther);
|
||||||
|
@ -426,8 +425,7 @@ Symbol *SymbolTable<ELFT>::addSynthetic(StringRef N,
|
||||||
bool WasInserted;
|
bool WasInserted;
|
||||||
std::tie(S, WasInserted) = insert(N, STT_NOTYPE, /*Visibility*/ StOther & 0x3,
|
std::tie(S, WasInserted) = insert(N, STT_NOTYPE, /*Visibility*/ StOther & 0x3,
|
||||||
/*CanOmitFromDynSym*/ false,
|
/*CanOmitFromDynSym*/ false,
|
||||||
/*HasUnnamedAddr*/ false,
|
/*HasUnnamedAddr*/ false, nullptr);
|
||||||
/*IsUsedInRegularObj*/ true, nullptr);
|
|
||||||
int Cmp = compareDefinedNonCommon(S, WasInserted, STB_GLOBAL);
|
int Cmp = compareDefinedNonCommon(S, WasInserted, STB_GLOBAL);
|
||||||
if (Cmp > 0)
|
if (Cmp > 0)
|
||||||
replaceBody<DefinedSynthetic<ELFT>>(S, N, Value, Section);
|
replaceBody<DefinedSynthetic<ELFT>>(S, N, Value, Section);
|
||||||
|
@ -447,7 +445,7 @@ void SymbolTable<ELFT>::addShared(SharedFile<ELFT> *F, StringRef Name,
|
||||||
bool WasInserted;
|
bool WasInserted;
|
||||||
std::tie(S, WasInserted) =
|
std::tie(S, WasInserted) =
|
||||||
insert(Name, Sym.getType(), STV_DEFAULT, /*CanOmitFromDynSym*/ true,
|
insert(Name, Sym.getType(), STV_DEFAULT, /*CanOmitFromDynSym*/ true,
|
||||||
/*HasUnnamedAddr*/ false, /*IsUsedInRegularObj*/ false, F);
|
/*HasUnnamedAddr*/ false, F);
|
||||||
// Make sure we preempt DSO symbols with default visibility.
|
// Make sure we preempt DSO symbols with default visibility.
|
||||||
if (Sym.getVisibility() == STV_DEFAULT)
|
if (Sym.getVisibility() == STV_DEFAULT)
|
||||||
S->ExportDynamic = true;
|
S->ExportDynamic = true;
|
||||||
|
@ -466,8 +464,7 @@ Symbol *SymbolTable<ELFT>::addBitcode(StringRef Name, uint8_t Binding,
|
||||||
Symbol *S;
|
Symbol *S;
|
||||||
bool WasInserted;
|
bool WasInserted;
|
||||||
std::tie(S, WasInserted) =
|
std::tie(S, WasInserted) =
|
||||||
insert(Name, Type, StOther & 3, CanOmitFromDynSym, HasUnnamedAddr,
|
insert(Name, Type, StOther & 3, CanOmitFromDynSym, HasUnnamedAddr, F);
|
||||||
/*IsUsedInRegularObj*/ false, F);
|
|
||||||
int Cmp = compareDefinedNonCommon(S, WasInserted, Binding);
|
int Cmp = compareDefinedNonCommon(S, WasInserted, Binding);
|
||||||
if (Cmp > 0)
|
if (Cmp > 0)
|
||||||
replaceBody<DefinedRegular<ELFT>>(S, Name, StOther, Type, F);
|
replaceBody<DefinedRegular<ELFT>>(S, Name, StOther, Type, F);
|
||||||
|
|
|
@ -95,8 +95,7 @@ private:
|
||||||
std::pair<Symbol *, bool> insert(StringRef &Name);
|
std::pair<Symbol *, bool> insert(StringRef &Name);
|
||||||
std::pair<Symbol *, bool> insert(StringRef &Name, uint8_t Type,
|
std::pair<Symbol *, bool> insert(StringRef &Name, uint8_t Type,
|
||||||
uint8_t Visibility, bool CanOmitFromDynSym,
|
uint8_t Visibility, bool CanOmitFromDynSym,
|
||||||
bool HasUnnamedAddr, bool IsUsedInRegularObj,
|
bool HasUnnamedAddr, InputFile *File);
|
||||||
InputFile *File);
|
|
||||||
|
|
||||||
std::string conflictMsg(SymbolBody *Existing, InputFile *NewFile);
|
std::string conflictMsg(SymbolBody *Existing, InputFile *NewFile);
|
||||||
void reportDuplicate(SymbolBody *Existing, InputFile *NewFile);
|
void reportDuplicate(SymbolBody *Existing, InputFile *NewFile);
|
||||||
|
|
Loading…
Reference in New Issue