SymbolDataListType Symbols;
- DenseSet<const MCSymbol *> LocalsUsedInReloc;
-
std::vector<IndirectSymbolData> IndirectSymbols;
std::vector<DataRegionData> DataRegions;
MCFragment &F, const MCFixup &Fixup);
public:
- void addLocalUsedInReloc(const MCSymbol &Sym);
- bool isLocalUsedInReloc(const MCSymbol &Sym) const;
-
/// Compute the effective fragment size assuming it is laid out at the given
/// \p SectionAddress and \p FragmentOffset.
uint64_t computeFragmentSize(const MCAsmLayout &Layout,
/// unsigned to avoid sign extension and achieve better bitpacking with MSVC.
unsigned Kind : 2;
+ /// True if we have created a relocation that uses this symbol.
+ mutable unsigned IsUsedInReloc : 1;
+
/// Index field, for use by the object file implementation.
mutable uint32_t Index = 0;
} NameEntryStorageTy;
MCSymbol(SymbolKind Kind, const StringMapEntry<bool> *Name, bool isTemporary)
- : Value(nullptr), IsTemporary(isTemporary),
- IsRedefinable(false), IsUsed(false), IsRegistered(false),
- IsExternal(false), IsPrivateExtern(false), HasName(!!Name),
- Kind(Kind) {
+ : Value(nullptr), IsTemporary(isTemporary), IsRedefinable(false),
+ IsUsed(false), IsRegistered(false), IsExternal(false),
+ IsPrivateExtern(false), HasName(!!Name), Kind(Kind),
+ IsUsedInReloc(false) {
Offset = 0;
if (Name)
getNameEntryPtr() = Name;
bool isRegistered() const { return IsRegistered; }
void setIsRegistered(bool Value) const { IsRegistered = Value; }
+ void setUsedInReloc() const { IsUsedInReloc = true; }
+ bool isUsedInReloc() const { return IsUsedInReloc; }
+
/// \name Accessors
/// @{
bool isBindingSet() const;
- void setUsedInReloc() const;
- bool isUsedInReloc() const;
-
void setIsWeakrefUsedInReloc() const;
bool isWeakrefUsedInReloc() const;
return true;
}
-void MCAssembler::addLocalUsedInReloc(const MCSymbol &Sym) {
- assert(Sym.isTemporary());
- LocalsUsedInReloc.insert(&Sym);
-}
-
-bool MCAssembler::isLocalUsedInReloc(const MCSymbol &Sym) const {
- assert(Sym.isTemporary());
- return LocalsUsedInReloc.count(&Sym);
-}
-
bool MCAssembler::isSymbolLinkerVisible(const MCSymbol &Symbol) const {
// Non-temporary labels should always be visible to the linker.
if (!Symbol.isTemporary())
if (!Symbol.isInSection())
return false;
- if (isLocalUsedInReloc(Symbol))
+ if (Symbol.isUsedInReloc())
return true;
return false;
ELF_WeakrefUsedInReloc_Shift = 11,
// One bit.
- ELF_UsedInReloc_Shift = 12,
-
- // One bit.
- ELF_BindingSet_Shift = 13
+ ELF_BindingSet_Shift = 12
};
}
return Other << 5;
}
-void MCSymbolELF::setUsedInReloc() const {
- uint32_t OtherFlags = getFlags() & ~(0x1 << ELF_UsedInReloc_Shift);
- setFlags(OtherFlags | (1 << ELF_UsedInReloc_Shift));
-}
-
-bool MCSymbolELF::isUsedInReloc() const {
- return getFlags() & (0x1 << ELF_UsedInReloc_Shift);
-}
-
void MCSymbolELF::setIsWeakrefUsedInReloc() const {
uint32_t OtherFlags = getFlags() & ~(0x1 << ELF_WeakrefUsedInReloc_Shift);
setFlags(OtherFlags | (1 << ELF_WeakrefUsedInReloc_Shift));
if (Symbol->isTemporary() && (Value || !CanUseLocalRelocation)) {
const MCSection &Sec = Symbol->getSection();
if (!Asm.getContext().getAsmInfo()->isSectionAtomizableBySymbols(Sec))
- Asm.addLocalUsedInReloc(*Symbol);
+ Symbol->setUsedInReloc();
}
const MCSymbol *Base = Asm.getAtom(*Symbol);
if (Symbol->isTemporary() && Value) {
const MCSection &Sec = Symbol->getSection();
if (!Asm.getContext().getAsmInfo()->isSectionAtomizableBySymbols(Sec))
- Asm.addLocalUsedInReloc(*Symbol);
+ Symbol->setUsedInReloc();
}
RelSymbol = Asm.getAtom(*Symbol);