bool hasSymbolData(const MCSymbol &Symbol) const { return Symbol.hasData(); }
- MCSymbolData &getSymbolData(const MCSymbol &Symbol) {
- return const_cast<MCSymbolData &>(
- static_cast<const MCAssembler &>(*this).getSymbolData(Symbol));
- }
-
- const MCSymbolData &getSymbolData(const MCSymbol &Symbol) const {
- return Symbol.getData();
- }
-
MCSymbolData &getOrCreateSymbolData(const MCSymbol &Symbol,
bool *Created = nullptr) {
if (Created)
if (!Ref)
continue;
const MCSymbol &Symbol = Ref->getSymbol();
- MCSymbolData &SD = Asm.getSymbolData(Symbol);
+ MCSymbolData &SD = Symbol.getData();
StringRef AliasName = Alias.getName();
size_t Pos = AliasName.find('@');
uint8_t Type = MCELF::GetType(OrigData);
MCSymbolData *BaseSD = nullptr;
if (Base) {
- BaseSD = &Layout.getAssembler().getSymbolData(*Base);
+ BaseSD = &Base->getData();
Type = mergeTypeForSet(Type, MCELF::GetType(*BaseSD));
}
uint8_t Info = (Binding << ELF_STB_Shift) | (Type << ELF_STT_Shift);
bool Local = isLocal(Symbol, Used);
if (!Local && MCELF::GetBinding(SD) == ELF::STB_LOCAL) {
assert(BaseSymbol);
- MCSymbolData &BaseData = Asm.getSymbolData(*BaseSymbol);
+ MCSymbolData &BaseData = BaseSymbol->getData();
MCELF::SetBinding(SD, ELF::STB_GLOBAL);
MCELF::SetBinding(BaseData, ELF::STB_GLOBAL);
}
const MCSymbol &ASym = A->getSymbol();
const MCAssembler &Asm = getAssembler();
- const MCSymbolData &ASD = Asm.getSymbolData(ASym);
+ const MCSymbolData &ASD = ASym.getData();
if (ASD.isCommon()) {
// FIXME: we should probably add a SMLoc to MCExpr.
Asm.getContext().reportFatalError(SMLoc(),
const MCSectionELF &Section =
static_cast<const MCSectionELF&>(Symbol->getSection());
- MCSymbolData &SD = getAssembler().getSymbolData(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
if (Section.getFlags() & ELF::SHF_TLS)
MCELF::SetType(SD, ELF::STT_TLS);
}
if (!Asm->getWriter().IsSymbolRefDifferenceFullyResolved(*Asm, A, B, InSet))
return;
- const MCSymbolData &AD = Asm->getSymbolData(SA);
- const MCSymbolData &BD = Asm->getSymbolData(SB);
+ const MCSymbolData &AD = SA.getData();
+ const MCSymbolData &BD = SB.getData();
if (AD.getFragment() == BD.getFragment()) {
Addend += (AD.getOffset() - BD.getOffset());
MCObjectStreamer::EmitLabel(Symbol);
- MCSymbolData &SD = getAssembler().getSymbolData(*Symbol);
+ MCSymbolData &SD = Symbol->getData();
// This causes the reference type flag to be cleared. Darwin 'as' was "trying"
// to clear the weak reference and weak definition bits too, but the
// implementation was buggy. For now we just try to match 'as', for
// Must have symbol data.
if (!Assembler->hasSymbolData(*Hi) || !Assembler->hasSymbolData(*Lo))
return false;
- auto &HiD = Assembler->getSymbolData(*Hi);
- auto &LoD = Assembler->getSymbolData(*Lo);
+ auto &HiD = Hi->getData();
+ auto &LoD = Lo->getData();
// Must both be assigned to the same (valid) fragment.
if (!HiD.getFragment() || HiD.getFragment() != LoD.getFragment())
if (SA.isUndefined() || SB.isUndefined())
return false;
- const MCSymbolData &DataA = Asm.getSymbolData(SA);
- const MCSymbolData &DataB = Asm.getSymbolData(SB);
+ const MCSymbolData &DataA = SA.getData();
+ const MCSymbolData &DataB = SB.getData();
if(!DataA.getFragment() || !DataB.getFragment())
return false;
if (!hasReliableSymbolDifference) {
if (!SA.isInSection() || &SecA != &SecB ||
(!SA.isTemporary() &&
- FB.getAtom() != Asm.getSymbolData(SA).getFragment()->getAtom() &&
+ FB.getAtom() != SA.getData().getFragment()->getAtom() &&
Asm.getSubsectionsViaSymbols()))
return false;
return true;
if (&SecA != &SecB)
return false;
- const MCFragment *FA = Asm.getSymbolData(SA).getFragment();
+ const MCFragment *FA = SA.getData().getFragment();
// Bail if the symbol has no fragment.
if (!FA)
static_cast<const MCSectionMachO &>(*it->Section);
if (Section.getType() == MachO::S_NON_LAZY_SYMBOL_POINTERS) {
// If this symbol is defined and internal, mark it as such.
- if (it->Symbol->isDefined() &&
- !Asm.getSymbolData(*it->Symbol).isExternal()) {
+ if (it->Symbol->isDefined() && !it->Symbol->getData().isExternal()) {
uint32_t Flags = MachO::INDIRECT_SYMBOL_LOCAL;
if (it->Symbol->isAbsolute())
Flags |= MachO::INDIRECT_SYMBOL_ABS;
coff_symbol->MC = &Symbol;
} else {
- const MCSymbolData &ResSymData = Assembler.getSymbolData(Symbol);
+ const MCSymbolData &ResSymData = Symbol.getData();
const MCSymbol *Base = Layout.getBaseSymbol(Symbol);
coff_symbol->Data.Value = getSymbolValue(Symbol, Layout);
if (!Base) {
coff_symbol->Data.SectionNumber = COFF::IMAGE_SYM_ABSOLUTE;
} else {
- const MCSymbolData &BaseData = Assembler.getSymbolData(*Base);
+ const MCSymbolData &BaseData = Base->getData();
if (BaseData.getFragment()) {
COFFSection *Sec = SectionMap[BaseData.getFragment()->getParent()];
Twine("symbol '") + A.getName() +
"' can not be undefined");
- const MCSymbolData &A_SD = Asm.getSymbolData(A);
+ const MCSymbolData &A_SD = A.getData();
MCSection *Section = Fragment->getParent();
if (SymB) {
const MCSymbol *B = &SymB->getSymbol();
- const MCSymbolData &B_SD = Asm.getSymbolData(*B);
+ const MCSymbolData &B_SD = B->getData();
if (!B_SD.getFragment())
Asm.getContext().reportFatalError(
Fixup.getLoc(),
}
} else if (Target.getSymB()) { // A - B + constant
const MCSymbol *A = &Target.getSymA()->getSymbol();
- const MCSymbolData &A_SD = Asm.getSymbolData(*A);
+ const MCSymbolData &A_SD = A->getData();
const MCSymbol *A_Base = Asm.getAtom(*A);
const MCSymbol *B = &Target.getSymB()->getSymbol();
- const MCSymbolData &B_SD = Asm.getSymbolData(*B);
+ const MCSymbolData &B_SD = B->getData();
const MCSymbol *B_Base = Asm.getAtom(*B);
// Check for "_foo@got - .", which comes through here as:
// the offset when the destination has the same MCFragment.
if (A && (unsigned)Fixup.getKind() == ARM::fixup_arm_thumb_bl) {
const MCSymbol &Sym = A->getSymbol();
- const MCSymbolData &SymData = Asm.getSymbolData(Sym);
+ const MCSymbolData &SymData = Sym.getData();
IsResolved = (SymData.getFragment() == DF);
}
// We must always generate a relocation for BL/BLX instructions if we have
// See <reloc.h>.
const MCSymbol *A = &Target.getSymA()->getSymbol();
- const MCSymbolData *A_SD = &Asm.getSymbolData(*A);
+ const MCSymbolData *A_SD = &A->getData();
if (!A_SD->getFragment())
Asm.getContext().reportFatalError(Fixup.getLoc(),
FixedValue += SecAddr;
if (const MCSymbolRefExpr *B = Target.getSymB()) {
- const MCSymbolData *B_SD = &Asm.getSymbolData(B->getSymbol());
+ const MCSymbolData *B_SD = &B->getSymbol().getData();
if (!B_SD->getFragment())
Asm.getContext().reportFatalError(Fixup.getLoc(),
// See <reloc.h>.
const MCSymbol *A = &Target.getSymA()->getSymbol();
- const MCSymbolData *A_SD = &Asm.getSymbolData(*A);
+ const MCSymbolData *A_SD = &A->getData();
if (!A_SD->getFragment())
Asm.getContext().reportFatalError(Fixup.getLoc(),
if (const MCSymbolRefExpr *B = Target.getSymB()) {
assert(Type == MachO::ARM_RELOC_VANILLA && "invalid reloc for 2 symbols");
- const MCSymbolData *B_SD = &Asm.getSymbolData(B->getSymbol());
+ const MCSymbolData *B_SD = &B->getSymbol().getData();
if (!B_SD->getFragment())
Asm.getContext().reportFatalError(Fixup.getLoc(),
if (Type == ELF::R_MIPS16_HI16)
return ELF::R_MIPS16_LO16;
- const MCSymbolData &SD = Asm.getSymbolData(*Reloc.Symbol);
+ const MCSymbolData &SD = Reloc.Symbol->getData();
if (MCELF::GetBinding(SD) != ELF::STB_LOCAL)
return ELF::R_MIPS_NONE;
// to resolve the fixup directly. Emit a relocation and leave
// resolution of the final target address to the linker.
if (const MCSymbolRefExpr *A = Target.getSymA()) {
- const MCSymbolData &Data = Asm.getSymbolData(A->getSymbol());
+ const MCSymbolData &Data = A->getSymbol().getData();
// The "other" values are stored in the last 6 bits of the second byte.
// The traditional defines for STO values assume the full byte and thus
// the shift to pack it.
// See <reloc.h>.
const MCSymbol *A = &Target.getSymA()->getSymbol();
- const MCSymbolData *A_SD = &Asm.getSymbolData(*A);
+ const MCSymbolData *A_SD = &A->getData();
if (!A_SD->getFragment())
report_fatal_error("symbol '" + A->getName() +
uint32_t Value2 = 0;
if (const MCSymbolRefExpr *B = Target.getSymB()) {
- const MCSymbolData *B_SD = &Asm.getSymbolData(B->getSymbol());
+ const MCSymbolData *B_SD = &B->getSymbol().getData();
if (!B_SD->getFragment())
report_fatal_error("symbol '" + B->getSymbol().getName() +
const MCSymbol *A = &Target.getSymA()->getSymbol();
if (A->isTemporary())
A = &Writer->findAliasedSymbol(*A);
- const MCSymbolData &A_SD = Asm.getSymbolData(*A);
+ const MCSymbolData &A_SD = A->getData();
const MCSymbol *A_Base = Asm.getAtom(*A);
const MCSymbol *B = &Target.getSymB()->getSymbol();
if (B->isTemporary())
B = &Writer->findAliasedSymbol(*B);
- const MCSymbolData &B_SD = Asm.getSymbolData(*B);
+ const MCSymbolData &B_SD = B->getData();
const MCSymbol *B_Base = Asm.getAtom(*B);
// Neither symbol can be modified.
if (!Asm.getContext().getAsmInfo()->isSectionAtomizableBySymbols(Sec))
Asm.addLocalUsedInReloc(*Symbol);
}
- const MCSymbolData &SD = Asm.getSymbolData(*Symbol);
+ const MCSymbolData &SD = Symbol->getData();
RelSymbol = Asm.getAtom(*Symbol);
// Relocations inside debug sections always use local relocations when
// See <reloc.h>.
const MCSymbol *A = &Target.getSymA()->getSymbol();
- const MCSymbolData *A_SD = &Asm.getSymbolData(*A);
+ const MCSymbolData *A_SD = &A->getData();
if (!A_SD->getFragment())
report_fatal_error("symbol '" + A->getName() +
uint32_t Value2 = 0;
if (const MCSymbolRefExpr *B = Target.getSymB()) {
- const MCSymbolData *B_SD = &Asm.getSymbolData(B->getSymbol());
+ const MCSymbolData *B_SD = &B->getSymbol().getData();
if (!B_SD->getFragment())
report_fatal_error("symbol '" + B->getSymbol().getName() +