void reset() override {
SeenIdent = false;
LocalCommons.clear();
- BindingExplicitlySet.clear();
BundleGroups.clear();
MCObjectStreamer::reset();
}
std::vector<LocalCommon> LocalCommons;
- SmallPtrSet<MCSymbol *, 16> BindingExplicitlySet;
-
/// BundleGroups - The stack of fragments holding the bundle-locked
/// instructions.
llvm::SmallVector<MCDataFragment *, 4> BundleGroups;
/// 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; }
void setBinding(unsigned Binding) const;
unsigned getBinding() const;
+ bool isBindingSet() const { return BindingSet; }
+
static bool classof(const MCSymbol *S) { return S->isELF(); }
};
}
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:
auto *Symbol = cast<MCSymbolELF>(S);
getAssembler().registerSymbol(*Symbol);
- if (!BindingExplicitlySet.count(Symbol)) {
+ if (!Symbol->isBindingSet()) {
Symbol->setBinding(ELF::STB_GLOBAL);
Symbol->setExternal(true);
}
getAssembler().registerSymbol(*Symbol);
Symbol->setBinding(ELF::STB_LOCAL);
Symbol->setExternal(false);
- BindingExplicitlySet.insert(Symbol);
EmitCommonSymbol(Symbol, Size, ByteAlignment);
}
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);