mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Convert BindingExplicitlySet into a MCSymbolELF field.
I will pack it better in a followup patch. llvm-svn: 238975
This commit is contained in:
parent
22476acba6
commit
63813d4589
@ -37,7 +37,6 @@ public:
|
|||||||
void reset() override {
|
void reset() override {
|
||||||
SeenIdent = false;
|
SeenIdent = false;
|
||||||
LocalCommons.clear();
|
LocalCommons.clear();
|
||||||
BindingExplicitlySet.clear();
|
|
||||||
BundleGroups.clear();
|
BundleGroups.clear();
|
||||||
MCObjectStreamer::reset();
|
MCObjectStreamer::reset();
|
||||||
}
|
}
|
||||||
@ -106,8 +105,6 @@ private:
|
|||||||
|
|
||||||
std::vector<LocalCommon> LocalCommons;
|
std::vector<LocalCommon> LocalCommons;
|
||||||
|
|
||||||
SmallPtrSet<MCSymbol *, 16> BindingExplicitlySet;
|
|
||||||
|
|
||||||
/// BundleGroups - The stack of fragments holding the bundle-locked
|
/// BundleGroups - The stack of fragments holding the bundle-locked
|
||||||
/// instructions.
|
/// instructions.
|
||||||
llvm::SmallVector<MCDataFragment *, 4> BundleGroups;
|
llvm::SmallVector<MCDataFragment *, 4> BundleGroups;
|
||||||
|
@ -17,9 +17,11 @@ class MCSymbolELF : public MCSymbol {
|
|||||||
/// symbol has no size this field will be NULL.
|
/// symbol has no size this field will be NULL.
|
||||||
const MCExpr *SymbolSize = nullptr;
|
const MCExpr *SymbolSize = nullptr;
|
||||||
|
|
||||||
|
mutable unsigned BindingSet : 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MCSymbolELF(const StringMapEntry<bool> *Name, bool isTemporary)
|
MCSymbolELF(const StringMapEntry<bool> *Name, bool isTemporary)
|
||||||
: MCSymbol(true, Name, isTemporary) {}
|
: MCSymbol(true, Name, isTemporary), BindingSet(false) {}
|
||||||
void setSize(const MCExpr *SS) { SymbolSize = SS; }
|
void setSize(const MCExpr *SS) { SymbolSize = SS; }
|
||||||
|
|
||||||
const MCExpr *getSize() const { return SymbolSize; }
|
const MCExpr *getSize() const { return SymbolSize; }
|
||||||
@ -36,6 +38,8 @@ public:
|
|||||||
void setBinding(unsigned Binding) const;
|
void setBinding(unsigned Binding) const;
|
||||||
unsigned getBinding() const;
|
unsigned getBinding() const;
|
||||||
|
|
||||||
|
bool isBindingSet() const { return BindingSet; }
|
||||||
|
|
||||||
static bool classof(const MCSymbol *S) { return S->isELF(); }
|
static bool classof(const MCSymbol *S) { return S->isELF(); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -241,26 +241,22 @@ bool MCELFStreamer::EmitSymbolAttribute(MCSymbol *S, MCSymbolAttr Attribute) {
|
|||||||
Symbol->setType(CombineSymbolTypes(Symbol->getType(), ELF::STT_OBJECT));
|
Symbol->setType(CombineSymbolTypes(Symbol->getType(), ELF::STT_OBJECT));
|
||||||
Symbol->setBinding(ELF::STB_GNU_UNIQUE);
|
Symbol->setBinding(ELF::STB_GNU_UNIQUE);
|
||||||
Symbol->setExternal(true);
|
Symbol->setExternal(true);
|
||||||
BindingExplicitlySet.insert(Symbol);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCSA_Global:
|
case MCSA_Global:
|
||||||
Symbol->setBinding(ELF::STB_GLOBAL);
|
Symbol->setBinding(ELF::STB_GLOBAL);
|
||||||
Symbol->setExternal(true);
|
Symbol->setExternal(true);
|
||||||
BindingExplicitlySet.insert(Symbol);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCSA_WeakReference:
|
case MCSA_WeakReference:
|
||||||
case MCSA_Weak:
|
case MCSA_Weak:
|
||||||
Symbol->setBinding(ELF::STB_WEAK);
|
Symbol->setBinding(ELF::STB_WEAK);
|
||||||
Symbol->setExternal(true);
|
Symbol->setExternal(true);
|
||||||
BindingExplicitlySet.insert(Symbol);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCSA_Local:
|
case MCSA_Local:
|
||||||
Symbol->setBinding(ELF::STB_LOCAL);
|
Symbol->setBinding(ELF::STB_LOCAL);
|
||||||
Symbol->setExternal(false);
|
Symbol->setExternal(false);
|
||||||
BindingExplicitlySet.insert(Symbol);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCSA_ELF_TypeFunction:
|
case MCSA_ELF_TypeFunction:
|
||||||
@ -309,7 +305,7 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
|
|||||||
auto *Symbol = cast<MCSymbolELF>(S);
|
auto *Symbol = cast<MCSymbolELF>(S);
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
|
|
||||||
if (!BindingExplicitlySet.count(Symbol)) {
|
if (!Symbol->isBindingSet()) {
|
||||||
Symbol->setBinding(ELF::STB_GLOBAL);
|
Symbol->setBinding(ELF::STB_GLOBAL);
|
||||||
Symbol->setExternal(true);
|
Symbol->setExternal(true);
|
||||||
}
|
}
|
||||||
@ -343,7 +339,6 @@ void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
|
|||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
Symbol->setBinding(ELF::STB_LOCAL);
|
Symbol->setBinding(ELF::STB_LOCAL);
|
||||||
Symbol->setExternal(false);
|
Symbol->setExternal(false);
|
||||||
BindingExplicitlySet.insert(Symbol);
|
|
||||||
EmitCommonSymbol(Symbol, Size, ByteAlignment);
|
EmitCommonSymbol(Symbol, Size, ByteAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
void MCSymbolELF::setBinding(unsigned Binding) const {
|
void MCSymbolELF::setBinding(unsigned Binding) const {
|
||||||
|
BindingSet = true;
|
||||||
assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
|
assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
|
||||||
Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
|
Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
|
||||||
uint32_t OtherFlags = getFlags() & ~(0xf << ELF_STB_Shift);
|
uint32_t OtherFlags = getFlags() & ~(0xf << ELF_STB_Shift);
|
||||||
|
Loading…
Reference in New Issue
Block a user