mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
Remove the MCSymbolData typedef.
The getData member function is next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238611 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "llvm/Support/ELF.h"
|
#include "llvm/Support/ELF.h"
|
||||||
|
|
||||||
// Because all the symbol flags need to be stored in the MCSymbolData
|
// Because all the symbol flags need to be stored in the MCSymbol
|
||||||
// 'flags' variable we need to provide shift constants per flag type.
|
// 'flags' variable we need to provide shift constants per flag type.
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
@@ -283,8 +283,6 @@ public:
|
|||||||
void dump() const;
|
void dump() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef MCSymbol MCSymbolData;
|
|
||||||
|
|
||||||
inline raw_ostream &operator<<(raw_ostream &OS, const MCSymbol &Sym) {
|
inline raw_ostream &operator<<(raw_ostream &OS, const MCSymbol &Sym) {
|
||||||
Sym.print(OS);
|
Sym.print(OS);
|
||||||
return OS;
|
return OS;
|
||||||
|
@@ -359,7 +359,7 @@ void ELFObjectWriter::writeHeader(const MCAssembler &Asm) {
|
|||||||
|
|
||||||
uint64_t ELFObjectWriter::SymbolValue(const MCSymbol &Sym,
|
uint64_t ELFObjectWriter::SymbolValue(const MCSymbol &Sym,
|
||||||
const MCAsmLayout &Layout) {
|
const MCAsmLayout &Layout) {
|
||||||
MCSymbolData &Data = Sym.getData();
|
MCSymbol &Data = Sym.getData();
|
||||||
if (Sym.isCommon() && Data.isExternal())
|
if (Sym.isCommon() && Data.isExternal())
|
||||||
return Sym.getCommonAlignment();
|
return Sym.getCommonAlignment();
|
||||||
|
|
||||||
@@ -379,7 +379,7 @@ void ELFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
|
|||||||
// versions declared with @@@ to be renamed.
|
// versions declared with @@@ to be renamed.
|
||||||
|
|
||||||
for (const MCSymbol &Alias : Asm.symbols()) {
|
for (const MCSymbol &Alias : Asm.symbols()) {
|
||||||
MCSymbolData &OriginalData = Alias.getData();
|
MCSymbol &OriginalData = Alias.getData();
|
||||||
|
|
||||||
// Not an alias.
|
// Not an alias.
|
||||||
if (!Alias.isVariable())
|
if (!Alias.isVariable())
|
||||||
@@ -388,7 +388,7 @@ void ELFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
|
|||||||
if (!Ref)
|
if (!Ref)
|
||||||
continue;
|
continue;
|
||||||
const MCSymbol &Symbol = Ref->getSymbol();
|
const MCSymbol &Symbol = Ref->getSymbol();
|
||||||
MCSymbolData &SD = Symbol.getData();
|
MCSymbol &SD = Symbol.getData();
|
||||||
|
|
||||||
StringRef AliasName = Alias.getName();
|
StringRef AliasName = Alias.getName();
|
||||||
size_t Pos = AliasName.find('@');
|
size_t Pos = AliasName.find('@');
|
||||||
@@ -452,7 +452,7 @@ void ELFObjectWriter::writeSymbol(SymbolTableWriter &Writer,
|
|||||||
uint32_t StringIndex, ELFSymbolData &MSD,
|
uint32_t StringIndex, ELFSymbolData &MSD,
|
||||||
const MCAsmLayout &Layout) {
|
const MCAsmLayout &Layout) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
MCSymbolData &OrigData = MSD.Symbol->getData();
|
MCSymbol &OrigData = MSD.Symbol->getData();
|
||||||
assert((!OrigData.getFragment() ||
|
assert((!OrigData.getFragment() ||
|
||||||
(OrigData.getFragment()->getParent() == &MSD.Symbol->getSection())) &&
|
(OrigData.getFragment()->getParent() == &MSD.Symbol->getSection())) &&
|
||||||
"The symbol's section doesn't match the fragment's symbol");
|
"The symbol's section doesn't match the fragment's symbol");
|
||||||
@@ -466,7 +466,7 @@ void ELFObjectWriter::writeSymbol(SymbolTableWriter &Writer,
|
|||||||
// Binding and Type share the same byte as upper and lower nibbles
|
// Binding and Type share the same byte as upper and lower nibbles
|
||||||
uint8_t Binding = MCELF::GetBinding(*MSD.Symbol);
|
uint8_t Binding = MCELF::GetBinding(*MSD.Symbol);
|
||||||
uint8_t Type = MCELF::GetType(*MSD.Symbol);
|
uint8_t Type = MCELF::GetType(*MSD.Symbol);
|
||||||
MCSymbolData *BaseSD = nullptr;
|
MCSymbol *BaseSD = nullptr;
|
||||||
if (Base) {
|
if (Base) {
|
||||||
BaseSD = &Base->getData();
|
BaseSD = &Base->getData();
|
||||||
Type = mergeTypeForSet(Type, MCELF::GetType(*Base));
|
Type = mergeTypeForSet(Type, MCELF::GetType(*Base));
|
||||||
@@ -769,7 +769,7 @@ bool ELFObjectWriter::isInSymtab(const MCAsmLayout &Layout,
|
|||||||
|
|
||||||
bool ELFObjectWriter::isLocal(const MCSymbol &Symbol, bool IsUsedInReloc,
|
bool ELFObjectWriter::isLocal(const MCSymbol &Symbol, bool IsUsedInReloc,
|
||||||
bool IsSignature) {
|
bool IsSignature) {
|
||||||
const MCSymbolData &Data = Symbol.getData();
|
const MCSymbol &Data = Symbol.getData();
|
||||||
if (Data.isExternal())
|
if (Data.isExternal())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -120,7 +120,7 @@ uint64_t MCAsmLayout::getFragmentOffset(const MCFragment *F) const {
|
|||||||
// Simple getSymbolOffset helper for the non-varibale case.
|
// Simple getSymbolOffset helper for the non-varibale case.
|
||||||
static bool getLabelOffset(const MCAsmLayout &Layout, const MCSymbol &S,
|
static bool getLabelOffset(const MCAsmLayout &Layout, const MCSymbol &S,
|
||||||
bool ReportError, uint64_t &Val) {
|
bool ReportError, uint64_t &Val) {
|
||||||
const MCSymbolData &SD = S.getData();
|
const MCSymbol &SD = S.getData();
|
||||||
if (!SD.getFragment()) {
|
if (!SD.getFragment()) {
|
||||||
if (ReportError)
|
if (ReportError)
|
||||||
report_fatal_error("unable to evaluate offset to undefined symbol '" +
|
report_fatal_error("unable to evaluate offset to undefined symbol '" +
|
||||||
|
@@ -214,7 +214,7 @@ bool MCELFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
|||||||
// important side effect of calling registerSymbol here is to register
|
// important side effect of calling registerSymbol here is to register
|
||||||
// the symbol with the assembler.
|
// the symbol with the assembler.
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
|
|
||||||
// The implementation of symbol attributes is designed to match 'as', but it
|
// The implementation of symbol attributes is designed to match 'as', but it
|
||||||
// leaves much to desired. It doesn't really make sense to arbitrarily add and
|
// leaves much to desired. It doesn't really make sense to arbitrarily add and
|
||||||
@@ -314,7 +314,7 @@ bool MCELFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
|||||||
void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) {
|
unsigned ByteAlignment) {
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
|
|
||||||
if (!BindingExplicitlySet.count(Symbol)) {
|
if (!BindingExplicitlySet.count(Symbol)) {
|
||||||
MCELF::SetBinding(*Symbol, ELF::STB_GLOBAL);
|
MCELF::SetBinding(*Symbol, ELF::STB_GLOBAL);
|
||||||
@@ -346,7 +346,7 @@ void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
unsigned ByteAlignment) {
|
unsigned ByteAlignment) {
|
||||||
// FIXME: Should this be caught and done earlier?
|
// FIXME: Should this be caught and done earlier?
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
|
MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
|
||||||
SD.setExternal(false);
|
SD.setExternal(false);
|
||||||
BindingExplicitlySet.insert(Symbol);
|
BindingExplicitlySet.insert(Symbol);
|
||||||
|
@@ -471,8 +471,8 @@ static void AttemptToFoldSymbolOffsetDifference(
|
|||||||
if (!Asm->getWriter().IsSymbolRefDifferenceFullyResolved(*Asm, A, B, InSet))
|
if (!Asm->getWriter().IsSymbolRefDifferenceFullyResolved(*Asm, A, B, InSet))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const MCSymbolData &AD = SA.getData();
|
const MCSymbol &AD = SA.getData();
|
||||||
const MCSymbolData &BD = SB.getData();
|
const MCSymbol &BD = SB.getData();
|
||||||
|
|
||||||
if (AD.getFragment() == BD.getFragment()) {
|
if (AD.getFragment() == BD.getFragment()) {
|
||||||
Addend += (SA.getOffset() - SB.getOffset());
|
Addend += (SA.getOffset() - SB.getOffset());
|
||||||
|
@@ -173,7 +173,7 @@ void MCMachOStreamer::ChangeSection(MCSection *Section,
|
|||||||
void MCMachOStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
|
void MCMachOStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
|
||||||
MCSymbol *EHSymbol) {
|
MCSymbol *EHSymbol) {
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
if (SD.isExternal())
|
if (SD.isExternal())
|
||||||
EmitSymbolAttribute(EHSymbol, MCSA_Global);
|
EmitSymbolAttribute(EHSymbol, MCSA_Global);
|
||||||
if (Symbol->getFlags() & SF_WeakDefinition)
|
if (Symbol->getFlags() & SF_WeakDefinition)
|
||||||
@@ -296,7 +296,7 @@ bool MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
|||||||
// important side effect of calling registerSymbol here is to register
|
// important side effect of calling registerSymbol here is to register
|
||||||
// the symbol with the assembler.
|
// the symbol with the assembler.
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
|
|
||||||
// The implementation of symbol attributes is designed to match 'as', but it
|
// The implementation of symbol attributes is designed to match 'as', but it
|
||||||
// leaves much to desired. It doesn't really make sense to arbitrarily add and
|
// leaves much to desired. It doesn't really make sense to arbitrarily add and
|
||||||
@@ -391,7 +391,7 @@ void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
AssignSection(Symbol, nullptr);
|
AssignSection(Symbol, nullptr);
|
||||||
|
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
SD.setExternal(true);
|
SD.setExternal(true);
|
||||||
Symbol->setCommon(Size, ByteAlignment);
|
Symbol->setCommon(Size, ByteAlignment);
|
||||||
}
|
}
|
||||||
@@ -417,7 +417,7 @@ void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
|||||||
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
|
assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
|
||||||
|
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
|
|
||||||
// Emit an align fragment if necessary.
|
// Emit an align fragment if necessary.
|
||||||
if (ByteAlignment != 1)
|
if (ByteAlignment != 1)
|
||||||
@@ -469,7 +469,7 @@ void MCMachOStreamer::FinishImpl() {
|
|||||||
// defining symbols.
|
// defining symbols.
|
||||||
DenseMap<const MCFragment *, const MCSymbol *> DefiningSymbolMap;
|
DenseMap<const MCFragment *, const MCSymbol *> DefiningSymbolMap;
|
||||||
for (const MCSymbol &Symbol : getAssembler().symbols()) {
|
for (const MCSymbol &Symbol : getAssembler().symbols()) {
|
||||||
MCSymbolData &SD = Symbol.getData();
|
MCSymbol &SD = Symbol.getData();
|
||||||
if (getAssembler().isSymbolLinkerVisible(Symbol) && SD.getFragment()) {
|
if (getAssembler().isSymbolLinkerVisible(Symbol) && SD.getFragment()) {
|
||||||
// An atom defining symbol should never be internal to a fragment.
|
// An atom defining symbol should never be internal to a fragment.
|
||||||
assert(Symbol.getOffset() == 0 &&
|
assert(Symbol.getOffset() == 0 &&
|
||||||
|
@@ -47,7 +47,7 @@ void MCObjectStreamer::flushPendingLabels(MCFragment *F, uint64_t FOffset) {
|
|||||||
F->setParent(CurSection);
|
F->setParent(CurSection);
|
||||||
}
|
}
|
||||||
for (MCSymbol *Sym : PendingLabels) {
|
for (MCSymbol *Sym : PendingLabels) {
|
||||||
MCSymbolData *SD = &Sym->getData();
|
MCSymbol *SD = &Sym->getData();
|
||||||
SD->setFragment(F);
|
SD->setFragment(F);
|
||||||
Sym->setOffset(FOffset);
|
Sym->setOffset(FOffset);
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ void MCObjectStreamer::EmitLabel(MCSymbol *Symbol) {
|
|||||||
MCStreamer::EmitLabel(Symbol);
|
MCStreamer::EmitLabel(Symbol);
|
||||||
|
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
assert(!SD.getFragment() && "Unexpected fragment on symbol data!");
|
assert(!SD.getFragment() && "Unexpected fragment on symbol data!");
|
||||||
|
|
||||||
// If there is a current fragment, mark the symbol as pointing into it.
|
// If there is a current fragment, mark the symbol as pointing into it.
|
||||||
|
@@ -30,8 +30,8 @@ bool MCObjectWriter::IsSymbolRefDifferenceFullyResolved(
|
|||||||
if (SA.isUndefined() || SB.isUndefined())
|
if (SA.isUndefined() || SB.isUndefined())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const MCSymbolData &DataA = SA.getData();
|
const MCSymbol &DataA = SA.getData();
|
||||||
const MCSymbolData &DataB = SB.getData();
|
const MCSymbol &DataB = SB.getData();
|
||||||
if(!DataA.getFragment() || !DataB.getFragment())
|
if(!DataA.getFragment() || !DataB.getFragment())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@@ -329,7 +329,7 @@ const MCSymbol &MachObjectWriter::findAliasedSymbol(const MCSymbol &Sym) const {
|
|||||||
void MachObjectWriter::WriteNlist(MachSymbolData &MSD,
|
void MachObjectWriter::WriteNlist(MachSymbolData &MSD,
|
||||||
const MCAsmLayout &Layout) {
|
const MCAsmLayout &Layout) {
|
||||||
const MCSymbol *Symbol = MSD.Symbol;
|
const MCSymbol *Symbol = MSD.Symbol;
|
||||||
MCSymbolData &Data = Symbol->getData();
|
MCSymbol &Data = Symbol->getData();
|
||||||
const MCSymbol *AliasedSymbol = &findAliasedSymbol(*Symbol);
|
const MCSymbol *AliasedSymbol = &findAliasedSymbol(*Symbol);
|
||||||
uint8_t SectionIndex = MSD.SectionIndex;
|
uint8_t SectionIndex = MSD.SectionIndex;
|
||||||
uint8_t Type = 0;
|
uint8_t Type = 0;
|
||||||
@@ -554,7 +554,7 @@ void MachObjectWriter::ComputeSymbolTable(
|
|||||||
// match 'as'. Even though it doesn't matter for correctness, this is
|
// match 'as'. Even though it doesn't matter for correctness, this is
|
||||||
// important for letting us diff .o files.
|
// important for letting us diff .o files.
|
||||||
for (const MCSymbol &Symbol : Asm.symbols()) {
|
for (const MCSymbol &Symbol : Asm.symbols()) {
|
||||||
MCSymbolData &SD = Symbol.getData();
|
MCSymbol &SD = Symbol.getData();
|
||||||
|
|
||||||
// Ignore non-linker visible symbols.
|
// Ignore non-linker visible symbols.
|
||||||
if (!Asm.isSymbolLinkerVisible(Symbol))
|
if (!Asm.isSymbolLinkerVisible(Symbol))
|
||||||
@@ -582,7 +582,7 @@ void MachObjectWriter::ComputeSymbolTable(
|
|||||||
|
|
||||||
// Now add the data for local symbols.
|
// Now add the data for local symbols.
|
||||||
for (const MCSymbol &Symbol : Asm.symbols()) {
|
for (const MCSymbol &Symbol : Asm.symbols()) {
|
||||||
MCSymbolData &SD = Symbol.getData();
|
MCSymbol &SD = Symbol.getData();
|
||||||
|
|
||||||
// Ignore non-linker visible symbols.
|
// Ignore non-linker visible symbols.
|
||||||
if (!Asm.isSymbolLinkerVisible(Symbol))
|
if (!Asm.isSymbolLinkerVisible(Symbol))
|
||||||
|
@@ -364,7 +364,7 @@ void WinCOFFObjectWriter::defineSection(MCSectionCOFF const &Sec) {
|
|||||||
|
|
||||||
static uint64_t getSymbolValue(const MCSymbol &Symbol,
|
static uint64_t getSymbolValue(const MCSymbol &Symbol,
|
||||||
const MCAsmLayout &Layout) {
|
const MCAsmLayout &Layout) {
|
||||||
const MCSymbolData &Data = Symbol.getData();
|
const MCSymbol &Data = Symbol.getData();
|
||||||
if (Symbol.isCommon() && Data.isExternal())
|
if (Symbol.isCommon() && Data.isExternal())
|
||||||
return Symbol.getCommonSize();
|
return Symbol.getCommonSize();
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ void WinCOFFObjectWriter::DefineSymbol(const MCSymbol &Symbol,
|
|||||||
|
|
||||||
coff_symbol->MC = &Symbol;
|
coff_symbol->MC = &Symbol;
|
||||||
} else {
|
} else {
|
||||||
const MCSymbolData &ResSymData = Symbol.getData();
|
const MCSymbol &ResSymData = Symbol.getData();
|
||||||
const MCSymbol *Base = Layout.getBaseSymbol(Symbol);
|
const MCSymbol *Base = Layout.getBaseSymbol(Symbol);
|
||||||
coff_symbol->Data.Value = getSymbolValue(Symbol, Layout);
|
coff_symbol->Data.Value = getSymbolValue(Symbol, Layout);
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ void WinCOFFObjectWriter::DefineSymbol(const MCSymbol &Symbol,
|
|||||||
if (!Base) {
|
if (!Base) {
|
||||||
coff_symbol->Data.SectionNumber = COFF::IMAGE_SYM_ABSOLUTE;
|
coff_symbol->Data.SectionNumber = COFF::IMAGE_SYM_ABSOLUTE;
|
||||||
} else {
|
} else {
|
||||||
const MCSymbolData &BaseData = Base->getData();
|
const MCSymbol &BaseData = Base->getData();
|
||||||
if (BaseData.getFragment()) {
|
if (BaseData.getFragment()) {
|
||||||
COFFSection *Sec = SectionMap[BaseData.getFragment()->getParent()];
|
COFFSection *Sec = SectionMap[BaseData.getFragment()->getParent()];
|
||||||
|
|
||||||
@@ -672,7 +672,7 @@ bool WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool WinCOFFObjectWriter::isWeak(const MCSymbol &Sym) const {
|
bool WinCOFFObjectWriter::isWeak(const MCSymbol &Sym) const {
|
||||||
const MCSymbolData &SD = Sym.getData();
|
const MCSymbol &SD = Sym.getData();
|
||||||
if (!SD.isExternal())
|
if (!SD.isExternal())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -701,7 +701,7 @@ void WinCOFFObjectWriter::RecordRelocation(
|
|||||||
Twine("symbol '") + A.getName() +
|
Twine("symbol '") + A.getName() +
|
||||||
"' can not be undefined");
|
"' can not be undefined");
|
||||||
|
|
||||||
const MCSymbolData &A_SD = A.getData();
|
const MCSymbol &A_SD = A.getData();
|
||||||
|
|
||||||
MCSection *Section = Fragment->getParent();
|
MCSection *Section = Fragment->getParent();
|
||||||
|
|
||||||
@@ -718,7 +718,7 @@ void WinCOFFObjectWriter::RecordRelocation(
|
|||||||
|
|
||||||
if (SymB) {
|
if (SymB) {
|
||||||
const MCSymbol *B = &SymB->getSymbol();
|
const MCSymbol *B = &SymB->getSymbol();
|
||||||
const MCSymbolData &B_SD = B->getData();
|
const MCSymbol &B_SD = B->getData();
|
||||||
if (!B_SD.getFragment())
|
if (!B_SD.getFragment())
|
||||||
Asm.getContext().reportFatalError(
|
Asm.getContext().reportFatalError(
|
||||||
Fixup.getLoc(),
|
Fixup.getLoc(),
|
||||||
|
@@ -97,7 +97,7 @@ bool MCWinCOFFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
|||||||
"Got non-COFF section in the COFF backend!");
|
"Got non-COFF section in the COFF backend!");
|
||||||
|
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
|
|
||||||
switch (Attribute) {
|
switch (Attribute) {
|
||||||
default: return false;
|
default: return false;
|
||||||
@@ -197,7 +197,7 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
AssignSection(Symbol, nullptr);
|
AssignSection(Symbol, nullptr);
|
||||||
|
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
SD.setExternal(true);
|
SD.setExternal(true);
|
||||||
Symbol->setCommon(Size, ByteAlignment);
|
Symbol->setCommon(Size, ByteAlignment);
|
||||||
|
|
||||||
@@ -227,7 +227,7 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
Section->setAlignment(ByteAlignment);
|
Section->setAlignment(ByteAlignment);
|
||||||
|
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
SD.setExternal(false);
|
SD.setExternal(false);
|
||||||
|
|
||||||
AssignSection(Symbol, Section);
|
AssignSection(Symbol, Section);
|
||||||
|
@@ -165,7 +165,7 @@ private:
|
|||||||
Name + "." + Twine(MappingSymbolCounter++));
|
Name + "." + Twine(MappingSymbolCounter++));
|
||||||
|
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
MCELF::SetType(*Symbol, ELF::STT_NOTYPE);
|
MCELF::SetType(*Symbol, ELF::STT_NOTYPE);
|
||||||
MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
|
MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
|
||||||
SD.setExternal(false);
|
SD.setExternal(false);
|
||||||
|
@@ -209,11 +209,11 @@ void AArch64MachObjectWriter::RecordRelocation(
|
|||||||
}
|
}
|
||||||
} else if (Target.getSymB()) { // A - B + constant
|
} else if (Target.getSymB()) { // A - B + constant
|
||||||
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
||||||
const MCSymbolData &A_SD = A->getData();
|
const MCSymbol &A_SD = A->getData();
|
||||||
const MCSymbol *A_Base = Asm.getAtom(*A);
|
const MCSymbol *A_Base = Asm.getAtom(*A);
|
||||||
|
|
||||||
const MCSymbol *B = &Target.getSymB()->getSymbol();
|
const MCSymbol *B = &Target.getSymB()->getSymbol();
|
||||||
const MCSymbolData &B_SD = B->getData();
|
const MCSymbol &B_SD = B->getData();
|
||||||
const MCSymbol *B_Base = Asm.getAtom(*B);
|
const MCSymbol *B_Base = Asm.getAtom(*B);
|
||||||
|
|
||||||
// Check for "_foo@got - .", which comes through here as:
|
// Check for "_foo@got - .", which comes through here as:
|
||||||
|
@@ -601,7 +601,7 @@ void ARMAsmBackend::processFixupValue(const MCAssembler &Asm,
|
|||||||
// the offset when the destination has the same MCFragment.
|
// the offset when the destination has the same MCFragment.
|
||||||
if (A && (unsigned)Fixup.getKind() == ARM::fixup_arm_thumb_bl) {
|
if (A && (unsigned)Fixup.getKind() == ARM::fixup_arm_thumb_bl) {
|
||||||
const MCSymbol &Sym = A->getSymbol();
|
const MCSymbol &Sym = A->getSymbol();
|
||||||
const MCSymbolData &SymData = Sym.getData();
|
const MCSymbol &SymData = Sym.getData();
|
||||||
IsResolved = (SymData.getFragment() == DF);
|
IsResolved = (SymData.getFragment() == DF);
|
||||||
}
|
}
|
||||||
// We must always generate a relocation for BL/BLX instructions if we have
|
// We must always generate a relocation for BL/BLX instructions if we have
|
||||||
|
@@ -567,7 +567,7 @@ private:
|
|||||||
Twine(MappingSymbolCounter++));
|
Twine(MappingSymbolCounter++));
|
||||||
|
|
||||||
getAssembler().registerSymbol(*Symbol);
|
getAssembler().registerSymbol(*Symbol);
|
||||||
MCSymbolData &SD = Symbol->getData();
|
MCSymbol &SD = Symbol->getData();
|
||||||
MCELF::SetType(*Symbol, ELF::STT_NOTYPE);
|
MCELF::SetType(*Symbol, ELF::STT_NOTYPE);
|
||||||
MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
|
MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
|
||||||
SD.setExternal(false);
|
SD.setExternal(false);
|
||||||
|
@@ -152,7 +152,7 @@ RecordARMScatteredHalfRelocation(MachObjectWriter *Writer,
|
|||||||
|
|
||||||
// See <reloc.h>.
|
// See <reloc.h>.
|
||||||
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
||||||
const MCSymbolData *A_SD = &A->getData();
|
const MCSymbol *A_SD = &A->getData();
|
||||||
|
|
||||||
if (!A_SD->getFragment())
|
if (!A_SD->getFragment())
|
||||||
Asm.getContext().reportFatalError(Fixup.getLoc(),
|
Asm.getContext().reportFatalError(Fixup.getLoc(),
|
||||||
@@ -166,7 +166,7 @@ RecordARMScatteredHalfRelocation(MachObjectWriter *Writer,
|
|||||||
FixedValue += SecAddr;
|
FixedValue += SecAddr;
|
||||||
|
|
||||||
if (const MCSymbolRefExpr *B = Target.getSymB()) {
|
if (const MCSymbolRefExpr *B = Target.getSymB()) {
|
||||||
const MCSymbolData *B_SD = &B->getSymbol().getData();
|
const MCSymbol *B_SD = &B->getSymbol().getData();
|
||||||
|
|
||||||
if (!B_SD->getFragment())
|
if (!B_SD->getFragment())
|
||||||
Asm.getContext().reportFatalError(Fixup.getLoc(),
|
Asm.getContext().reportFatalError(Fixup.getLoc(),
|
||||||
@@ -255,7 +255,7 @@ void ARMMachObjectWriter::RecordARMScatteredRelocation(MachObjectWriter *Writer,
|
|||||||
|
|
||||||
// See <reloc.h>.
|
// See <reloc.h>.
|
||||||
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
||||||
const MCSymbolData *A_SD = &A->getData();
|
const MCSymbol *A_SD = &A->getData();
|
||||||
|
|
||||||
if (!A_SD->getFragment())
|
if (!A_SD->getFragment())
|
||||||
Asm.getContext().reportFatalError(Fixup.getLoc(),
|
Asm.getContext().reportFatalError(Fixup.getLoc(),
|
||||||
@@ -270,7 +270,7 @@ void ARMMachObjectWriter::RecordARMScatteredRelocation(MachObjectWriter *Writer,
|
|||||||
|
|
||||||
if (const MCSymbolRefExpr *B = Target.getSymB()) {
|
if (const MCSymbolRefExpr *B = Target.getSymB()) {
|
||||||
assert(Type == MachO::ARM_RELOC_VANILLA && "invalid reloc for 2 symbols");
|
assert(Type == MachO::ARM_RELOC_VANILLA && "invalid reloc for 2 symbols");
|
||||||
const MCSymbolData *B_SD = &B->getSymbol().getData();
|
const MCSymbol *B_SD = &B->getSymbol().getData();
|
||||||
|
|
||||||
if (!B_SD->getFragment())
|
if (!B_SD->getFragment())
|
||||||
Asm.getContext().reportFatalError(Fixup.getLoc(),
|
Asm.getContext().reportFatalError(Fixup.getLoc(),
|
||||||
|
@@ -206,7 +206,7 @@ bool PPCMachObjectWriter::RecordScatteredRelocation(
|
|||||||
|
|
||||||
// See <reloc.h>.
|
// See <reloc.h>.
|
||||||
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
||||||
const MCSymbolData *A_SD = &A->getData();
|
const MCSymbol *A_SD = &A->getData();
|
||||||
|
|
||||||
if (!A_SD->getFragment())
|
if (!A_SD->getFragment())
|
||||||
report_fatal_error("symbol '" + A->getName() +
|
report_fatal_error("symbol '" + A->getName() +
|
||||||
@@ -219,7 +219,7 @@ bool PPCMachObjectWriter::RecordScatteredRelocation(
|
|||||||
uint32_t Value2 = 0;
|
uint32_t Value2 = 0;
|
||||||
|
|
||||||
if (const MCSymbolRefExpr *B = Target.getSymB()) {
|
if (const MCSymbolRefExpr *B = Target.getSymB()) {
|
||||||
const MCSymbolData *B_SD = &B->getSymbol().getData();
|
const MCSymbol *B_SD = &B->getSymbol().getData();
|
||||||
|
|
||||||
if (!B_SD->getFragment())
|
if (!B_SD->getFragment())
|
||||||
report_fatal_error("symbol '" + B->getSymbol().getName() +
|
report_fatal_error("symbol '" + B->getSymbol().getName() +
|
||||||
|
@@ -142,13 +142,13 @@ void X86MachObjectWriter::RecordX86_64Relocation(
|
|||||||
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
||||||
if (A->isTemporary())
|
if (A->isTemporary())
|
||||||
A = &Writer->findAliasedSymbol(*A);
|
A = &Writer->findAliasedSymbol(*A);
|
||||||
const MCSymbolData &A_SD = A->getData();
|
const MCSymbol &A_SD = A->getData();
|
||||||
const MCSymbol *A_Base = Asm.getAtom(*A);
|
const MCSymbol *A_Base = Asm.getAtom(*A);
|
||||||
|
|
||||||
const MCSymbol *B = &Target.getSymB()->getSymbol();
|
const MCSymbol *B = &Target.getSymB()->getSymbol();
|
||||||
if (B->isTemporary())
|
if (B->isTemporary())
|
||||||
B = &Writer->findAliasedSymbol(*B);
|
B = &Writer->findAliasedSymbol(*B);
|
||||||
const MCSymbolData &B_SD = B->getData();
|
const MCSymbol &B_SD = B->getData();
|
||||||
const MCSymbol *B_Base = Asm.getAtom(*B);
|
const MCSymbol *B_Base = Asm.getAtom(*B);
|
||||||
|
|
||||||
// Neither symbol can be modified.
|
// Neither symbol can be modified.
|
||||||
@@ -211,7 +211,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(
|
|||||||
if (!Asm.getContext().getAsmInfo()->isSectionAtomizableBySymbols(Sec))
|
if (!Asm.getContext().getAsmInfo()->isSectionAtomizableBySymbols(Sec))
|
||||||
Asm.addLocalUsedInReloc(*Symbol);
|
Asm.addLocalUsedInReloc(*Symbol);
|
||||||
}
|
}
|
||||||
const MCSymbolData &SD = Symbol->getData();
|
const MCSymbol &SD = Symbol->getData();
|
||||||
RelSymbol = Asm.getAtom(*Symbol);
|
RelSymbol = Asm.getAtom(*Symbol);
|
||||||
|
|
||||||
// Relocations inside debug sections always use local relocations when
|
// Relocations inside debug sections always use local relocations when
|
||||||
@@ -354,7 +354,7 @@ bool X86MachObjectWriter::RecordScatteredRelocation(MachObjectWriter *Writer,
|
|||||||
|
|
||||||
// See <reloc.h>.
|
// See <reloc.h>.
|
||||||
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
const MCSymbol *A = &Target.getSymA()->getSymbol();
|
||||||
const MCSymbolData *A_SD = &A->getData();
|
const MCSymbol *A_SD = &A->getData();
|
||||||
|
|
||||||
if (!A_SD->getFragment())
|
if (!A_SD->getFragment())
|
||||||
report_fatal_error("symbol '" + A->getName() +
|
report_fatal_error("symbol '" + A->getName() +
|
||||||
@@ -368,7 +368,7 @@ bool X86MachObjectWriter::RecordScatteredRelocation(MachObjectWriter *Writer,
|
|||||||
uint32_t Value2 = 0;
|
uint32_t Value2 = 0;
|
||||||
|
|
||||||
if (const MCSymbolRefExpr *B = Target.getSymB()) {
|
if (const MCSymbolRefExpr *B = Target.getSymB()) {
|
||||||
const MCSymbolData *B_SD = &B->getSymbol().getData();
|
const MCSymbol *B_SD = &B->getSymbol().getData();
|
||||||
|
|
||||||
if (!B_SD->getFragment())
|
if (!B_SD->getFragment())
|
||||||
report_fatal_error("symbol '" + B->getSymbol().getName() +
|
report_fatal_error("symbol '" + B->getSymbol().getName() +
|
||||||
|
Reference in New Issue
Block a user