1
0
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:
Rafael Espindola 2015-06-03 21:18:03 +00:00
parent 22476acba6
commit 63813d4589
4 changed files with 7 additions and 10 deletions

View File

@ -37,7 +37,6 @@ public:
void reset() override {
SeenIdent = false;
LocalCommons.clear();
BindingExplicitlySet.clear();
BundleGroups.clear();
MCObjectStreamer::reset();
}
@ -106,8 +105,6 @@ private:
std::vector<LocalCommon> LocalCommons;
SmallPtrSet<MCSymbol *, 16> BindingExplicitlySet;
/// BundleGroups - The stack of fragments holding the bundle-locked
/// instructions.
llvm::SmallVector<MCDataFragment *, 4> BundleGroups;

View File

@ -17,9 +17,11 @@ class MCSymbolELF : public MCSymbol {
/// symbol has no size this field will be NULL.
const MCExpr *SymbolSize = nullptr;
mutable unsigned BindingSet : 1;
public:
MCSymbolELF(const StringMapEntry<bool> *Name, bool isTemporary)
: MCSymbol(true, Name, isTemporary) {}
: MCSymbol(true, Name, isTemporary), BindingSet(false) {}
void setSize(const MCExpr *SS) { SymbolSize = SS; }
const MCExpr *getSize() const { return SymbolSize; }
@ -36,6 +38,8 @@ public:
void setBinding(unsigned Binding) const;
unsigned getBinding() const;
bool isBindingSet() const { return BindingSet; }
static bool classof(const MCSymbol *S) { return S->isELF(); }
};
}

View File

@ -241,26 +241,22 @@ bool MCELFStreamer::EmitSymbolAttribute(MCSymbol *S, MCSymbolAttr Attribute) {
Symbol->setType(CombineSymbolTypes(Symbol->getType(), ELF::STT_OBJECT));
Symbol->setBinding(ELF::STB_GNU_UNIQUE);
Symbol->setExternal(true);
BindingExplicitlySet.insert(Symbol);
break;
case MCSA_Global:
Symbol->setBinding(ELF::STB_GLOBAL);
Symbol->setExternal(true);
BindingExplicitlySet.insert(Symbol);
break;
case MCSA_WeakReference:
case MCSA_Weak:
Symbol->setBinding(ELF::STB_WEAK);
Symbol->setExternal(true);
BindingExplicitlySet.insert(Symbol);
break;
case MCSA_Local:
Symbol->setBinding(ELF::STB_LOCAL);
Symbol->setExternal(false);
BindingExplicitlySet.insert(Symbol);
break;
case MCSA_ELF_TypeFunction:
@ -309,7 +305,7 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *S, uint64_t Size,
auto *Symbol = cast<MCSymbolELF>(S);
getAssembler().registerSymbol(*Symbol);
if (!BindingExplicitlySet.count(Symbol)) {
if (!Symbol->isBindingSet()) {
Symbol->setBinding(ELF::STB_GLOBAL);
Symbol->setExternal(true);
}
@ -343,7 +339,6 @@ void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
getAssembler().registerSymbol(*Symbol);
Symbol->setBinding(ELF::STB_LOCAL);
Symbol->setExternal(false);
BindingExplicitlySet.insert(Symbol);
EmitCommonSymbol(Symbol, Size, ByteAlignment);
}

View File

@ -16,6 +16,7 @@
namespace llvm {
void MCSymbolELF::setBinding(unsigned Binding) const {
BindingSet = true;
assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
uint32_t OtherFlags = getFlags() & ~(0xf << ELF_STB_Shift);