mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Move Flags from MCSymbolData to MCSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238598 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
21a7b73e04
commit
071c3df378
@ -35,10 +35,6 @@ class MCSymbolData {
|
|||||||
PointerIntPair<MCFragment *, 2> Fragment;
|
PointerIntPair<MCFragment *, 2> Fragment;
|
||||||
|
|
||||||
|
|
||||||
/// Flags - The Flags field is used by object file implementations to store
|
|
||||||
/// additional per symbol information which is not easily classified.
|
|
||||||
uint32_t Flags = 0;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MCSymbolData() = default;
|
MCSymbolData() = default;
|
||||||
|
|
||||||
@ -59,17 +55,6 @@ public:
|
|||||||
Fragment.setInt((Fragment.getInt() & ~2) | (unsigned(Value) << 1));
|
Fragment.setInt((Fragment.getInt() & ~2) | (unsigned(Value) << 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getFlags - Get the (implementation defined) symbol flags.
|
|
||||||
uint32_t getFlags() const { return Flags; }
|
|
||||||
|
|
||||||
/// setFlags - Set the (implementation defined) symbol flags.
|
|
||||||
void setFlags(uint32_t Value) { Flags = Value; }
|
|
||||||
|
|
||||||
/// modifyFlags - Modify the flags via a mask
|
|
||||||
void modifyFlags(uint32_t Value, uint32_t Mask) {
|
|
||||||
Flags = (Flags & ~Mask) | Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
void dump() const;
|
void dump() const;
|
||||||
@ -133,6 +118,10 @@ class MCSymbol {
|
|||||||
uint64_t CommonSize;
|
uint64_t CommonSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// The Flags field is used by object file implementations to store
|
||||||
|
/// additional per symbol information which is not easily classified.
|
||||||
|
mutable uint32_t Flags = 0;
|
||||||
|
|
||||||
mutable MCSymbolData Data;
|
mutable MCSymbolData Data;
|
||||||
|
|
||||||
private: // MCContext creates and uniques these.
|
private: // MCContext creates and uniques these.
|
||||||
@ -297,6 +286,17 @@ public:
|
|||||||
/// Is this a 'common' symbol.
|
/// Is this a 'common' symbol.
|
||||||
bool isCommon() const { return CommonAlign != -1U; }
|
bool isCommon() const { return CommonAlign != -1U; }
|
||||||
|
|
||||||
|
/// Get the (implementation defined) symbol flags.
|
||||||
|
uint32_t getFlags() const { return Flags; }
|
||||||
|
|
||||||
|
/// Set the (implementation defined) symbol flags.
|
||||||
|
void setFlags(uint32_t Value) const { Flags = Value; }
|
||||||
|
|
||||||
|
/// Modify the flags via a mask
|
||||||
|
void modifyFlags(uint32_t Value, uint32_t Mask) const {
|
||||||
|
Flags = (Flags & ~Mask) | Value;
|
||||||
|
}
|
||||||
|
|
||||||
/// print - Print the value to the stream \p OS.
|
/// print - Print the value to the stream \p OS.
|
||||||
void print(raw_ostream &OS) const;
|
void print(raw_ostream &OS) const;
|
||||||
|
|
||||||
|
@ -1188,7 +1188,6 @@ void MCSymbolData::dump() const {
|
|||||||
|
|
||||||
OS << "<MCSymbolData"
|
OS << "<MCSymbolData"
|
||||||
<< " Fragment:" << getFragment();
|
<< " Fragment:" << getFragment();
|
||||||
OS << " Flags:" << getFlags();
|
|
||||||
if (isExternal())
|
if (isExternal())
|
||||||
OS << " (external)";
|
OS << " (external)";
|
||||||
if (isPrivateExtern())
|
if (isPrivateExtern())
|
||||||
|
@ -20,35 +20,31 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
void MCELF::SetBinding(const MCSymbol &Sym, unsigned Binding) {
|
void MCELF::SetBinding(const MCSymbol &Sym, unsigned Binding) {
|
||||||
MCSymbolData &SD = Sym.getData();
|
|
||||||
assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
|
assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
|
||||||
Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
|
Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
|
||||||
uint32_t OtherFlags = SD.getFlags() & ~(0xf << ELF_STB_Shift);
|
uint32_t OtherFlags = Sym.getFlags() & ~(0xf << ELF_STB_Shift);
|
||||||
SD.setFlags(OtherFlags | (Binding << ELF_STB_Shift));
|
Sym.setFlags(OtherFlags | (Binding << ELF_STB_Shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned MCELF::GetBinding(const MCSymbol &Sym) {
|
unsigned MCELF::GetBinding(const MCSymbol &Sym) {
|
||||||
MCSymbolData &SD = Sym.getData();
|
uint32_t Binding = (Sym.getFlags() & (0xf << ELF_STB_Shift)) >> ELF_STB_Shift;
|
||||||
uint32_t Binding = (SD.getFlags() & (0xf << ELF_STB_Shift)) >> ELF_STB_Shift;
|
|
||||||
assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
|
assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
|
||||||
Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
|
Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
|
||||||
return Binding;
|
return Binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELF::SetType(const MCSymbol &Sym, unsigned Type) {
|
void MCELF::SetType(const MCSymbol &Sym, unsigned Type) {
|
||||||
MCSymbolData &SD = Sym.getData();
|
|
||||||
assert(Type == ELF::STT_NOTYPE || Type == ELF::STT_OBJECT ||
|
assert(Type == ELF::STT_NOTYPE || Type == ELF::STT_OBJECT ||
|
||||||
Type == ELF::STT_FUNC || Type == ELF::STT_SECTION ||
|
Type == ELF::STT_FUNC || Type == ELF::STT_SECTION ||
|
||||||
Type == ELF::STT_COMMON || Type == ELF::STT_TLS ||
|
Type == ELF::STT_COMMON || Type == ELF::STT_TLS ||
|
||||||
Type == ELF::STT_GNU_IFUNC);
|
Type == ELF::STT_GNU_IFUNC);
|
||||||
|
|
||||||
uint32_t OtherFlags = SD.getFlags() & ~(0xf << ELF_STT_Shift);
|
uint32_t OtherFlags = Sym.getFlags() & ~(0xf << ELF_STT_Shift);
|
||||||
SD.setFlags(OtherFlags | (Type << ELF_STT_Shift));
|
Sym.setFlags(OtherFlags | (Type << ELF_STT_Shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned MCELF::GetType(const MCSymbol &Sym) {
|
unsigned MCELF::GetType(const MCSymbol &Sym) {
|
||||||
MCSymbolData &SD = Sym.getData();
|
uint32_t Type = (Sym.getFlags() & (0xf << ELF_STT_Shift)) >> ELF_STT_Shift;
|
||||||
uint32_t Type = (SD.getFlags() & (0xf << ELF_STT_Shift)) >> ELF_STT_Shift;
|
|
||||||
assert(Type == ELF::STT_NOTYPE || Type == ELF::STT_OBJECT ||
|
assert(Type == ELF::STT_NOTYPE || Type == ELF::STT_OBJECT ||
|
||||||
Type == ELF::STT_FUNC || Type == ELF::STT_SECTION ||
|
Type == ELF::STT_FUNC || Type == ELF::STT_SECTION ||
|
||||||
Type == ELF::STT_COMMON || Type == ELF::STT_TLS || Type == ELF::STT_GNU_IFUNC);
|
Type == ELF::STT_COMMON || Type == ELF::STT_TLS || Type == ELF::STT_GNU_IFUNC);
|
||||||
@ -58,18 +54,16 @@ unsigned MCELF::GetType(const MCSymbol &Sym) {
|
|||||||
// Visibility is stored in the first two bits of st_other
|
// Visibility is stored in the first two bits of st_other
|
||||||
// st_other values are stored in the second byte of get/setFlags
|
// st_other values are stored in the second byte of get/setFlags
|
||||||
void MCELF::SetVisibility(MCSymbol &Sym, unsigned Visibility) {
|
void MCELF::SetVisibility(MCSymbol &Sym, unsigned Visibility) {
|
||||||
MCSymbolData &SD = Sym.getData();
|
|
||||||
assert(Visibility == ELF::STV_DEFAULT || Visibility == ELF::STV_INTERNAL ||
|
assert(Visibility == ELF::STV_DEFAULT || Visibility == ELF::STV_INTERNAL ||
|
||||||
Visibility == ELF::STV_HIDDEN || Visibility == ELF::STV_PROTECTED);
|
Visibility == ELF::STV_HIDDEN || Visibility == ELF::STV_PROTECTED);
|
||||||
|
|
||||||
uint32_t OtherFlags = SD.getFlags() & ~(0x3 << ELF_STV_Shift);
|
uint32_t OtherFlags = Sym.getFlags() & ~(0x3 << ELF_STV_Shift);
|
||||||
SD.setFlags(OtherFlags | (Visibility << ELF_STV_Shift));
|
Sym.setFlags(OtherFlags | (Visibility << ELF_STV_Shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned MCELF::GetVisibility(const MCSymbol &Sym) {
|
unsigned MCELF::GetVisibility(const MCSymbol &Sym) {
|
||||||
MCSymbolData &SD = Sym.getData();
|
|
||||||
unsigned Visibility =
|
unsigned Visibility =
|
||||||
(SD.getFlags() & (0x3 << ELF_STV_Shift)) >> ELF_STV_Shift;
|
(Sym.getFlags() & (0x3 << ELF_STV_Shift)) >> ELF_STV_Shift;
|
||||||
assert(Visibility == ELF::STV_DEFAULT || Visibility == ELF::STV_INTERNAL ||
|
assert(Visibility == ELF::STV_DEFAULT || Visibility == ELF::STV_INTERNAL ||
|
||||||
Visibility == ELF::STV_HIDDEN || Visibility == ELF::STV_PROTECTED);
|
Visibility == ELF::STV_HIDDEN || Visibility == ELF::STV_PROTECTED);
|
||||||
return Visibility;
|
return Visibility;
|
||||||
@ -78,15 +72,12 @@ unsigned MCELF::GetVisibility(const MCSymbol &Sym) {
|
|||||||
// Other is stored in the last six bits of st_other
|
// Other is stored in the last six bits of st_other
|
||||||
// st_other values are stored in the second byte of get/setFlags
|
// st_other values are stored in the second byte of get/setFlags
|
||||||
void MCELF::setOther(MCSymbol &Sym, unsigned Other) {
|
void MCELF::setOther(MCSymbol &Sym, unsigned Other) {
|
||||||
MCSymbolData &SD = Sym.getData();
|
uint32_t OtherFlags = Sym.getFlags() & ~(0x3f << ELF_STO_Shift);
|
||||||
uint32_t OtherFlags = SD.getFlags() & ~(0x3f << ELF_STO_Shift);
|
Sym.setFlags(OtherFlags | (Other << ELF_STO_Shift));
|
||||||
SD.setFlags(OtherFlags | (Other << ELF_STO_Shift));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned MCELF::getOther(const MCSymbol &Sym) {
|
unsigned MCELF::getOther(const MCSymbol &Sym) {
|
||||||
MCSymbolData &SD = Sym.getData();
|
unsigned Other = (Sym.getFlags() & (0x3f << ELF_STO_Shift)) >> ELF_STO_Shift;
|
||||||
unsigned Other =
|
|
||||||
(SD.getFlags() & (0x3f << ELF_STO_Shift)) >> ELF_STO_Shift;
|
|
||||||
return Other;
|
return Other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ void MCMachOStreamer::EmitEHSymAttributes(const MCSymbol *Symbol,
|
|||||||
getAssembler().getOrCreateSymbolData(*Symbol);
|
getAssembler().getOrCreateSymbolData(*Symbol);
|
||||||
if (SD.isExternal())
|
if (SD.isExternal())
|
||||||
EmitSymbolAttribute(EHSymbol, MCSA_Global);
|
EmitSymbolAttribute(EHSymbol, MCSA_Global);
|
||||||
if (SD.getFlags() & SF_WeakDefinition)
|
if (Symbol->getFlags() & SF_WeakDefinition)
|
||||||
EmitSymbolAttribute(EHSymbol, MCSA_WeakDefinition);
|
EmitSymbolAttribute(EHSymbol, MCSA_WeakDefinition);
|
||||||
if (SD.isPrivateExtern())
|
if (SD.isPrivateExtern())
|
||||||
EmitSymbolAttribute(EHSymbol, MCSA_PrivateExtern);
|
EmitSymbolAttribute(EHSymbol, MCSA_PrivateExtern);
|
||||||
@ -194,7 +194,6 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) {
|
|||||||
|
|
||||||
MCObjectStreamer::EmitLabel(Symbol);
|
MCObjectStreamer::EmitLabel(Symbol);
|
||||||
|
|
||||||
MCSymbolData &SD = Symbol->getData();
|
|
||||||
// This causes the reference type flag to be cleared. Darwin 'as' was "trying"
|
// 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
|
// to clear the weak reference and weak definition bits too, but the
|
||||||
// implementation was buggy. For now we just try to match 'as', for
|
// implementation was buggy. For now we just try to match 'as', for
|
||||||
@ -202,7 +201,7 @@ void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) {
|
|||||||
//
|
//
|
||||||
// FIXME: Cleanup this code, these bits should be emitted based on semantic
|
// FIXME: Cleanup this code, these bits should be emitted based on semantic
|
||||||
// properties, not on the order of definition, etc.
|
// properties, not on the order of definition, etc.
|
||||||
SD.setFlags(SD.getFlags() & ~SF_ReferenceTypeMask);
|
Symbol->setFlags(Symbol->getFlags() & ~SF_ReferenceTypeMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCMachOStreamer::EmitDataRegion(DataRegionData::KindTy Kind) {
|
void MCMachOStreamer::EmitDataRegion(DataRegionData::KindTy Kind) {
|
||||||
@ -329,25 +328,25 @@ bool MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
|||||||
//
|
//
|
||||||
// FIXME: Cleanup this code, these bits should be emitted based on semantic
|
// FIXME: Cleanup this code, these bits should be emitted based on semantic
|
||||||
// properties, not on the order of definition, etc.
|
// properties, not on the order of definition, etc.
|
||||||
SD.setFlags(SD.getFlags() & ~SF_ReferenceTypeUndefinedLazy);
|
Symbol->setFlags(Symbol->getFlags() & ~SF_ReferenceTypeUndefinedLazy);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCSA_LazyReference:
|
case MCSA_LazyReference:
|
||||||
// FIXME: This requires -dynamic.
|
// FIXME: This requires -dynamic.
|
||||||
SD.setFlags(SD.getFlags() | SF_NoDeadStrip);
|
Symbol->setFlags(Symbol->getFlags() | SF_NoDeadStrip);
|
||||||
if (Symbol->isUndefined())
|
if (Symbol->isUndefined())
|
||||||
SD.setFlags(SD.getFlags() | SF_ReferenceTypeUndefinedLazy);
|
Symbol->setFlags(Symbol->getFlags() | SF_ReferenceTypeUndefinedLazy);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Since .reference sets the no dead strip bit, it is equivalent to
|
// Since .reference sets the no dead strip bit, it is equivalent to
|
||||||
// .no_dead_strip in practice.
|
// .no_dead_strip in practice.
|
||||||
case MCSA_Reference:
|
case MCSA_Reference:
|
||||||
case MCSA_NoDeadStrip:
|
case MCSA_NoDeadStrip:
|
||||||
SD.setFlags(SD.getFlags() | SF_NoDeadStrip);
|
Symbol->setFlags(Symbol->getFlags() | SF_NoDeadStrip);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCSA_SymbolResolver:
|
case MCSA_SymbolResolver:
|
||||||
SD.setFlags(SD.getFlags() | SF_SymbolResolver);
|
Symbol->setFlags(Symbol->getFlags() | SF_SymbolResolver);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCSA_PrivateExtern:
|
case MCSA_PrivateExtern:
|
||||||
@ -358,17 +357,17 @@ bool MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
|||||||
case MCSA_WeakReference:
|
case MCSA_WeakReference:
|
||||||
// FIXME: This requires -dynamic.
|
// FIXME: This requires -dynamic.
|
||||||
if (Symbol->isUndefined())
|
if (Symbol->isUndefined())
|
||||||
SD.setFlags(SD.getFlags() | SF_WeakReference);
|
Symbol->setFlags(Symbol->getFlags() | SF_WeakReference);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCSA_WeakDefinition:
|
case MCSA_WeakDefinition:
|
||||||
// FIXME: 'as' enforces that this is defined and global. The manual claims
|
// FIXME: 'as' enforces that this is defined and global. The manual claims
|
||||||
// it has to be in a coalesced section, but this isn't enforced.
|
// it has to be in a coalesced section, but this isn't enforced.
|
||||||
SD.setFlags(SD.getFlags() | SF_WeakDefinition);
|
Symbol->setFlags(Symbol->getFlags() | SF_WeakDefinition);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MCSA_WeakDefAutoPrivate:
|
case MCSA_WeakDefAutoPrivate:
|
||||||
SD.setFlags(SD.getFlags() | SF_WeakDefinition | SF_WeakReference);
|
Symbol->setFlags(Symbol->getFlags() | SF_WeakDefinition | SF_WeakReference);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,8 +378,8 @@ void MCMachOStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
|
|||||||
// Encode the 'desc' value into the lowest implementation defined bits.
|
// Encode the 'desc' value into the lowest implementation defined bits.
|
||||||
assert(DescValue == (DescValue & SF_DescFlagsMask) &&
|
assert(DescValue == (DescValue & SF_DescFlagsMask) &&
|
||||||
"Invalid .desc value!");
|
"Invalid .desc value!");
|
||||||
getAssembler().getOrCreateSymbolData(*Symbol).setFlags(
|
getAssembler().getOrCreateSymbolData(*Symbol);
|
||||||
DescValue & SF_DescFlagsMask);
|
Symbol->setFlags(DescValue & SF_DescFlagsMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
|
@ -46,7 +46,7 @@ bool MachObjectWriter::doesSymbolRequireExternRelocation(const MCSymbol &S) {
|
|||||||
|
|
||||||
// References to weak definitions require external relocation entries; the
|
// References to weak definitions require external relocation entries; the
|
||||||
// definition may not always be the one in the same object file.
|
// definition may not always be the one in the same object file.
|
||||||
if (S.getData().getFlags() & SF_WeakDefinition)
|
if (S.getFlags() & SF_WeakDefinition)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Otherwise, we can use an internal relocation.
|
// Otherwise, we can use an internal relocation.
|
||||||
@ -333,7 +333,7 @@ void MachObjectWriter::WriteNlist(MachSymbolData &MSD,
|
|||||||
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;
|
||||||
uint16_t Flags = Data.getFlags();
|
uint16_t Flags = Symbol->getFlags();
|
||||||
uint64_t Address = 0;
|
uint64_t Address = 0;
|
||||||
bool IsAlias = Symbol != AliasedSymbol;
|
bool IsAlias = Symbol != AliasedSymbol;
|
||||||
|
|
||||||
@ -520,9 +520,9 @@ void MachObjectWriter::BindIndirectSymbols(MCAssembler &Asm) {
|
|||||||
//
|
//
|
||||||
// FIXME: Do not hardcode.
|
// FIXME: Do not hardcode.
|
||||||
bool Created;
|
bool Created;
|
||||||
MCSymbolData &Entry = Asm.getOrCreateSymbolData(*it->Symbol, &Created);
|
Asm.getOrCreateSymbolData(*it->Symbol, &Created);
|
||||||
if (Created)
|
if (Created)
|
||||||
Entry.setFlags(Entry.getFlags() | 0x0001);
|
it->Symbol->setFlags(it->Symbol->getFlags() | 0x0001);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ void WinCOFFObjectWriter::DefineSymbol(const MCSymbol &Symbol,
|
|||||||
COFFSymbol *coff_symbol = GetOrCreateCOFFSymbol(&Symbol);
|
COFFSymbol *coff_symbol = GetOrCreateCOFFSymbol(&Symbol);
|
||||||
SymbolMap[&Symbol] = coff_symbol;
|
SymbolMap[&Symbol] = coff_symbol;
|
||||||
|
|
||||||
if (Symbol.getData().getFlags() & COFF::SF_WeakExternal) {
|
if (Symbol.getFlags() & COFF::SF_WeakExternal) {
|
||||||
coff_symbol->Data.StorageClass = COFF::IMAGE_SYM_CLASS_WEAK_EXTERNAL;
|
coff_symbol->Data.StorageClass = COFF::IMAGE_SYM_CLASS_WEAK_EXTERNAL;
|
||||||
|
|
||||||
if (Symbol.isVariable()) {
|
if (Symbol.isVariable()) {
|
||||||
@ -418,8 +418,8 @@ void WinCOFFObjectWriter::DefineSymbol(const MCSymbol &Symbol,
|
|||||||
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);
|
||||||
|
|
||||||
coff_symbol->Data.Type = (ResSymData.getFlags() & 0x0000FFFF) >> 0;
|
coff_symbol->Data.Type = (Symbol.getFlags() & 0x0000FFFF) >> 0;
|
||||||
coff_symbol->Data.StorageClass = (ResSymData.getFlags() & 0x00FF0000) >> 16;
|
coff_symbol->Data.StorageClass = (Symbol.getFlags() & 0x00FF0000) >> 16;
|
||||||
|
|
||||||
// If no storage class was specified in the streamer, define it here.
|
// If no storage class was specified in the streamer, define it here.
|
||||||
if (coff_symbol->Data.StorageClass == 0) {
|
if (coff_symbol->Data.StorageClass == 0) {
|
||||||
@ -664,8 +664,7 @@ bool WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
|
|||||||
// MS LINK expects to be able to replace all references to a function with a
|
// MS LINK expects to be able to replace all references to a function with a
|
||||||
// thunk to implement their /INCREMENTAL feature. Make sure we don't optimize
|
// thunk to implement their /INCREMENTAL feature. Make sure we don't optimize
|
||||||
// away any relocations to functions.
|
// away any relocations to functions.
|
||||||
if ((((SymA.getData().getFlags() & COFF::SF_TypeMask) >>
|
if ((((SymA.getFlags() & COFF::SF_TypeMask) >> COFF::SF_TypeShift) >>
|
||||||
COFF::SF_TypeShift) >>
|
|
||||||
COFF::SCT_COMPLEX_TYPE_SHIFT) == COFF::IMAGE_SYM_DTYPE_FUNCTION)
|
COFF::SCT_COMPLEX_TYPE_SHIFT) == COFF::IMAGE_SYM_DTYPE_FUNCTION)
|
||||||
return false;
|
return false;
|
||||||
return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
|
return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
|
||||||
|
@ -102,7 +102,7 @@ bool MCWinCOFFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
|||||||
default: return false;
|
default: return false;
|
||||||
case MCSA_WeakReference:
|
case MCSA_WeakReference:
|
||||||
case MCSA_Weak:
|
case MCSA_Weak:
|
||||||
SD.modifyFlags(COFF::SF_WeakExternal, COFF::SF_WeakExternal);
|
Symbol->modifyFlags(COFF::SF_WeakExternal, COFF::SF_WeakExternal);
|
||||||
SD.setExternal(true);
|
SD.setExternal(true);
|
||||||
break;
|
break;
|
||||||
case MCSA_Global:
|
case MCSA_Global:
|
||||||
@ -136,8 +136,9 @@ void MCWinCOFFStreamer::EmitCOFFSymbolStorageClass(int StorageClass) {
|
|||||||
FatalError("storage class value '" + Twine(StorageClass) +
|
FatalError("storage class value '" + Twine(StorageClass) +
|
||||||
"' out of range");
|
"' out of range");
|
||||||
|
|
||||||
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*CurSymbol);
|
getAssembler().getOrCreateSymbolData(*CurSymbol);
|
||||||
SD.modifyFlags(StorageClass << COFF::SF_ClassShift, COFF::SF_ClassMask);
|
CurSymbol->modifyFlags(StorageClass << COFF::SF_ClassShift,
|
||||||
|
COFF::SF_ClassMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCWinCOFFStreamer::EmitCOFFSymbolType(int Type) {
|
void MCWinCOFFStreamer::EmitCOFFSymbolType(int Type) {
|
||||||
@ -147,8 +148,8 @@ void MCWinCOFFStreamer::EmitCOFFSymbolType(int Type) {
|
|||||||
if (Type & ~0xffff)
|
if (Type & ~0xffff)
|
||||||
FatalError("type value '" + Twine(Type) + "' out of range");
|
FatalError("type value '" + Twine(Type) + "' out of range");
|
||||||
|
|
||||||
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*CurSymbol);
|
getAssembler().getOrCreateSymbolData(*CurSymbol);
|
||||||
SD.modifyFlags(Type << COFF::SF_TypeShift, COFF::SF_TypeMask);
|
CurSymbol->modifyFlags(Type << COFF::SF_TypeShift, COFF::SF_TypeMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCWinCOFFStreamer::EndCOFFSymbolDef() {
|
void MCWinCOFFStreamer::EndCOFFSymbolDef() {
|
||||||
|
Loading…
Reference in New Issue
Block a user