mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-27 13:40:30 +00:00
Move alignment from MCSectionData to MCSection.
This starts merging MCSection and MCSectionData. There are a few issues with the current split between MCSection and MCSectionData. * It optimizes the the not as important case. We want the production of .o files to be really fast, but the split puts the information used for .o emission in a separate data structure. * The ELF/COFF/MachO hierarchy is not represented in MCSectionData, leading to some ad-hoc ways to represent the various flags. * It makes it harder to remember where each item is. The attached patch starts merging the two by moving the alignment from MCSectionData to MCSection. Most of the patch is actually just dropping 'const', since MCSectionData is mutable, but MCSection was not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237936 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4c919af335
commit
7521964d28
@ -46,20 +46,19 @@ public:
|
|||||||
|
|
||||||
/// Given a constant with the SectionKind, return a section that it should be
|
/// Given a constant with the SectionKind, return a section that it should be
|
||||||
/// placed in.
|
/// placed in.
|
||||||
const MCSection *getSectionForConstant(SectionKind Kind,
|
MCSection *getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const override;
|
const Constant *C) const override;
|
||||||
|
|
||||||
const MCSection *getExplicitSectionGlobal(const GlobalValue *GV,
|
MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SectionKind Kind, Mangler &Mang,
|
Mangler &Mang,
|
||||||
const TargetMachine &TM) const override;
|
const TargetMachine &TM) const override;
|
||||||
|
|
||||||
const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
|
MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SectionKind Kind, Mangler &Mang,
|
Mangler &Mang,
|
||||||
const TargetMachine &TM) const override;
|
const TargetMachine &TM) const override;
|
||||||
|
|
||||||
const MCSection *
|
MCSection *getSectionForJumpTable(const Function &F, Mangler &Mang,
|
||||||
getSectionForJumpTable(const Function &F, Mangler &Mang,
|
const TargetMachine &TM) const override;
|
||||||
const TargetMachine &TM) const override;
|
|
||||||
|
|
||||||
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,
|
bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,
|
||||||
const Function &F) const override;
|
const Function &F) const override;
|
||||||
@ -78,10 +77,10 @@ public:
|
|||||||
MachineModuleInfo *MMI) const override;
|
MachineModuleInfo *MMI) const override;
|
||||||
|
|
||||||
void InitializeELF(bool UseInitArray_);
|
void InitializeELF(bool UseInitArray_);
|
||||||
const MCSection *getStaticCtorSection(unsigned Priority,
|
MCSection *getStaticCtorSection(unsigned Priority,
|
||||||
const MCSymbol *KeySym) const override;
|
const MCSymbol *KeySym) const override;
|
||||||
const MCSection *getStaticDtorSection(unsigned Priority,
|
MCSection *getStaticDtorSection(unsigned Priority,
|
||||||
const MCSymbol *KeySym) const override;
|
const MCSymbol *KeySym) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -100,18 +99,16 @@ public:
|
|||||||
ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
|
ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
|
||||||
Mangler &Mang, const TargetMachine &TM) const override;
|
Mangler &Mang, const TargetMachine &TM) const override;
|
||||||
|
|
||||||
const MCSection *
|
MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SelectSectionForGlobal(const GlobalValue *GV,
|
Mangler &Mang,
|
||||||
SectionKind Kind, Mangler &Mang,
|
const TargetMachine &TM) const override;
|
||||||
const TargetMachine &TM) const override;
|
|
||||||
|
|
||||||
const MCSection *
|
MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
getExplicitSectionGlobal(const GlobalValue *GV,
|
Mangler &Mang,
|
||||||
SectionKind Kind, Mangler &Mang,
|
const TargetMachine &TM) const override;
|
||||||
const TargetMachine &TM) const override;
|
|
||||||
|
|
||||||
const MCSection *getSectionForConstant(SectionKind Kind,
|
MCSection *getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const override;
|
const Constant *C) const override;
|
||||||
|
|
||||||
/// The mach-o version of this method defaults to returning a stub reference.
|
/// The mach-o version of this method defaults to returning a stub reference.
|
||||||
const MCExpr *
|
const MCExpr *
|
||||||
@ -138,23 +135,20 @@ class TargetLoweringObjectFileCOFF : public TargetLoweringObjectFile {
|
|||||||
public:
|
public:
|
||||||
~TargetLoweringObjectFileCOFF() override {}
|
~TargetLoweringObjectFileCOFF() override {}
|
||||||
|
|
||||||
const MCSection *
|
MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
getExplicitSectionGlobal(const GlobalValue *GV,
|
Mangler &Mang,
|
||||||
SectionKind Kind, Mangler &Mang,
|
const TargetMachine &TM) const override;
|
||||||
const TargetMachine &TM) const override;
|
|
||||||
|
|
||||||
const MCSection *
|
MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SelectSectionForGlobal(const GlobalValue *GV,
|
Mangler &Mang,
|
||||||
SectionKind Kind, Mangler &Mang,
|
const TargetMachine &TM) const override;
|
||||||
const TargetMachine &TM) const override;
|
|
||||||
|
|
||||||
void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
|
void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
|
||||||
bool CannotUsePrivateLabel, Mangler &Mang,
|
bool CannotUsePrivateLabel, Mangler &Mang,
|
||||||
const TargetMachine &TM) const override;
|
const TargetMachine &TM) const override;
|
||||||
|
|
||||||
const MCSection *
|
MCSection *getSectionForJumpTable(const Function &F, Mangler &Mang,
|
||||||
getSectionForJumpTable(const Function &F, Mangler &Mang,
|
const TargetMachine &TM) const override;
|
||||||
const TargetMachine &TM) const override;
|
|
||||||
|
|
||||||
/// Extract the dependent library name from a linker option string. Returns
|
/// Extract the dependent library name from a linker option string. Returns
|
||||||
/// StringRef() if the option does not specify a library.
|
/// StringRef() if the option does not specify a library.
|
||||||
@ -166,10 +160,10 @@ public:
|
|||||||
ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
|
ArrayRef<Module::ModuleFlagEntry> ModuleFlags,
|
||||||
Mangler &Mang, const TargetMachine &TM) const override;
|
Mangler &Mang, const TargetMachine &TM) const override;
|
||||||
|
|
||||||
const MCSection *getStaticCtorSection(unsigned Priority,
|
MCSection *getStaticCtorSection(unsigned Priority,
|
||||||
const MCSymbol *KeySym) const override;
|
const MCSymbol *KeySym) const override;
|
||||||
const MCSection *getStaticDtorSection(unsigned Priority,
|
MCSection *getStaticDtorSection(unsigned Priority,
|
||||||
const MCSymbol *KeySym) const override;
|
const MCSymbol *KeySym) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
@ -73,7 +73,7 @@ class AssemblerConstantPools {
|
|||||||
// sections in a stable order to ensure that we have print the
|
// sections in a stable order to ensure that we have print the
|
||||||
// constant pools in a deterministic order when printing an assembly
|
// constant pools in a deterministic order when printing an assembly
|
||||||
// file.
|
// file.
|
||||||
typedef MapVector<const MCSection *, ConstantPool> ConstantPoolMapTy;
|
typedef MapVector<MCSection *, ConstantPool> ConstantPoolMapTy;
|
||||||
ConstantPoolMapTy ConstantPools;
|
ConstantPoolMapTy ConstantPools;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -83,8 +83,8 @@ public:
|
|||||||
unsigned Size);
|
unsigned Size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConstantPool *getConstantPool(const MCSection *Section);
|
ConstantPool *getConstantPool(MCSection *Section);
|
||||||
ConstantPool &getOrCreateConstantPool(const MCSection *Section);
|
ConstantPool &getOrCreateConstantPool(MCSection *Section);
|
||||||
};
|
};
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ public:
|
|||||||
/// Targets can implement this method to specify a section to switch to if the
|
/// Targets can implement this method to specify a section to switch to if the
|
||||||
/// translation unit doesn't have any trampolines that require an executable
|
/// translation unit doesn't have any trampolines that require an executable
|
||||||
/// stack.
|
/// stack.
|
||||||
virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const {
|
virtual MCSection *getNonexecutableStackSection(MCContext &Ctx) const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
class MCAsmInfoELF : public MCAsmInfo {
|
class MCAsmInfoELF : public MCAsmInfo {
|
||||||
virtual void anchor();
|
virtual void anchor();
|
||||||
const MCSection *getNonexecutableStackSection(MCContext &Ctx) const final;
|
MCSection *getNonexecutableStackSection(MCContext &Ctx) const final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MCAsmInfoELF();
|
MCAsmInfoELF();
|
||||||
|
@ -557,7 +557,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
FragmentListType Fragments;
|
FragmentListType Fragments;
|
||||||
const MCSection *Section;
|
MCSection *Section;
|
||||||
|
|
||||||
/// Ordinal - The section index in the assemblers section list.
|
/// Ordinal - The section index in the assemblers section list.
|
||||||
unsigned Ordinal;
|
unsigned Ordinal;
|
||||||
@ -565,9 +565,6 @@ private:
|
|||||||
/// LayoutOrder - The index of this section in the layout order.
|
/// LayoutOrder - The index of this section in the layout order.
|
||||||
unsigned LayoutOrder;
|
unsigned LayoutOrder;
|
||||||
|
|
||||||
/// Alignment - The maximum alignment seen in this section.
|
|
||||||
unsigned Alignment;
|
|
||||||
|
|
||||||
/// \brief Keeping track of bundle-locked state.
|
/// \brief Keeping track of bundle-locked state.
|
||||||
BundleLockStateType BundleLockState;
|
BundleLockStateType BundleLockState;
|
||||||
|
|
||||||
@ -596,12 +593,12 @@ private:
|
|||||||
public:
|
public:
|
||||||
// Only for use as sentinel.
|
// Only for use as sentinel.
|
||||||
MCSectionData();
|
MCSectionData();
|
||||||
MCSectionData(const MCSection &Section, MCAssembler *A = nullptr);
|
MCSectionData(MCSection &Section, MCAssembler *A = nullptr);
|
||||||
|
|
||||||
const MCSection &getSection() const { return *Section; }
|
MCSection &getSection() const { return *Section; }
|
||||||
|
|
||||||
unsigned getAlignment() const { return Alignment; }
|
unsigned getAlignment() const;
|
||||||
void setAlignment(unsigned Value) { Alignment = Value; }
|
void setAlignment(unsigned Value);
|
||||||
|
|
||||||
bool hasInstructions() const { return HasInstructions; }
|
bool hasInstructions() const { return HasInstructions; }
|
||||||
void setHasInstructions(bool Value) { HasInstructions = Value; }
|
void setHasInstructions(bool Value) { HasInstructions = Value; }
|
||||||
@ -1021,7 +1018,7 @@ public:
|
|||||||
return *Entry;
|
return *Entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSectionData &getOrCreateSectionData(const MCSection &Section,
|
MCSectionData &getOrCreateSectionData(MCSection &Section,
|
||||||
bool *Created = nullptr) {
|
bool *Created = nullptr) {
|
||||||
MCSectionData *&Entry = SectionMap[&Section];
|
MCSectionData *&Entry = SectionMap[&Section];
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ namespace llvm {
|
|||||||
unsigned GenDwarfFileNumber;
|
unsigned GenDwarfFileNumber;
|
||||||
|
|
||||||
/// Sections for generating the .debug_ranges and .debug_aranges sections.
|
/// Sections for generating the .debug_ranges and .debug_aranges sections.
|
||||||
SetVector<const MCSection *> SectionsForRanges;
|
SetVector<MCSection *> SectionsForRanges;
|
||||||
|
|
||||||
/// The information gathered from labels that will have dwarf label
|
/// The information gathered from labels that will have dwarf label
|
||||||
/// entries when generating dwarf assembly source files.
|
/// entries when generating dwarf assembly source files.
|
||||||
@ -197,9 +197,9 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
StringMap<const MCSectionMachO *> MachOUniquingMap;
|
StringMap<MCSectionMachO *> MachOUniquingMap;
|
||||||
std::map<ELFSectionKey, const MCSectionELF *> ELFUniquingMap;
|
std::map<ELFSectionKey, MCSectionELF *> ELFUniquingMap;
|
||||||
std::map<COFFSectionKey, const MCSectionCOFF *> COFFUniquingMap;
|
std::map<COFFSectionKey, MCSectionCOFF *> COFFUniquingMap;
|
||||||
StringMap<bool> ELFRelSecNames;
|
StringMap<bool> ELFRelSecNames;
|
||||||
|
|
||||||
/// Do automatic reset in destructor
|
/// Do automatic reset in destructor
|
||||||
@ -291,90 +291,85 @@ namespace llvm {
|
|||||||
|
|
||||||
/// Return the MCSection for the specified mach-o section. This requires
|
/// Return the MCSection for the specified mach-o section. This requires
|
||||||
/// the operands to be valid.
|
/// the operands to be valid.
|
||||||
const MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
|
MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
|
||||||
unsigned TypeAndAttributes,
|
unsigned TypeAndAttributes,
|
||||||
unsigned Reserved2, SectionKind K,
|
unsigned Reserved2, SectionKind K,
|
||||||
const char *BeginSymName = nullptr);
|
const char *BeginSymName = nullptr);
|
||||||
|
|
||||||
const MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
|
MCSectionMachO *getMachOSection(StringRef Segment, StringRef Section,
|
||||||
unsigned TypeAndAttributes,
|
unsigned TypeAndAttributes, SectionKind K,
|
||||||
SectionKind K,
|
const char *BeginSymName = nullptr) {
|
||||||
const char *BeginSymName = nullptr) {
|
|
||||||
return getMachOSection(Segment, Section, TypeAndAttributes, 0, K,
|
return getMachOSection(Segment, Section, TypeAndAttributes, 0, K,
|
||||||
BeginSymName);
|
BeginSymName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
||||||
unsigned Flags) {
|
unsigned Flags) {
|
||||||
return getELFSection(Section, Type, Flags, nullptr);
|
return getELFSection(Section, Type, Flags, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
||||||
unsigned Flags,
|
unsigned Flags, const char *BeginSymName) {
|
||||||
const char *BeginSymName) {
|
|
||||||
return getELFSection(Section, Type, Flags, 0, "", BeginSymName);
|
return getELFSection(Section, Type, Flags, 0, "", BeginSymName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
StringRef Group) {
|
StringRef Group) {
|
||||||
return getELFSection(Section, Type, Flags, EntrySize, Group, nullptr);
|
return getELFSection(Section, Type, Flags, EntrySize, Group, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
StringRef Group,
|
StringRef Group, const char *BeginSymName) {
|
||||||
const char *BeginSymName) {
|
|
||||||
return getELFSection(Section, Type, Flags, EntrySize, Group, ~0,
|
return getELFSection(Section, Type, Flags, EntrySize, Group, ~0,
|
||||||
BeginSymName);
|
BeginSymName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
StringRef Group, unsigned UniqueID) {
|
StringRef Group, unsigned UniqueID) {
|
||||||
return getELFSection(Section, Type, Flags, EntrySize, Group, UniqueID,
|
return getELFSection(Section, Type, Flags, EntrySize, Group, UniqueID,
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
StringRef Group, unsigned UniqueID,
|
StringRef Group, unsigned UniqueID,
|
||||||
const char *BeginSymName);
|
const char *BeginSymName);
|
||||||
|
|
||||||
const MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
MCSectionELF *getELFSection(StringRef Section, unsigned Type,
|
||||||
|
unsigned Flags, unsigned EntrySize,
|
||||||
|
const MCSymbol *Group, unsigned UniqueID,
|
||||||
|
const char *BeginSymName,
|
||||||
|
const MCSectionELF *Associated);
|
||||||
|
|
||||||
|
MCSectionELF *createELFRelSection(StringRef Name, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
const MCSymbol *Group, unsigned UniqueID,
|
const MCSymbol *Group,
|
||||||
const char *BeginSymName,
|
|
||||||
const MCSectionELF *Associated);
|
const MCSectionELF *Associated);
|
||||||
|
|
||||||
const MCSectionELF *createELFRelSection(StringRef Name, unsigned Type,
|
void renameELFSection(MCSectionELF *Section, StringRef Name);
|
||||||
unsigned Flags, unsigned EntrySize,
|
|
||||||
const MCSymbol *Group,
|
|
||||||
const MCSectionELF *Associated);
|
|
||||||
|
|
||||||
void renameELFSection(const MCSectionELF *Section, StringRef Name);
|
MCSectionELF *createELFGroupSection(const MCSymbol *Group);
|
||||||
|
|
||||||
const MCSectionELF *createELFGroupSection(const MCSymbol *Group);
|
MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics,
|
||||||
|
SectionKind Kind, StringRef COMDATSymName,
|
||||||
|
int Selection,
|
||||||
|
const char *BeginSymName = nullptr);
|
||||||
|
|
||||||
const MCSectionCOFF *getCOFFSection(StringRef Section,
|
MCSectionCOFF *getCOFFSection(StringRef Section, unsigned Characteristics,
|
||||||
unsigned Characteristics,
|
SectionKind Kind,
|
||||||
SectionKind Kind,
|
const char *BeginSymName = nullptr);
|
||||||
StringRef COMDATSymName, int Selection,
|
|
||||||
const char *BeginSymName = nullptr);
|
|
||||||
|
|
||||||
const MCSectionCOFF *getCOFFSection(StringRef Section,
|
MCSectionCOFF *getCOFFSection(StringRef Section);
|
||||||
unsigned Characteristics,
|
|
||||||
SectionKind Kind,
|
|
||||||
const char *BeginSymName = nullptr);
|
|
||||||
|
|
||||||
const MCSectionCOFF *getCOFFSection(StringRef Section);
|
|
||||||
|
|
||||||
/// Gets or creates a section equivalent to Sec that is associated with the
|
/// Gets or creates a section equivalent to Sec that is associated with the
|
||||||
/// section containing KeySym. For example, to create a debug info section
|
/// section containing KeySym. For example, to create a debug info section
|
||||||
/// associated with an inline function, pass the normal debug info section
|
/// associated with an inline function, pass the normal debug info section
|
||||||
/// as Sec and the function symbol as KeySym.
|
/// as Sec and the function symbol as KeySym.
|
||||||
const MCSectionCOFF *getAssociativeCOFFSection(const MCSectionCOFF *Sec,
|
MCSectionCOFF *getAssociativeCOFFSection(MCSectionCOFF *Sec,
|
||||||
const MCSymbol *KeySym);
|
const MCSymbol *KeySym);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
@ -467,10 +462,10 @@ namespace llvm {
|
|||||||
void setGenDwarfFileNumber(unsigned FileNumber) {
|
void setGenDwarfFileNumber(unsigned FileNumber) {
|
||||||
GenDwarfFileNumber = FileNumber;
|
GenDwarfFileNumber = FileNumber;
|
||||||
}
|
}
|
||||||
const SetVector<const MCSection *> &getGenDwarfSectionSyms() {
|
const SetVector<MCSection *> &getGenDwarfSectionSyms() {
|
||||||
return SectionsForRanges;
|
return SectionsForRanges;
|
||||||
}
|
}
|
||||||
bool addGenDwarfSection(const MCSection *Sec) {
|
bool addGenDwarfSection(MCSection *Sec) {
|
||||||
return SectionsForRanges.insert(Sec);
|
return SectionsForRanges.insert(Sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public:
|
|||||||
// This is called when an instruction is assembled into the specified
|
// This is called when an instruction is assembled into the specified
|
||||||
// section and if there is information from the last .loc directive that
|
// section and if there is information from the last .loc directive that
|
||||||
// has yet to have a line entry made for it is made.
|
// has yet to have a line entry made for it is made.
|
||||||
static void Make(MCObjectStreamer *MCOS, const MCSection *Section);
|
static void Make(MCObjectStreamer *MCOS, MCSection *Section);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Instances of this class represent the line information for a compile
|
/// \brief Instances of this class represent the line information for a compile
|
||||||
@ -153,14 +153,14 @@ public:
|
|||||||
class MCLineSection {
|
class MCLineSection {
|
||||||
public:
|
public:
|
||||||
// \brief Add an entry to this MCLineSection's line entries.
|
// \brief Add an entry to this MCLineSection's line entries.
|
||||||
void addLineEntry(const MCLineEntry &LineEntry, const MCSection *Sec) {
|
void addLineEntry(const MCLineEntry &LineEntry, MCSection *Sec) {
|
||||||
MCLineDivisions[Sec].push_back(LineEntry);
|
MCLineDivisions[Sec].push_back(LineEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::vector<MCLineEntry> MCLineEntryCollection;
|
typedef std::vector<MCLineEntry> MCLineEntryCollection;
|
||||||
typedef MCLineEntryCollection::iterator iterator;
|
typedef MCLineEntryCollection::iterator iterator;
|
||||||
typedef MCLineEntryCollection::const_iterator const_iterator;
|
typedef MCLineEntryCollection::const_iterator const_iterator;
|
||||||
typedef MapVector<const MCSection *, MCLineEntryCollection> MCLineDivisionMap;
|
typedef MapVector<MCSection *, MCLineEntryCollection> MCLineDivisionMap;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// A collection of MCLineEntry for each section.
|
// A collection of MCLineEntry for each section.
|
||||||
|
@ -48,8 +48,7 @@ public:
|
|||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
void InitSections(bool NoExecStack) override;
|
void InitSections(bool NoExecStack) override;
|
||||||
void ChangeSection(const MCSection *Section,
|
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override;
|
||||||
const MCExpr *Subsection) override;
|
|
||||||
void EmitLabel(MCSymbol *Symbol) override;
|
void EmitLabel(MCSymbol *Symbol) override;
|
||||||
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
|
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
|
||||||
void EmitThumbFunc(MCSymbol *Func) override;
|
void EmitThumbFunc(MCSymbol *Func) override;
|
||||||
@ -68,10 +67,10 @@ public:
|
|||||||
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) override;
|
unsigned ByteAlignment) override;
|
||||||
|
|
||||||
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
|
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
|
||||||
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
|
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
|
||||||
void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
uint64_t Size, unsigned ByteAlignment = 0) override;
|
unsigned ByteAlignment = 0) override;
|
||||||
void EmitValueImpl(const MCExpr *Value, unsigned Size,
|
void EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||||
const SMLoc &Loc = SMLoc()) override;
|
const SMLoc &Loc = SMLoc()) override;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public:
|
|||||||
/// currently defined as the absolute section for constants, or
|
/// currently defined as the absolute section for constants, or
|
||||||
/// otherwise the section associated with the first defined symbol in the
|
/// otherwise the section associated with the first defined symbol in the
|
||||||
/// expression.
|
/// expression.
|
||||||
const MCSection *FindAssociatedSection() const;
|
MCSection *FindAssociatedSection() const;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
};
|
};
|
||||||
@ -558,7 +558,7 @@ public:
|
|||||||
const MCAsmLayout *Layout,
|
const MCAsmLayout *Layout,
|
||||||
const MCFixup *Fixup) const = 0;
|
const MCFixup *Fixup) const = 0;
|
||||||
virtual void visitUsedExpr(MCStreamer& Streamer) const = 0;
|
virtual void visitUsedExpr(MCStreamer& Streamer) const = 0;
|
||||||
virtual const MCSection *FindAssociatedSection() const = 0;
|
virtual MCSection *FindAssociatedSection() const = 0;
|
||||||
|
|
||||||
virtual void fixELFSymbolsInTLSFixups(MCAssembler &) const = 0;
|
virtual void fixELFSymbolsInTLSFixups(MCAssembler &) const = 0;
|
||||||
|
|
||||||
|
@ -53,143 +53,139 @@ protected:
|
|||||||
/// should emit only an EH frame.
|
/// should emit only an EH frame.
|
||||||
unsigned CompactUnwindDwarfEHFrameOnly;
|
unsigned CompactUnwindDwarfEHFrameOnly;
|
||||||
|
|
||||||
/// TextSection - Section directive for standard text.
|
/// Section directive for standard text.
|
||||||
///
|
///
|
||||||
const MCSection *TextSection;
|
MCSection *TextSection;
|
||||||
|
|
||||||
/// DataSection - Section directive for standard data.
|
/// Section directive for standard data.
|
||||||
///
|
///
|
||||||
const MCSection *DataSection;
|
MCSection *DataSection;
|
||||||
|
|
||||||
/// BSSSection - Section that is default initialized to zero.
|
/// Section that is default initialized to zero.
|
||||||
const MCSection *BSSSection;
|
MCSection *BSSSection;
|
||||||
|
|
||||||
/// ReadOnlySection - Section that is readonly and can contain arbitrary
|
/// Section that is readonly and can contain arbitrary initialized data.
|
||||||
/// initialized data. Targets are not required to have a readonly section.
|
/// Targets are not required to have a readonly section. If they don't,
|
||||||
/// If they don't, various bits of code will fall back to using the data
|
/// various bits of code will fall back to using the data section for
|
||||||
/// section for constants.
|
/// constants.
|
||||||
const MCSection *ReadOnlySection;
|
MCSection *ReadOnlySection;
|
||||||
|
|
||||||
/// StaticCtorSection - This section contains the static constructor pointer
|
/// This section contains the static constructor pointer list.
|
||||||
/// list.
|
MCSection *StaticCtorSection;
|
||||||
const MCSection *StaticCtorSection;
|
|
||||||
|
|
||||||
/// StaticDtorSection - This section contains the static destructor pointer
|
/// This section contains the static destructor pointer list.
|
||||||
/// list.
|
MCSection *StaticDtorSection;
|
||||||
const MCSection *StaticDtorSection;
|
|
||||||
|
|
||||||
/// LSDASection - If exception handling is supported by the target, this is
|
/// If exception handling is supported by the target, this is the section the
|
||||||
/// the section the Language Specific Data Area information is emitted to.
|
/// Language Specific Data Area information is emitted to.
|
||||||
const MCSection *LSDASection;
|
MCSection *LSDASection;
|
||||||
|
|
||||||
/// CompactUnwindSection - If exception handling is supported by the target
|
/// If exception handling is supported by the target and the target can
|
||||||
/// and the target can support a compact representation of the CIE and FDE,
|
/// support a compact representation of the CIE and FDE, this is the section
|
||||||
/// this is the section to emit them into.
|
/// to emit them into.
|
||||||
const MCSection *CompactUnwindSection;
|
MCSection *CompactUnwindSection;
|
||||||
|
|
||||||
// Dwarf sections for debug info. If a target supports debug info, these must
|
// Dwarf sections for debug info. If a target supports debug info, these must
|
||||||
// be set.
|
// be set.
|
||||||
const MCSection *DwarfAbbrevSection;
|
MCSection *DwarfAbbrevSection;
|
||||||
const MCSection *DwarfInfoSection;
|
MCSection *DwarfInfoSection;
|
||||||
const MCSection *DwarfLineSection;
|
MCSection *DwarfLineSection;
|
||||||
const MCSection *DwarfFrameSection;
|
MCSection *DwarfFrameSection;
|
||||||
const MCSection *DwarfPubTypesSection;
|
MCSection *DwarfPubTypesSection;
|
||||||
const MCSection *DwarfDebugInlineSection;
|
const MCSection *DwarfDebugInlineSection;
|
||||||
const MCSection *DwarfStrSection;
|
MCSection *DwarfStrSection;
|
||||||
const MCSection *DwarfLocSection;
|
MCSection *DwarfLocSection;
|
||||||
const MCSection *DwarfARangesSection;
|
MCSection *DwarfARangesSection;
|
||||||
const MCSection *DwarfRangesSection;
|
MCSection *DwarfRangesSection;
|
||||||
// The pubnames section is no longer generated by default. The generation
|
// The pubnames section is no longer generated by default. The generation
|
||||||
// can be enabled by a compiler flag.
|
// can be enabled by a compiler flag.
|
||||||
const MCSection *DwarfPubNamesSection;
|
MCSection *DwarfPubNamesSection;
|
||||||
|
|
||||||
// DWARF5 Experimental Debug Info Sections
|
// DWARF5 Experimental Debug Info Sections
|
||||||
/// DwarfAccelNamesSection, DwarfAccelObjCSection,
|
/// DwarfAccelNamesSection, DwarfAccelObjCSection,
|
||||||
/// DwarfAccelNamespaceSection, DwarfAccelTypesSection -
|
/// DwarfAccelNamespaceSection, DwarfAccelTypesSection -
|
||||||
/// If we use the DWARF accelerated hash tables then we want to emit these
|
/// If we use the DWARF accelerated hash tables then we want to emit these
|
||||||
/// sections.
|
/// sections.
|
||||||
const MCSection *DwarfAccelNamesSection;
|
MCSection *DwarfAccelNamesSection;
|
||||||
const MCSection *DwarfAccelObjCSection;
|
MCSection *DwarfAccelObjCSection;
|
||||||
const MCSection *DwarfAccelNamespaceSection;
|
MCSection *DwarfAccelNamespaceSection;
|
||||||
const MCSection *DwarfAccelTypesSection;
|
MCSection *DwarfAccelTypesSection;
|
||||||
|
|
||||||
/// These are used for the Fission separate debug information files.
|
/// These are used for the Fission separate debug information files.
|
||||||
const MCSection *DwarfInfoDWOSection;
|
MCSection *DwarfInfoDWOSection;
|
||||||
const MCSection *DwarfTypesDWOSection;
|
MCSection *DwarfTypesDWOSection;
|
||||||
const MCSection *DwarfAbbrevDWOSection;
|
MCSection *DwarfAbbrevDWOSection;
|
||||||
const MCSection *DwarfStrDWOSection;
|
MCSection *DwarfStrDWOSection;
|
||||||
const MCSection *DwarfLineDWOSection;
|
MCSection *DwarfLineDWOSection;
|
||||||
const MCSection *DwarfLocDWOSection;
|
MCSection *DwarfLocDWOSection;
|
||||||
const MCSection *DwarfStrOffDWOSection;
|
MCSection *DwarfStrOffDWOSection;
|
||||||
const MCSection *DwarfAddrSection;
|
MCSection *DwarfAddrSection;
|
||||||
|
|
||||||
/// Sections for newer gnu pubnames and pubtypes.
|
/// Sections for newer gnu pubnames and pubtypes.
|
||||||
const MCSection *DwarfGnuPubNamesSection;
|
MCSection *DwarfGnuPubNamesSection;
|
||||||
const MCSection *DwarfGnuPubTypesSection;
|
MCSection *DwarfGnuPubTypesSection;
|
||||||
|
|
||||||
const MCSection *COFFDebugSymbolsSection;
|
MCSection *COFFDebugSymbolsSection;
|
||||||
|
|
||||||
// Extra TLS Variable Data section. If the target needs to put additional
|
// Extra TLS Variable Data section. If the target needs to put additional
|
||||||
// information for a TLS variable, it'll go here.
|
// information for a TLS variable, it'll go here.
|
||||||
const MCSection *TLSExtraDataSection;
|
MCSection *TLSExtraDataSection;
|
||||||
|
|
||||||
/// TLSDataSection - Section directive for Thread Local data.
|
/// Section directive for Thread Local data. ELF, MachO and COFF.
|
||||||
/// ELF, MachO and COFF.
|
MCSection *TLSDataSection; // Defaults to ".tdata".
|
||||||
const MCSection *TLSDataSection; // Defaults to ".tdata".
|
|
||||||
|
|
||||||
/// TLSBSSSection - Section directive for Thread Local uninitialized data.
|
/// Section directive for Thread Local uninitialized data. Null if this target
|
||||||
/// Null if this target doesn't support a BSS section.
|
/// doesn't support a BSS section. ELF and MachO only.
|
||||||
/// ELF and MachO only.
|
MCSection *TLSBSSSection; // Defaults to ".tbss".
|
||||||
const MCSection *TLSBSSSection; // Defaults to ".tbss".
|
|
||||||
|
|
||||||
/// StackMap section.
|
/// StackMap section.
|
||||||
const MCSection *StackMapSection;
|
MCSection *StackMapSection;
|
||||||
|
|
||||||
/// EHFrameSection - EH frame section. It is initialized on demand so it
|
/// EH frame section. It is initialized on demand so it can be overwritten
|
||||||
/// can be overwritten (with uniquing).
|
/// (with uniquing).
|
||||||
const MCSection *EHFrameSection;
|
MCSection *EHFrameSection;
|
||||||
|
|
||||||
/// ELF specific sections.
|
/// ELF specific sections.
|
||||||
///
|
///
|
||||||
const MCSection *DataRelSection;
|
MCSection *DataRelSection;
|
||||||
const MCSection *DataRelLocalSection;
|
const MCSection *DataRelLocalSection;
|
||||||
const MCSection *DataRelROSection;
|
MCSection *DataRelROSection;
|
||||||
const MCSection *DataRelROLocalSection;
|
MCSection *DataRelROLocalSection;
|
||||||
const MCSection *MergeableConst4Section;
|
MCSection *MergeableConst4Section;
|
||||||
const MCSection *MergeableConst8Section;
|
MCSection *MergeableConst8Section;
|
||||||
const MCSection *MergeableConst16Section;
|
MCSection *MergeableConst16Section;
|
||||||
|
|
||||||
/// MachO specific sections.
|
/// MachO specific sections.
|
||||||
///
|
///
|
||||||
|
|
||||||
/// TLSTLVSection - Section for thread local structure information.
|
/// Section for thread local structure information. Contains the source code
|
||||||
/// Contains the source code name of the variable, visibility and a pointer
|
/// name of the variable, visibility and a pointer to the initial value
|
||||||
/// to the initial value (.tdata or .tbss).
|
/// (.tdata or .tbss).
|
||||||
const MCSection *TLSTLVSection; // Defaults to ".tlv".
|
MCSection *TLSTLVSection; // Defaults to ".tlv".
|
||||||
|
|
||||||
/// TLSThreadInitSection - Section for thread local data initialization
|
/// TLSThreadInitSection - Section for thread local data initialization
|
||||||
/// functions.
|
/// functions.
|
||||||
const MCSection *TLSThreadInitSection; // Defaults to ".thread_init_func".
|
const MCSection *TLSThreadInitSection; // Defaults to ".thread_init_func".
|
||||||
|
|
||||||
const MCSection *CStringSection;
|
MCSection *CStringSection;
|
||||||
const MCSection *UStringSection;
|
MCSection *UStringSection;
|
||||||
const MCSection *TextCoalSection;
|
MCSection *TextCoalSection;
|
||||||
const MCSection *ConstTextCoalSection;
|
MCSection *ConstTextCoalSection;
|
||||||
const MCSection *ConstDataSection;
|
MCSection *ConstDataSection;
|
||||||
const MCSection *DataCoalSection;
|
MCSection *DataCoalSection;
|
||||||
const MCSection *DataCommonSection;
|
MCSection *DataCommonSection;
|
||||||
const MCSection *DataBSSSection;
|
MCSection *DataBSSSection;
|
||||||
const MCSection *FourByteConstantSection;
|
MCSection *FourByteConstantSection;
|
||||||
const MCSection *EightByteConstantSection;
|
MCSection *EightByteConstantSection;
|
||||||
const MCSection *SixteenByteConstantSection;
|
MCSection *SixteenByteConstantSection;
|
||||||
const MCSection *LazySymbolPointerSection;
|
MCSection *LazySymbolPointerSection;
|
||||||
const MCSection *NonLazySymbolPointerSection;
|
MCSection *NonLazySymbolPointerSection;
|
||||||
|
|
||||||
/// COFF specific sections.
|
/// COFF specific sections.
|
||||||
///
|
///
|
||||||
const MCSection *DrectveSection;
|
MCSection *DrectveSection;
|
||||||
const MCSection *PDataSection;
|
MCSection *PDataSection;
|
||||||
const MCSection *XDataSection;
|
MCSection *XDataSection;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void InitMCObjectFileInfo(StringRef TT, Reloc::Model RM, CodeModel::Model CM,
|
void InitMCObjectFileInfo(StringRef TT, Reloc::Model RM, CodeModel::Model CM,
|
||||||
@ -214,94 +210,70 @@ public:
|
|||||||
return CompactUnwindDwarfEHFrameOnly;
|
return CompactUnwindDwarfEHFrameOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *getTextSection() const { return TextSection; }
|
MCSection *getTextSection() const { return TextSection; }
|
||||||
const MCSection *getDataSection() const { return DataSection; }
|
MCSection *getDataSection() const { return DataSection; }
|
||||||
const MCSection *getBSSSection() const { return BSSSection; }
|
MCSection *getBSSSection() const { return BSSSection; }
|
||||||
const MCSection *getLSDASection() const { return LSDASection; }
|
MCSection *getLSDASection() const { return LSDASection; }
|
||||||
const MCSection *getCompactUnwindSection() const{
|
MCSection *getCompactUnwindSection() const { return CompactUnwindSection; }
|
||||||
return CompactUnwindSection;
|
MCSection *getDwarfAbbrevSection() const { return DwarfAbbrevSection; }
|
||||||
}
|
MCSection *getDwarfInfoSection() const { return DwarfInfoSection; }
|
||||||
const MCSection *getDwarfAbbrevSection() const { return DwarfAbbrevSection; }
|
MCSection *getDwarfLineSection() const { return DwarfLineSection; }
|
||||||
const MCSection *getDwarfInfoSection() const { return DwarfInfoSection; }
|
MCSection *getDwarfFrameSection() const { return DwarfFrameSection; }
|
||||||
const MCSection *getDwarfLineSection() const { return DwarfLineSection; }
|
MCSection *getDwarfPubNamesSection() const { return DwarfPubNamesSection; }
|
||||||
const MCSection *getDwarfFrameSection() const { return DwarfFrameSection; }
|
MCSection *getDwarfPubTypesSection() const { return DwarfPubTypesSection; }
|
||||||
const MCSection *getDwarfPubNamesSection() const{return DwarfPubNamesSection;}
|
MCSection *getDwarfGnuPubNamesSection() const {
|
||||||
const MCSection *getDwarfPubTypesSection() const{return DwarfPubTypesSection;}
|
|
||||||
const MCSection *getDwarfGnuPubNamesSection() const {
|
|
||||||
return DwarfGnuPubNamesSection;
|
return DwarfGnuPubNamesSection;
|
||||||
}
|
}
|
||||||
const MCSection *getDwarfGnuPubTypesSection() const {
|
MCSection *getDwarfGnuPubTypesSection() const {
|
||||||
return DwarfGnuPubTypesSection;
|
return DwarfGnuPubTypesSection;
|
||||||
}
|
}
|
||||||
const MCSection *getDwarfDebugInlineSection() const {
|
const MCSection *getDwarfDebugInlineSection() const {
|
||||||
return DwarfDebugInlineSection;
|
return DwarfDebugInlineSection;
|
||||||
}
|
}
|
||||||
const MCSection *getDwarfStrSection() const { return DwarfStrSection; }
|
MCSection *getDwarfStrSection() const { return DwarfStrSection; }
|
||||||
const MCSection *getDwarfLocSection() const { return DwarfLocSection; }
|
MCSection *getDwarfLocSection() const { return DwarfLocSection; }
|
||||||
const MCSection *getDwarfARangesSection() const { return DwarfARangesSection;}
|
MCSection *getDwarfARangesSection() const { return DwarfARangesSection; }
|
||||||
const MCSection *getDwarfRangesSection() const { return DwarfRangesSection; }
|
MCSection *getDwarfRangesSection() const { return DwarfRangesSection; }
|
||||||
|
|
||||||
// DWARF5 Experimental Debug Info Sections
|
// DWARF5 Experimental Debug Info Sections
|
||||||
const MCSection *getDwarfAccelNamesSection() const {
|
MCSection *getDwarfAccelNamesSection() const {
|
||||||
return DwarfAccelNamesSection;
|
return DwarfAccelNamesSection;
|
||||||
}
|
}
|
||||||
const MCSection *getDwarfAccelObjCSection() const {
|
MCSection *getDwarfAccelObjCSection() const { return DwarfAccelObjCSection; }
|
||||||
return DwarfAccelObjCSection;
|
MCSection *getDwarfAccelNamespaceSection() const {
|
||||||
}
|
|
||||||
const MCSection *getDwarfAccelNamespaceSection() const {
|
|
||||||
return DwarfAccelNamespaceSection;
|
return DwarfAccelNamespaceSection;
|
||||||
}
|
}
|
||||||
const MCSection *getDwarfAccelTypesSection() const {
|
MCSection *getDwarfAccelTypesSection() const {
|
||||||
return DwarfAccelTypesSection;
|
return DwarfAccelTypesSection;
|
||||||
}
|
}
|
||||||
const MCSection *getDwarfInfoDWOSection() const {
|
MCSection *getDwarfInfoDWOSection() const { return DwarfInfoDWOSection; }
|
||||||
return DwarfInfoDWOSection;
|
MCSection *getDwarfTypesSection(uint64_t Hash) const;
|
||||||
}
|
MCSection *getDwarfTypesDWOSection() const { return DwarfTypesDWOSection; }
|
||||||
const MCSection *getDwarfTypesSection(uint64_t Hash) const;
|
MCSection *getDwarfAbbrevDWOSection() const { return DwarfAbbrevDWOSection; }
|
||||||
const MCSection *getDwarfTypesDWOSection() const {
|
MCSection *getDwarfStrDWOSection() const { return DwarfStrDWOSection; }
|
||||||
return DwarfTypesDWOSection;
|
MCSection *getDwarfLineDWOSection() const { return DwarfLineDWOSection; }
|
||||||
}
|
MCSection *getDwarfLocDWOSection() const { return DwarfLocDWOSection; }
|
||||||
const MCSection *getDwarfAbbrevDWOSection() const {
|
MCSection *getDwarfStrOffDWOSection() const { return DwarfStrOffDWOSection; }
|
||||||
return DwarfAbbrevDWOSection;
|
MCSection *getDwarfAddrSection() const { return DwarfAddrSection; }
|
||||||
}
|
|
||||||
const MCSection *getDwarfStrDWOSection() const {
|
|
||||||
return DwarfStrDWOSection;
|
|
||||||
}
|
|
||||||
const MCSection *getDwarfLineDWOSection() const {
|
|
||||||
return DwarfLineDWOSection;
|
|
||||||
}
|
|
||||||
const MCSection *getDwarfLocDWOSection() const {
|
|
||||||
return DwarfLocDWOSection;
|
|
||||||
}
|
|
||||||
const MCSection *getDwarfStrOffDWOSection() const {
|
|
||||||
return DwarfStrOffDWOSection;
|
|
||||||
}
|
|
||||||
const MCSection *getDwarfAddrSection() const {
|
|
||||||
return DwarfAddrSection;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MCSection *getCOFFDebugSymbolsSection() const {
|
MCSection *getCOFFDebugSymbolsSection() const {
|
||||||
return COFFDebugSymbolsSection;
|
return COFFDebugSymbolsSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *getTLSExtraDataSection() const {
|
MCSection *getTLSExtraDataSection() const { return TLSExtraDataSection; }
|
||||||
return TLSExtraDataSection;
|
|
||||||
}
|
|
||||||
const MCSection *getTLSDataSection() const { return TLSDataSection; }
|
const MCSection *getTLSDataSection() const { return TLSDataSection; }
|
||||||
const MCSection *getTLSBSSSection() const { return TLSBSSSection; }
|
MCSection *getTLSBSSSection() const { return TLSBSSSection; }
|
||||||
|
|
||||||
const MCSection *getStackMapSection() const { return StackMapSection; }
|
MCSection *getStackMapSection() const { return StackMapSection; }
|
||||||
|
|
||||||
/// ELF specific sections.
|
/// ELF specific sections.
|
||||||
///
|
///
|
||||||
const MCSection *getDataRelSection() const { return DataRelSection; }
|
MCSection *getDataRelSection() const { return DataRelSection; }
|
||||||
const MCSection *getDataRelLocalSection() const {
|
const MCSection *getDataRelLocalSection() const {
|
||||||
return DataRelLocalSection;
|
return DataRelLocalSection;
|
||||||
}
|
}
|
||||||
const MCSection *getDataRelROSection() const { return DataRelROSection; }
|
MCSection *getDataRelROSection() const { return DataRelROSection; }
|
||||||
const MCSection *getDataRelROLocalSection() const {
|
MCSection *getDataRelROLocalSection() const { return DataRelROLocalSection; }
|
||||||
return DataRelROLocalSection;
|
|
||||||
}
|
|
||||||
const MCSection *getMergeableConst4Section() const {
|
const MCSection *getMergeableConst4Section() const {
|
||||||
return MergeableConst4Section;
|
return MergeableConst4Section;
|
||||||
}
|
}
|
||||||
@ -320,14 +292,14 @@ public:
|
|||||||
}
|
}
|
||||||
const MCSection *getCStringSection() const { return CStringSection; }
|
const MCSection *getCStringSection() const { return CStringSection; }
|
||||||
const MCSection *getUStringSection() const { return UStringSection; }
|
const MCSection *getUStringSection() const { return UStringSection; }
|
||||||
const MCSection *getTextCoalSection() const { return TextCoalSection; }
|
MCSection *getTextCoalSection() const { return TextCoalSection; }
|
||||||
const MCSection *getConstTextCoalSection() const {
|
const MCSection *getConstTextCoalSection() const {
|
||||||
return ConstTextCoalSection;
|
return ConstTextCoalSection;
|
||||||
}
|
}
|
||||||
const MCSection *getConstDataSection() const { return ConstDataSection; }
|
const MCSection *getConstDataSection() const { return ConstDataSection; }
|
||||||
const MCSection *getDataCoalSection() const { return DataCoalSection; }
|
const MCSection *getDataCoalSection() const { return DataCoalSection; }
|
||||||
const MCSection *getDataCommonSection() const { return DataCommonSection; }
|
const MCSection *getDataCommonSection() const { return DataCommonSection; }
|
||||||
const MCSection *getDataBSSSection() const { return DataBSSSection; }
|
MCSection *getDataBSSSection() const { return DataBSSSection; }
|
||||||
const MCSection *getFourByteConstantSection() const {
|
const MCSection *getFourByteConstantSection() const {
|
||||||
return FourByteConstantSection;
|
return FourByteConstantSection;
|
||||||
}
|
}
|
||||||
@ -337,20 +309,20 @@ public:
|
|||||||
const MCSection *getSixteenByteConstantSection() const {
|
const MCSection *getSixteenByteConstantSection() const {
|
||||||
return SixteenByteConstantSection;
|
return SixteenByteConstantSection;
|
||||||
}
|
}
|
||||||
const MCSection *getLazySymbolPointerSection() const {
|
MCSection *getLazySymbolPointerSection() const {
|
||||||
return LazySymbolPointerSection;
|
return LazySymbolPointerSection;
|
||||||
}
|
}
|
||||||
const MCSection *getNonLazySymbolPointerSection() const {
|
MCSection *getNonLazySymbolPointerSection() const {
|
||||||
return NonLazySymbolPointerSection;
|
return NonLazySymbolPointerSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// COFF specific sections.
|
/// COFF specific sections.
|
||||||
///
|
///
|
||||||
const MCSection *getDrectveSection() const { return DrectveSection; }
|
MCSection *getDrectveSection() const { return DrectveSection; }
|
||||||
const MCSection *getPDataSection() const { return PDataSection; }
|
MCSection *getPDataSection() const { return PDataSection; }
|
||||||
const MCSection *getXDataSection() const { return XDataSection; }
|
MCSection *getXDataSection() const { return XDataSection; }
|
||||||
|
|
||||||
const MCSection *getEHFrameSection() {
|
MCSection *getEHFrameSection() {
|
||||||
if (!EHFrameSection)
|
if (!EHFrameSection)
|
||||||
InitEHFrameSection();
|
InitEHFrameSection();
|
||||||
return EHFrameSection;
|
return EHFrameSection;
|
||||||
|
@ -80,7 +80,7 @@ protected:
|
|||||||
/// fragment is not a data fragment.
|
/// fragment is not a data fragment.
|
||||||
MCDataFragment *getOrCreateDataFragment();
|
MCDataFragment *getOrCreateDataFragment();
|
||||||
|
|
||||||
bool changeSectionImpl(const MCSection *Section, const MCExpr *Subsection);
|
bool changeSectionImpl(MCSection *Section, const MCExpr *Subsection);
|
||||||
|
|
||||||
/// If any labels have been emitted but not assigned fragments, ensure that
|
/// If any labels have been emitted but not assigned fragments, ensure that
|
||||||
/// they get assigned, either to F if possible or to a new data fragment.
|
/// they get assigned, either to F if possible or to a new data fragment.
|
||||||
@ -103,8 +103,7 @@ public:
|
|||||||
void EmitULEB128Value(const MCExpr *Value) override;
|
void EmitULEB128Value(const MCExpr *Value) override;
|
||||||
void EmitSLEB128Value(const MCExpr *Value) override;
|
void EmitSLEB128Value(const MCExpr *Value) override;
|
||||||
void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
|
void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
|
||||||
void ChangeSection(const MCSection *Section,
|
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override;
|
||||||
const MCExpr *Subsection) override;
|
|
||||||
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo& STI) override;
|
void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo& STI) override;
|
||||||
|
|
||||||
/// \brief Emit an instruction to a special fragment, because this instruction
|
/// \brief Emit an instruction to a special fragment, because this instruction
|
||||||
@ -147,7 +146,7 @@ public:
|
|||||||
bool emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo,
|
bool emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo,
|
||||||
unsigned Size) override;
|
unsigned Size) override;
|
||||||
|
|
||||||
bool mayHaveInstructions(const MCSection &Sec) const override {
|
bool mayHaveInstructions(MCSection &Sec) const override {
|
||||||
return Assembler->getOrCreateSectionData(Sec).hasInstructions();
|
return Assembler->getOrCreateSectionData(Sec).hasInstructions();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -35,12 +35,14 @@ private:
|
|||||||
MCSection(const MCSection &) = delete;
|
MCSection(const MCSection &) = delete;
|
||||||
void operator=(const MCSection &) = delete;
|
void operator=(const MCSection &) = delete;
|
||||||
|
|
||||||
mutable MCSymbol *Begin;
|
MCSymbol *Begin;
|
||||||
mutable MCSymbol *End;
|
MCSymbol *End;
|
||||||
|
/// The alignment requirement of this section.
|
||||||
|
unsigned Alignment;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin)
|
MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin)
|
||||||
: Begin(Begin), End(nullptr), Variant(V), Kind(K) {}
|
: Begin(Begin), End(nullptr), Alignment(1), Variant(V), Kind(K) {}
|
||||||
SectionVariant Variant;
|
SectionVariant Variant;
|
||||||
SectionKind Kind;
|
SectionKind Kind;
|
||||||
|
|
||||||
@ -51,14 +53,20 @@ public:
|
|||||||
|
|
||||||
SectionVariant getVariant() const { return Variant; }
|
SectionVariant getVariant() const { return Variant; }
|
||||||
|
|
||||||
MCSymbol *getBeginSymbol() const { return Begin; }
|
MCSymbol *getBeginSymbol() { return Begin; }
|
||||||
void setBeginSymbol(MCSymbol *Sym) const {
|
const MCSymbol *getBeginSymbol() const {
|
||||||
|
return const_cast<MCSection *>(this)->getBeginSymbol();
|
||||||
|
}
|
||||||
|
void setBeginSymbol(MCSymbol *Sym) {
|
||||||
assert(!Begin);
|
assert(!Begin);
|
||||||
Begin = Sym;
|
Begin = Sym;
|
||||||
}
|
}
|
||||||
MCSymbol *getEndSymbol(MCContext &Ctx) const;
|
MCSymbol *getEndSymbol(MCContext &Ctx);
|
||||||
bool hasEnded() const;
|
bool hasEnded() const;
|
||||||
|
|
||||||
|
unsigned getAlignment() const { return Alignment; }
|
||||||
|
void setAlignment(unsigned Value) { Alignment = Value; }
|
||||||
|
|
||||||
virtual void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
|
virtual void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
|
||||||
const MCExpr *Subsection) const = 0;
|
const MCExpr *Subsection) const = 0;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class raw_ostream;
|
|||||||
class formatted_raw_ostream;
|
class formatted_raw_ostream;
|
||||||
class AssemblerConstantPools;
|
class AssemblerConstantPools;
|
||||||
|
|
||||||
typedef std::pair<const MCSection *, const MCExpr *> MCSectionSubPair;
|
typedef std::pair<MCSection *, const MCExpr *> MCSectionSubPair;
|
||||||
|
|
||||||
/// Target specific streamer interface. This is used so that targets can
|
/// Target specific streamer interface. This is used so that targets can
|
||||||
/// implement support for target specific assembly directives.
|
/// implement support for target specific assembly directives.
|
||||||
@ -313,7 +313,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// This is called by PopSection and SwitchSection, if the current
|
/// This is called by PopSection and SwitchSection, if the current
|
||||||
/// section changes.
|
/// section changes.
|
||||||
virtual void ChangeSection(const MCSection *, const MCExpr *);
|
virtual void ChangeSection(MCSection *, const MCExpr *);
|
||||||
|
|
||||||
/// \brief Save the current and previous section on the section stack.
|
/// \brief Save the current and previous section on the section stack.
|
||||||
void PushSection() {
|
void PushSection() {
|
||||||
@ -348,13 +348,13 @@ public:
|
|||||||
/// is required to update CurSection.
|
/// is required to update CurSection.
|
||||||
///
|
///
|
||||||
/// This corresponds to assembler directives like .section, .text, etc.
|
/// This corresponds to assembler directives like .section, .text, etc.
|
||||||
virtual void SwitchSection(const MCSection *Section,
|
virtual void SwitchSection(MCSection *Section,
|
||||||
const MCExpr *Subsection = nullptr);
|
const MCExpr *Subsection = nullptr);
|
||||||
|
|
||||||
/// \brief Set the current section where code is being emitted to \p Section.
|
/// \brief Set the current section where code is being emitted to \p Section.
|
||||||
/// This is required to update CurSection. This version does not call
|
/// This is required to update CurSection. This version does not call
|
||||||
/// ChangeSection.
|
/// ChangeSection.
|
||||||
void SwitchSectionNoChange(const MCSection *Section,
|
void SwitchSectionNoChange(MCSection *Section,
|
||||||
const MCExpr *Subsection = nullptr) {
|
const MCExpr *Subsection = nullptr) {
|
||||||
assert(Section && "Cannot switch to a null section!");
|
assert(Section && "Cannot switch to a null section!");
|
||||||
MCSectionSubPair curSection = SectionStack.back().first;
|
MCSectionSubPair curSection = SectionStack.back().first;
|
||||||
@ -366,13 +366,13 @@ public:
|
|||||||
/// \brief Create the default sections and set the initial one.
|
/// \brief Create the default sections and set the initial one.
|
||||||
virtual void InitSections(bool NoExecStack);
|
virtual void InitSections(bool NoExecStack);
|
||||||
|
|
||||||
MCSymbol *endSection(const MCSection *Section);
|
MCSymbol *endSection(MCSection *Section);
|
||||||
|
|
||||||
/// \brief Sets the symbol's section.
|
/// \brief Sets the symbol's section.
|
||||||
///
|
///
|
||||||
/// Each emitted symbol will be tracked in the ordering table,
|
/// Each emitted symbol will be tracked in the ordering table,
|
||||||
/// so we can sort on them later.
|
/// so we can sort on them later.
|
||||||
void AssignSection(MCSymbol *Symbol, const MCSection *Section);
|
void AssignSection(MCSymbol *Symbol, MCSection *Section);
|
||||||
|
|
||||||
/// \brief Emit a label for \p Symbol into the current section.
|
/// \brief Emit a label for \p Symbol into the current section.
|
||||||
///
|
///
|
||||||
@ -500,9 +500,8 @@ public:
|
|||||||
/// \param Size - The size of the zerofill symbol.
|
/// \param Size - The size of the zerofill symbol.
|
||||||
/// \param ByteAlignment - The alignment of the zerofill symbol if
|
/// \param ByteAlignment - The alignment of the zerofill symbol if
|
||||||
/// non-zero. This must be a power of 2 on some targets.
|
/// non-zero. This must be a power of 2 on some targets.
|
||||||
virtual void EmitZerofill(const MCSection *Section,
|
virtual void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
|
||||||
MCSymbol *Symbol = nullptr, uint64_t Size = 0,
|
uint64_t Size = 0, unsigned ByteAlignment = 0) = 0;
|
||||||
unsigned ByteAlignment = 0) = 0;
|
|
||||||
|
|
||||||
/// \brief Emit a thread local bss (.tbss) symbol.
|
/// \brief Emit a thread local bss (.tbss) symbol.
|
||||||
///
|
///
|
||||||
@ -511,7 +510,7 @@ public:
|
|||||||
/// \param Size - The size of the symbol.
|
/// \param Size - The size of the symbol.
|
||||||
/// \param ByteAlignment - The alignment of the thread local common symbol
|
/// \param ByteAlignment - The alignment of the thread local common symbol
|
||||||
/// if non-zero. This must be a power of 2 on some targets.
|
/// if non-zero. This must be a power of 2 on some targets.
|
||||||
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
virtual void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment = 0);
|
uint64_t Size, unsigned ByteAlignment = 0);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
@ -728,7 +727,7 @@ public:
|
|||||||
/// \brief Finish emission of machine code.
|
/// \brief Finish emission of machine code.
|
||||||
void Finish();
|
void Finish();
|
||||||
|
|
||||||
virtual bool mayHaveInstructions(const MCSection &Sec) const { return true; }
|
virtual bool mayHaveInstructions(MCSection &Sec) const { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Create a dummy machine code streamer, which does nothing. This is useful for
|
/// Create a dummy machine code streamer, which does nothing. This is useful for
|
||||||
|
@ -150,17 +150,16 @@ class MCSymbol {
|
|||||||
// Special sentinal value for the absolute pseudo section.
|
// Special sentinal value for the absolute pseudo section.
|
||||||
//
|
//
|
||||||
// FIXME: Use a PointerInt wrapper for this?
|
// FIXME: Use a PointerInt wrapper for this?
|
||||||
static const MCSection *AbsolutePseudoSection;
|
static MCSection *AbsolutePseudoSection;
|
||||||
|
|
||||||
/// Name - The name of the symbol. The referred-to string data is actually
|
/// Name - The name of the symbol. The referred-to string data is actually
|
||||||
/// held by the StringMap that lives in MCContext.
|
/// held by the StringMap that lives in MCContext.
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
|
|
||||||
/// Section - The section the symbol is defined in. This is null for
|
/// The section the symbol is defined in. This is null for undefined symbols,
|
||||||
/// undefined symbols, and the special AbsolutePseudoSection value for
|
/// and the special AbsolutePseudoSection value for absolute symbols. If this
|
||||||
/// absolute symbols. If this is a variable symbol, this caches the
|
/// is a variable symbol, this caches the variable value's section.
|
||||||
/// variable value's section.
|
mutable MCSection *Section;
|
||||||
mutable const MCSection *Section;
|
|
||||||
|
|
||||||
/// Value - If non-null, the value for a variable symbol.
|
/// Value - If non-null, the value for a variable symbol.
|
||||||
const MCExpr *Value;
|
const MCExpr *Value;
|
||||||
@ -188,7 +187,7 @@ private: // MCContext creates and uniques these.
|
|||||||
|
|
||||||
MCSymbol(const MCSymbol &) = delete;
|
MCSymbol(const MCSymbol &) = delete;
|
||||||
void operator=(const MCSymbol &) = delete;
|
void operator=(const MCSymbol &) = delete;
|
||||||
const MCSection *getSectionPtr() const {
|
MCSection *getSectionPtr() const {
|
||||||
if (Section || !Value)
|
if (Section || !Value)
|
||||||
return Section;
|
return Section;
|
||||||
return Section = Value->FindAssociatedSection();
|
return Section = Value->FindAssociatedSection();
|
||||||
@ -255,15 +254,14 @@ public:
|
|||||||
/// isAbsolute - Check if this is an absolute symbol.
|
/// isAbsolute - Check if this is an absolute symbol.
|
||||||
bool isAbsolute() const { return getSectionPtr() == AbsolutePseudoSection; }
|
bool isAbsolute() const { return getSectionPtr() == AbsolutePseudoSection; }
|
||||||
|
|
||||||
/// getSection - Get the section associated with a defined, non-absolute
|
/// Get the section associated with a defined, non-absolute symbol.
|
||||||
/// symbol.
|
MCSection &getSection() const {
|
||||||
const MCSection &getSection() const {
|
|
||||||
assert(isInSection() && "Invalid accessor!");
|
assert(isInSection() && "Invalid accessor!");
|
||||||
return *getSectionPtr();
|
return *getSectionPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// setSection - Mark the symbol as defined in the section \p S.
|
/// Mark the symbol as defined in the section \p S.
|
||||||
void setSection(const MCSection &S) {
|
void setSection(MCSection &S) {
|
||||||
assert(!isVariable() && "Cannot set section of variable");
|
assert(!isVariable() && "Cannot set section of variable");
|
||||||
Section = &S;
|
Section = &S;
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,9 @@ public:
|
|||||||
unsigned ByteAlignment) override;
|
unsigned ByteAlignment) override;
|
||||||
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) override;
|
unsigned ByteAlignment) override;
|
||||||
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
void EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) override;
|
unsigned ByteAlignment) override;
|
||||||
void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) override;
|
unsigned ByteAlignment) override;
|
||||||
void EmitFileDirective(StringRef Filename) override;
|
void EmitFileDirective(StringRef Filename) override;
|
||||||
void EmitIdent(StringRef IdentString) override;
|
void EmitIdent(StringRef IdentString) override;
|
||||||
|
@ -65,10 +65,10 @@ struct FrameInfo {
|
|||||||
|
|
||||||
class UnwindEmitter {
|
class UnwindEmitter {
|
||||||
public:
|
public:
|
||||||
static const MCSection *getPDataSection(const MCSymbol *Function,
|
static MCSection *getPDataSection(const MCSymbol *Function,
|
||||||
MCContext &Context);
|
MCContext &Context);
|
||||||
static const MCSection *getXDataSection(const MCSymbol *Function,
|
static MCSection *getXDataSection(const MCSymbol *Function,
|
||||||
MCContext &Context);
|
MCContext &Context);
|
||||||
|
|
||||||
virtual ~UnwindEmitter() { }
|
virtual ~UnwindEmitter() { }
|
||||||
|
|
||||||
|
@ -77,8 +77,8 @@ public:
|
|||||||
|
|
||||||
/// Given a constant with the SectionKind, return a section that it should be
|
/// Given a constant with the SectionKind, return a section that it should be
|
||||||
/// placed in.
|
/// placed in.
|
||||||
virtual const MCSection *getSectionForConstant(SectionKind Kind,
|
virtual MCSection *getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const;
|
const Constant *C) const;
|
||||||
|
|
||||||
/// Classify the specified global variable into a set of target independent
|
/// Classify the specified global variable into a set of target independent
|
||||||
/// categories embodied in SectionKind.
|
/// categories embodied in SectionKind.
|
||||||
@ -88,16 +88,14 @@ public:
|
|||||||
/// This method computes the appropriate section to emit the specified global
|
/// This method computes the appropriate section to emit the specified global
|
||||||
/// variable or function definition. This should not be passed external (or
|
/// variable or function definition. This should not be passed external (or
|
||||||
/// available externally) globals.
|
/// available externally) globals.
|
||||||
const MCSection *SectionForGlobal(const GlobalValue *GV,
|
MCSection *SectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SectionKind Kind, Mangler &Mang,
|
Mangler &Mang, const TargetMachine &TM) const;
|
||||||
const TargetMachine &TM) const;
|
|
||||||
|
|
||||||
/// This method computes the appropriate section to emit the specified global
|
/// This method computes the appropriate section to emit the specified global
|
||||||
/// variable or function definition. This should not be passed external (or
|
/// variable or function definition. This should not be passed external (or
|
||||||
/// available externally) globals.
|
/// available externally) globals.
|
||||||
const MCSection *SectionForGlobal(const GlobalValue *GV,
|
MCSection *SectionForGlobal(const GlobalValue *GV, Mangler &Mang,
|
||||||
Mangler &Mang,
|
const TargetMachine &TM) const {
|
||||||
const TargetMachine &TM) const {
|
|
||||||
return SectionForGlobal(GV, getKindForGlobal(GV, TM), Mang, TM);
|
return SectionForGlobal(GV, getKindForGlobal(GV, TM), Mang, TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,9 +104,8 @@ public:
|
|||||||
bool CannotUsePrivateLabel, Mangler &Mang,
|
bool CannotUsePrivateLabel, Mangler &Mang,
|
||||||
const TargetMachine &TM) const;
|
const TargetMachine &TM) const;
|
||||||
|
|
||||||
virtual const MCSection *
|
virtual MCSection *getSectionForJumpTable(const Function &F, Mangler &Mang,
|
||||||
getSectionForJumpTable(const Function &F, Mangler &Mang,
|
const TargetMachine &TM) const;
|
||||||
const TargetMachine &TM) const;
|
|
||||||
|
|
||||||
virtual bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,
|
virtual bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,
|
||||||
const Function &F) const;
|
const Function &F) const;
|
||||||
@ -116,7 +113,7 @@ public:
|
|||||||
/// Targets should implement this method to assign a section to globals with
|
/// Targets should implement this method to assign a section to globals with
|
||||||
/// an explicit section specfied. The implementation of this method can
|
/// an explicit section specfied. The implementation of this method can
|
||||||
/// assume that GV->hasSection() is true.
|
/// assume that GV->hasSection() is true.
|
||||||
virtual const MCSection *
|
virtual MCSection *
|
||||||
getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
|
getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
Mangler &Mang, const TargetMachine &TM) const = 0;
|
Mangler &Mang, const TargetMachine &TM) const = 0;
|
||||||
|
|
||||||
@ -150,13 +147,13 @@ public:
|
|||||||
getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,
|
getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,
|
||||||
MCStreamer &Streamer) const;
|
MCStreamer &Streamer) const;
|
||||||
|
|
||||||
virtual const MCSection *getStaticCtorSection(unsigned Priority,
|
virtual MCSection *getStaticCtorSection(unsigned Priority,
|
||||||
const MCSymbol *KeySym) const {
|
const MCSymbol *KeySym) const {
|
||||||
return StaticCtorSection;
|
return StaticCtorSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const MCSection *getStaticDtorSection(unsigned Priority,
|
virtual MCSection *getStaticDtorSection(unsigned Priority,
|
||||||
const MCSymbol *KeySym) const {
|
const MCSymbol *KeySym) const {
|
||||||
return StaticDtorSection;
|
return StaticDtorSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,9 +189,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const MCSection *
|
virtual MCSection *SelectSectionForGlobal(const GlobalValue *GV,
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
SectionKind Kind, Mangler &Mang,
|
||||||
Mangler &Mang, const TargetMachine &TM) const = 0;
|
const TargetMachine &TM) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
@ -24,7 +24,7 @@ unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit addresses into the section given.
|
// Emit addresses into the section given.
|
||||||
void AddressPool::emit(AsmPrinter &Asm, const MCSection *AddrSection) {
|
void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
|
||||||
if (Pool.empty())
|
if (Pool.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public:
|
|||||||
/// label/symbol.
|
/// label/symbol.
|
||||||
unsigned getIndex(const MCSymbol *Sym, bool TLS = false);
|
unsigned getIndex(const MCSymbol *Sym, bool TLS = false);
|
||||||
|
|
||||||
void emit(AsmPrinter &Asm, const MCSection *AddrSection);
|
void emit(AsmPrinter &Asm, MCSection *AddrSection);
|
||||||
|
|
||||||
bool isEmpty() { return Pool.empty(); }
|
bool isEmpty() { return Pool.empty(); }
|
||||||
|
|
||||||
|
@ -405,8 +405,8 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
|
|
||||||
// Handle local BSS symbols.
|
// Handle local BSS symbols.
|
||||||
if (MAI->hasMachoZeroFillDirective()) {
|
if (MAI->hasMachoZeroFillDirective()) {
|
||||||
const MCSection *TheSection =
|
MCSection *TheSection =
|
||||||
getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
|
getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
|
||||||
// .zerofill __DATA, __bss, _foo, 400, 5
|
// .zerofill __DATA, __bss, _foo, 400, 5
|
||||||
OutStreamer->EmitZerofill(TheSection, GVSym, Size, Align);
|
OutStreamer->EmitZerofill(TheSection, GVSym, Size, Align);
|
||||||
return;
|
return;
|
||||||
@ -434,8 +434,8 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TheSection =
|
MCSection *TheSection =
|
||||||
getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
|
getObjFileLowering().SectionForGlobal(GV, GVKind, *Mang, TM);
|
||||||
|
|
||||||
// Handle the zerofill directive on darwin, which is a special form of BSS
|
// Handle the zerofill directive on darwin, which is a special form of BSS
|
||||||
// emission.
|
// emission.
|
||||||
@ -479,8 +479,7 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
OutStreamer->AddBlankLine();
|
OutStreamer->AddBlankLine();
|
||||||
|
|
||||||
// Emit the variable struct for the runtime.
|
// Emit the variable struct for the runtime.
|
||||||
const MCSection *TLVSect
|
MCSection *TLVSect = getObjFileLowering().getTLSExtraDataSection();
|
||||||
= getObjFileLowering().getTLSExtraDataSection();
|
|
||||||
|
|
||||||
OutStreamer->SwitchSection(TLVSect);
|
OutStreamer->SwitchSection(TLVSect);
|
||||||
// Emit the linkage here.
|
// Emit the linkage here.
|
||||||
@ -1122,7 +1121,7 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
|
|
||||||
// Emit __morestack address if needed for indirect calls.
|
// Emit __morestack address if needed for indirect calls.
|
||||||
if (MMI->usesMorestackAddr()) {
|
if (MMI->usesMorestackAddr()) {
|
||||||
const MCSection *ReadOnlySection =
|
MCSection *ReadOnlySection =
|
||||||
getObjFileLowering().getSectionForConstant(SectionKind::getReadOnly(),
|
getObjFileLowering().getSectionForConstant(SectionKind::getReadOnly(),
|
||||||
/*C=*/nullptr);
|
/*C=*/nullptr);
|
||||||
OutStreamer->SwitchSection(ReadOnlySection);
|
OutStreamer->SwitchSection(ReadOnlySection);
|
||||||
@ -1140,7 +1139,7 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
// to be executable. Some targets have a directive to declare this.
|
// to be executable. Some targets have a directive to declare this.
|
||||||
Function *InitTrampolineIntrinsic = M.getFunction("llvm.init.trampoline");
|
Function *InitTrampolineIntrinsic = M.getFunction("llvm.init.trampoline");
|
||||||
if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty())
|
if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty())
|
||||||
if (const MCSection *S = MAI->getNonexecutableStackSection(OutContext))
|
if (MCSection *S = MAI->getNonexecutableStackSection(OutContext))
|
||||||
OutStreamer->SwitchSection(S);
|
OutStreamer->SwitchSection(S);
|
||||||
|
|
||||||
// Allow the target to emit any magic that it wants at the end of the file,
|
// Allow the target to emit any magic that it wants at the end of the file,
|
||||||
@ -1182,12 +1181,12 @@ void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// SectionCPs - Keep track the alignment, constpool entries per Section.
|
// Keep track the alignment, constpool entries per Section.
|
||||||
struct SectionCPs {
|
struct SectionCPs {
|
||||||
const MCSection *S;
|
MCSection *S;
|
||||||
unsigned Alignment;
|
unsigned Alignment;
|
||||||
SmallVector<unsigned, 4> CPEs;
|
SmallVector<unsigned, 4> CPEs;
|
||||||
SectionCPs(const MCSection *s, unsigned a) : S(s), Alignment(a) {}
|
SectionCPs(MCSection *s, unsigned a) : S(s), Alignment(a) {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1215,7 +1214,7 @@ void AsmPrinter::EmitConstantPool() {
|
|||||||
if (!CPE.isMachineConstantPoolEntry())
|
if (!CPE.isMachineConstantPoolEntry())
|
||||||
C = CPE.Val.ConstVal;
|
C = CPE.Val.ConstVal;
|
||||||
|
|
||||||
const MCSection *S = getObjFileLowering().getSectionForConstant(Kind, C);
|
MCSection *S = getObjFileLowering().getSectionForConstant(Kind, C);
|
||||||
|
|
||||||
// The number of sections are small, just do a linear search from the
|
// The number of sections are small, just do a linear search from the
|
||||||
// last section to the first.
|
// last section to the first.
|
||||||
@ -1294,8 +1293,7 @@ void AsmPrinter::EmitJumpTableInfo() {
|
|||||||
*F);
|
*F);
|
||||||
if (JTInDiffSection) {
|
if (JTInDiffSection) {
|
||||||
// Drop it in the readonly section.
|
// Drop it in the readonly section.
|
||||||
const MCSection *ReadOnlySection =
|
MCSection *ReadOnlySection = TLOF.getSectionForJumpTable(*F, *Mang, TM);
|
||||||
TLOF.getSectionForJumpTable(*F, *Mang, TM);
|
|
||||||
OutStreamer->SwitchSection(ReadOnlySection);
|
OutStreamer->SwitchSection(ReadOnlySection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1539,7 +1537,7 @@ void AsmPrinter::EmitXXStructorList(const Constant *List, bool isCtor) {
|
|||||||
|
|
||||||
KeySym = getSymbol(GV);
|
KeySym = getSymbol(GV);
|
||||||
}
|
}
|
||||||
const MCSection *OutputSection =
|
MCSection *OutputSection =
|
||||||
(isCtor ? Obj.getStaticCtorSection(S.Priority, KeySym)
|
(isCtor ? Obj.getStaticCtorSection(S.Priority, KeySym)
|
||||||
: Obj.getStaticDtorSection(S.Priority, KeySym));
|
: Obj.getStaticDtorSection(S.Priority, KeySym));
|
||||||
OutStreamer->SwitchSection(OutputSection);
|
OutStreamer->SwitchSection(OutputSection);
|
||||||
|
@ -1285,7 +1285,7 @@ void DwarfDebug::emitAbbreviations() {
|
|||||||
Holder.emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection());
|
Holder.emitAbbrevs(Asm->getObjFileLowering().getDwarfAbbrevSection());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DwarfDebug::emitAccel(DwarfAccelTable &Accel, const MCSection *Section,
|
void DwarfDebug::emitAccel(DwarfAccelTable &Accel, MCSection *Section,
|
||||||
StringRef TableName) {
|
StringRef TableName) {
|
||||||
Accel.FinalizeTable(Asm, TableName);
|
Accel.FinalizeTable(Asm, TableName);
|
||||||
Asm->OutStreamer->SwitchSection(Section);
|
Asm->OutStreamer->SwitchSection(Section);
|
||||||
@ -1379,16 +1379,16 @@ static dwarf::PubIndexEntryDescriptor computeIndexValue(DwarfUnit *CU,
|
|||||||
/// emitDebugPubNames - Emit visible names into a debug pubnames section.
|
/// emitDebugPubNames - Emit visible names into a debug pubnames section.
|
||||||
///
|
///
|
||||||
void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
|
void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
|
||||||
const MCSection *PSec =
|
MCSection *PSec = GnuStyle
|
||||||
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
|
? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
|
||||||
: Asm->getObjFileLowering().getDwarfPubNamesSection();
|
: Asm->getObjFileLowering().getDwarfPubNamesSection();
|
||||||
|
|
||||||
emitDebugPubSection(GnuStyle, PSec, "Names",
|
emitDebugPubSection(GnuStyle, PSec, "Names",
|
||||||
&DwarfCompileUnit::getGlobalNames);
|
&DwarfCompileUnit::getGlobalNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DwarfDebug::emitDebugPubSection(
|
void DwarfDebug::emitDebugPubSection(
|
||||||
bool GnuStyle, const MCSection *PSec, StringRef Name,
|
bool GnuStyle, MCSection *PSec, StringRef Name,
|
||||||
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const) {
|
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const) {
|
||||||
for (const auto &NU : CUMap) {
|
for (const auto &NU : CUMap) {
|
||||||
DwarfCompileUnit *TheU = NU.second;
|
DwarfCompileUnit *TheU = NU.second;
|
||||||
@ -1448,9 +1448,9 @@ void DwarfDebug::emitDebugPubSection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
|
void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
|
||||||
const MCSection *PSec =
|
MCSection *PSec = GnuStyle
|
||||||
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
|
? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
|
||||||
: Asm->getObjFileLowering().getDwarfPubTypesSection();
|
: Asm->getObjFileLowering().getDwarfPubTypesSection();
|
||||||
|
|
||||||
emitDebugPubSection(GnuStyle, PSec, "Types",
|
emitDebugPubSection(GnuStyle, PSec, "Types",
|
||||||
&DwarfCompileUnit::getGlobalTypes);
|
&DwarfCompileUnit::getGlobalTypes);
|
||||||
@ -1611,13 +1611,13 @@ struct ArangeSpan {
|
|||||||
// address we can tie back to a CU.
|
// address we can tie back to a CU.
|
||||||
void DwarfDebug::emitDebugARanges() {
|
void DwarfDebug::emitDebugARanges() {
|
||||||
// Provides a unique id per text section.
|
// Provides a unique id per text section.
|
||||||
MapVector<const MCSection *, SmallVector<SymbolCU, 8>> SectionMap;
|
MapVector<MCSection *, SmallVector<SymbolCU, 8>> SectionMap;
|
||||||
|
|
||||||
// Filter labels by section.
|
// Filter labels by section.
|
||||||
for (const SymbolCU &SCU : ArangeLabels) {
|
for (const SymbolCU &SCU : ArangeLabels) {
|
||||||
if (SCU.Sym->isInSection()) {
|
if (SCU.Sym->isInSection()) {
|
||||||
// Make a note of this symbol and it's section.
|
// Make a note of this symbol and it's section.
|
||||||
const MCSection *Section = &SCU.Sym->getSection();
|
MCSection *Section = &SCU.Sym->getSection();
|
||||||
if (!Section->getKind().isMetadata())
|
if (!Section->getKind().isMetadata())
|
||||||
SectionMap[Section].push_back(SCU);
|
SectionMap[Section].push_back(SCU);
|
||||||
} else {
|
} else {
|
||||||
@ -1630,7 +1630,7 @@ void DwarfDebug::emitDebugARanges() {
|
|||||||
|
|
||||||
// Add terminating symbols for each section.
|
// Add terminating symbols for each section.
|
||||||
for (const auto &I : SectionMap) {
|
for (const auto &I : SectionMap) {
|
||||||
const MCSection *Section = I.first;
|
MCSection *Section = I.first;
|
||||||
MCSymbol *Sym = nullptr;
|
MCSymbol *Sym = nullptr;
|
||||||
|
|
||||||
if (Section)
|
if (Section)
|
||||||
@ -1873,8 +1873,7 @@ void DwarfDebug::emitDebugLineDWO() {
|
|||||||
// sections.
|
// sections.
|
||||||
void DwarfDebug::emitDebugStrDWO() {
|
void DwarfDebug::emitDebugStrDWO() {
|
||||||
assert(useSplitDwarf() && "No split dwarf?");
|
assert(useSplitDwarf() && "No split dwarf?");
|
||||||
const MCSection *OffSec =
|
MCSection *OffSec = Asm->getObjFileLowering().getDwarfStrOffDWOSection();
|
||||||
Asm->getObjFileLowering().getDwarfStrOffDWOSection();
|
|
||||||
InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(),
|
InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(),
|
||||||
OffSec);
|
OffSec);
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ class DwarfDebug : public AsmPrinterHandler {
|
|||||||
void emitAbbreviations();
|
void emitAbbreviations();
|
||||||
|
|
||||||
/// \brief Emit a specified accelerator table.
|
/// \brief Emit a specified accelerator table.
|
||||||
void emitAccel(DwarfAccelTable &Accel, const MCSection *Section,
|
void emitAccel(DwarfAccelTable &Accel, MCSection *Section,
|
||||||
StringRef TableName);
|
StringRef TableName);
|
||||||
|
|
||||||
/// \brief Emit visible names into a hashed accelerator table section.
|
/// \brief Emit visible names into a hashed accelerator table section.
|
||||||
@ -400,7 +400,7 @@ class DwarfDebug : public AsmPrinterHandler {
|
|||||||
void emitDebugPubTypes(bool GnuStyle = false);
|
void emitDebugPubTypes(bool GnuStyle = false);
|
||||||
|
|
||||||
void emitDebugPubSection(
|
void emitDebugPubSection(
|
||||||
bool GnuStyle, const MCSection *PSec, StringRef Name,
|
bool GnuStyle, MCSection *PSec, StringRef Name,
|
||||||
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const);
|
const StringMap<const DIE *> &(DwarfCompileUnit::*Accessor)() const);
|
||||||
|
|
||||||
/// \brief Emit visible names into a debug str section.
|
/// \brief Emit visible names into a debug str section.
|
||||||
|
@ -50,7 +50,7 @@ void DwarfFile::addUnit(std::unique_ptr<DwarfUnit> U) {
|
|||||||
void DwarfFile::emitUnits(bool UseOffsets) {
|
void DwarfFile::emitUnits(bool UseOffsets) {
|
||||||
for (const auto &TheU : CUs) {
|
for (const auto &TheU : CUs) {
|
||||||
DIE &Die = TheU->getUnitDie();
|
DIE &Die = TheU->getUnitDie();
|
||||||
const MCSection *USection = TheU->getSection();
|
MCSection *USection = TheU->getSection();
|
||||||
Asm->OutStreamer->SwitchSection(USection);
|
Asm->OutStreamer->SwitchSection(USection);
|
||||||
|
|
||||||
TheU->emitHeader(UseOffsets);
|
TheU->emitHeader(UseOffsets);
|
||||||
@ -120,7 +120,7 @@ unsigned DwarfFile::computeSizeAndOffset(DIE &Die, unsigned Offset) {
|
|||||||
return Offset;
|
return Offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DwarfFile::emitAbbrevs(const MCSection *Section) {
|
void DwarfFile::emitAbbrevs(MCSection *Section) {
|
||||||
// Check to see if it is worth the effort.
|
// Check to see if it is worth the effort.
|
||||||
if (!Abbreviations.empty()) {
|
if (!Abbreviations.empty()) {
|
||||||
// Start the debug abbrev section.
|
// Start the debug abbrev section.
|
||||||
@ -130,8 +130,7 @@ void DwarfFile::emitAbbrevs(const MCSection *Section) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit strings into a string section.
|
// Emit strings into a string section.
|
||||||
void DwarfFile::emitStrings(const MCSection *StrSection,
|
void DwarfFile::emitStrings(MCSection *StrSection, MCSection *OffsetSection) {
|
||||||
const MCSection *OffsetSection) {
|
|
||||||
StrPool.emit(*Asm, StrSection, OffsetSection);
|
StrPool.emit(*Asm, StrSection, OffsetSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,11 +82,10 @@ public:
|
|||||||
void emitUnits(bool UseOffsets);
|
void emitUnits(bool UseOffsets);
|
||||||
|
|
||||||
/// \brief Emit a set of abbreviations to the specific section.
|
/// \brief Emit a set of abbreviations to the specific section.
|
||||||
void emitAbbrevs(const MCSection *);
|
void emitAbbrevs(MCSection *);
|
||||||
|
|
||||||
/// \brief Emit all of the strings to the section given.
|
/// \brief Emit all of the strings to the section given.
|
||||||
void emitStrings(const MCSection *StrSection,
|
void emitStrings(MCSection *StrSection, MCSection *OffsetSection = nullptr);
|
||||||
const MCSection *OffsetSection = nullptr);
|
|
||||||
|
|
||||||
/// \brief Returns the string pool.
|
/// \brief Returns the string pool.
|
||||||
DwarfStringPool &getStringPool() { return StrPool; }
|
DwarfStringPool &getStringPool() { return StrPool; }
|
||||||
|
@ -32,8 +32,8 @@ unsigned DwarfStringPool::getIndex(AsmPrinter &Asm, StringRef Str) {
|
|||||||
return getEntry(Asm, Pool, Prefix, Str).second;
|
return getEntry(Asm, Pool, Prefix, Str).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DwarfStringPool::emit(AsmPrinter &Asm, const MCSection *StrSection,
|
void DwarfStringPool::emit(AsmPrinter &Asm, MCSection *StrSection,
|
||||||
const MCSection *OffsetSection) {
|
MCSection *OffsetSection) {
|
||||||
if (Pool.empty())
|
if (Pool.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ public:
|
|||||||
DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix)
|
DwarfStringPool(BumpPtrAllocator &A, AsmPrinter &Asm, StringRef Prefix)
|
||||||
: Pool(A), Prefix(Prefix) {}
|
: Pool(A), Prefix(Prefix) {}
|
||||||
|
|
||||||
void emit(AsmPrinter &Asm, const MCSection *StrSection,
|
void emit(AsmPrinter &Asm, MCSection *StrSection,
|
||||||
const MCSection *OffsetSection = nullptr);
|
MCSection *OffsetSection = nullptr);
|
||||||
|
|
||||||
/// \brief Returns an entry into the string pool with the given
|
/// \brief Returns an entry into the string pool with the given
|
||||||
/// string text.
|
/// string text.
|
||||||
|
@ -1513,7 +1513,7 @@ void DwarfUnit::emitHeader(bool UseOffsets) {
|
|||||||
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
|
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DwarfUnit::initSection(const MCSection *Section) {
|
void DwarfUnit::initSection(MCSection *Section) {
|
||||||
assert(!this->Section);
|
assert(!this->Section);
|
||||||
this->Section = Section;
|
this->Section = Section;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ protected:
|
|||||||
DIEInteger *DIEIntegerOne;
|
DIEInteger *DIEIntegerOne;
|
||||||
|
|
||||||
/// The section this unit will be emitted in.
|
/// The section this unit will be emitted in.
|
||||||
const MCSection *Section;
|
MCSection *Section;
|
||||||
|
|
||||||
DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A,
|
DwarfUnit(unsigned UID, dwarf::Tag, const DICompileUnit *CU, AsmPrinter *A,
|
||||||
DwarfDebug *DW, DwarfFile *DWU);
|
DwarfDebug *DW, DwarfFile *DWU);
|
||||||
@ -132,9 +132,9 @@ protected:
|
|||||||
public:
|
public:
|
||||||
virtual ~DwarfUnit();
|
virtual ~DwarfUnit();
|
||||||
|
|
||||||
void initSection(const MCSection *Section);
|
void initSection(MCSection *Section);
|
||||||
|
|
||||||
const MCSection *getSection() const {
|
MCSection *getSection() const {
|
||||||
assert(Section);
|
assert(Section);
|
||||||
return Section;
|
return Section;
|
||||||
}
|
}
|
||||||
|
@ -388,7 +388,7 @@ void EHStreamer::emitExceptionTable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Type infos.
|
// Type infos.
|
||||||
const MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();
|
MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();
|
||||||
unsigned TTypeEncoding;
|
unsigned TTypeEncoding;
|
||||||
unsigned TypeFormatSize;
|
unsigned TypeFormatSize;
|
||||||
|
|
||||||
|
@ -524,8 +524,8 @@ void StackMaps::serializeToStackMapSection() {
|
|||||||
MCStreamer &OS = *AP.OutStreamer;
|
MCStreamer &OS = *AP.OutStreamer;
|
||||||
|
|
||||||
// Create the section.
|
// Create the section.
|
||||||
const MCSection *StackMapSection =
|
MCSection *StackMapSection =
|
||||||
OutContext.getObjectFileInfo()->getStackMapSection();
|
OutContext.getObjectFileInfo()->getStackMapSection();
|
||||||
OS.SwitchSection(StackMapSection);
|
OS.SwitchSection(StackMapSection);
|
||||||
|
|
||||||
// Emit a dummy symbol to force section inclusion.
|
// Emit a dummy symbol to force section inclusion.
|
||||||
|
@ -69,10 +69,8 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(MCStreamer &Streamer,
|
|||||||
StringRef Prefix = ".data.";
|
StringRef Prefix = ".data.";
|
||||||
NameData.insert(NameData.begin(), Prefix.begin(), Prefix.end());
|
NameData.insert(NameData.begin(), Prefix.begin(), Prefix.end());
|
||||||
unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::SHF_GROUP;
|
unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::SHF_GROUP;
|
||||||
const MCSection *Sec = getContext().getELFSection(NameData,
|
MCSection *Sec = getContext().getELFSection(NameData, ELF::SHT_PROGBITS,
|
||||||
ELF::SHT_PROGBITS,
|
Flags, 0, Label->getName());
|
||||||
Flags,
|
|
||||||
0, Label->getName());
|
|
||||||
unsigned Size = TM.getDataLayout()->getPointerSize();
|
unsigned Size = TM.getDataLayout()->getPointerSize();
|
||||||
Streamer.SwitchSection(Sec);
|
Streamer.SwitchSection(Sec);
|
||||||
Streamer.EmitValueToAlignment(TM.getDataLayout()->getPointerABIAlignment());
|
Streamer.EmitValueToAlignment(TM.getDataLayout()->getPointerABIAlignment());
|
||||||
@ -201,7 +199,7 @@ static const Comdat *getELFComdat(const GlobalValue *GV) {
|
|||||||
return C;
|
return C;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
|
MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
|
||||||
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
StringRef SectionName = GV->getSection();
|
StringRef SectionName = GV->getSection();
|
||||||
@ -245,7 +243,7 @@ static StringRef getSectionPrefixForGlobal(SectionKind Kind) {
|
|||||||
return ".data.rel.ro";
|
return ".data.rel.ro";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const MCSectionELF *
|
static MCSectionELF *
|
||||||
selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV,
|
selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV,
|
||||||
SectionKind Kind, Mangler &Mang,
|
SectionKind Kind, Mangler &Mang,
|
||||||
const TargetMachine &TM, bool EmitUniqueSection,
|
const TargetMachine &TM, bool EmitUniqueSection,
|
||||||
@ -308,7 +306,7 @@ selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV,
|
|||||||
EntrySize, Group, UniqueID);
|
EntrySize, Group, UniqueID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
|
MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
|
||||||
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
unsigned Flags = getELFSectionFlags(Kind);
|
unsigned Flags = getELFSectionFlags(Kind);
|
||||||
@ -328,7 +326,7 @@ const MCSection *TargetLoweringObjectFileELF::SelectSectionForGlobal(
|
|||||||
EmitUniqueSection, Flags, &NextUniqueID);
|
EmitUniqueSection, Flags, &NextUniqueID);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
|
MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
|
||||||
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
|
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
|
||||||
// If the function can be removed, produce a unique section so that
|
// If the function can be removed, produce a unique section so that
|
||||||
// the table doesn't prevent the removal.
|
// the table doesn't prevent the removal.
|
||||||
@ -349,10 +347,9 @@ bool TargetLoweringObjectFileELF::shouldPutJumpTableInFunctionSection(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getSectionForConstant - Given a mergeable constant with the
|
/// Given a mergeable constant with the specified size and relocation
|
||||||
/// specified size and relocation information, return a section that it
|
/// information, return a section that it should be placed in.
|
||||||
/// should be placed in.
|
MCSection *
|
||||||
const MCSection *
|
|
||||||
TargetLoweringObjectFileELF::getSectionForConstant(SectionKind Kind,
|
TargetLoweringObjectFileELF::getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const {
|
const Constant *C) const {
|
||||||
if (Kind.isMergeableConst4() && MergeableConst4Section)
|
if (Kind.isMergeableConst4() && MergeableConst4Section)
|
||||||
@ -369,11 +366,9 @@ TargetLoweringObjectFileELF::getSectionForConstant(SectionKind Kind,
|
|||||||
return DataRelROSection;
|
return DataRelROSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const MCSectionELF *getStaticStructorSection(MCContext &Ctx,
|
static MCSectionELF *getStaticStructorSection(MCContext &Ctx, bool UseInitArray,
|
||||||
bool UseInitArray,
|
bool IsCtor, unsigned Priority,
|
||||||
bool IsCtor,
|
const MCSymbol *KeySym) {
|
||||||
unsigned Priority,
|
|
||||||
const MCSymbol *KeySym) {
|
|
||||||
std::string Name;
|
std::string Name;
|
||||||
unsigned Type;
|
unsigned Type;
|
||||||
unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE;
|
unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE;
|
||||||
@ -411,13 +406,13 @@ static const MCSectionELF *getStaticStructorSection(MCContext &Ctx,
|
|||||||
return Ctx.getELFSection(Name, Type, Flags, 0, COMDAT);
|
return Ctx.getELFSection(Name, Type, Flags, 0, COMDAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileELF::getStaticCtorSection(
|
MCSection *TargetLoweringObjectFileELF::getStaticCtorSection(
|
||||||
unsigned Priority, const MCSymbol *KeySym) const {
|
unsigned Priority, const MCSymbol *KeySym) const {
|
||||||
return getStaticStructorSection(getContext(), UseInitArray, true, Priority,
|
return getStaticStructorSection(getContext(), UseInitArray, true, Priority,
|
||||||
KeySym);
|
KeySym);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileELF::getStaticDtorSection(
|
MCSection *TargetLoweringObjectFileELF::getStaticDtorSection(
|
||||||
unsigned Priority, const MCSymbol *KeySym) const {
|
unsigned Priority, const MCSymbol *KeySym) const {
|
||||||
return getStaticStructorSection(getContext(), UseInitArray, false, Priority,
|
return getStaticStructorSection(getContext(), UseInitArray, false, Priority,
|
||||||
KeySym);
|
KeySym);
|
||||||
@ -520,9 +515,8 @@ emitModuleFlags(MCStreamer &Streamer,
|
|||||||
ErrorCode + ".");
|
ErrorCode + ".");
|
||||||
|
|
||||||
// Get the section.
|
// Get the section.
|
||||||
const MCSectionMachO *S =
|
MCSectionMachO *S = getContext().getMachOSection(
|
||||||
getContext().getMachOSection(Segment, Section, TAA, StubSize,
|
Segment, Section, TAA, StubSize, SectionKind::getDataNoRel());
|
||||||
SectionKind::getDataNoRel());
|
|
||||||
Streamer.SwitchSection(S);
|
Streamer.SwitchSection(S);
|
||||||
Streamer.EmitLabel(getContext().
|
Streamer.EmitLabel(getContext().
|
||||||
getOrCreateSymbol(StringRef("L_OBJC_IMAGE_INFO")));
|
getOrCreateSymbol(StringRef("L_OBJC_IMAGE_INFO")));
|
||||||
@ -540,7 +534,7 @@ static void checkMachOComdat(const GlobalValue *GV) {
|
|||||||
"' cannot be lowered.");
|
"' cannot be lowered.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
|
MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
|
||||||
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
// Parse the section specifier and create it if valid.
|
// Parse the section specifier and create it if valid.
|
||||||
@ -561,8 +555,8 @@ const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the section.
|
// Get the section.
|
||||||
const MCSectionMachO *S =
|
MCSectionMachO *S =
|
||||||
getContext().getMachOSection(Segment, Section, TAA, StubSize, Kind);
|
getContext().getMachOSection(Segment, Section, TAA, StubSize, Kind);
|
||||||
|
|
||||||
// If TAA wasn't set by ParseSectionSpecifier() above,
|
// If TAA wasn't set by ParseSectionSpecifier() above,
|
||||||
// use the value returned by getMachOSection() as a default.
|
// use the value returned by getMachOSection() as a default.
|
||||||
@ -582,9 +576,9 @@ const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
|
|||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileMachO::
|
MCSection *TargetLoweringObjectFileMachO::SelectSectionForGlobal(
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
||||||
Mangler &Mang, const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
checkMachOComdat(GV);
|
checkMachOComdat(GV);
|
||||||
|
|
||||||
// Handle thread local data.
|
// Handle thread local data.
|
||||||
@ -649,7 +643,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
|||||||
return DataSection;
|
return DataSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *
|
MCSection *
|
||||||
TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind,
|
TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const {
|
const Constant *C) const {
|
||||||
// If this constant requires a relocation, we have to put it in the data
|
// If this constant requires a relocation, we have to put it in the data
|
||||||
@ -861,7 +855,7 @@ static int getSelectionForCOFF(const GlobalValue *GV) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
|
MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
|
||||||
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
int Selection = 0;
|
int Selection = 0;
|
||||||
@ -903,10 +897,9 @@ static const char *getCOFFSectionNameForUniqueGlobal(SectionKind Kind) {
|
|||||||
return ".data";
|
return ".data";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MCSection *TargetLoweringObjectFileCOFF::SelectSectionForGlobal(
|
||||||
const MCSection *TargetLoweringObjectFileCOFF::
|
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
const TargetMachine &TM) const {
|
||||||
Mangler &Mang, const TargetMachine &TM) const {
|
|
||||||
// If we have -ffunction-sections then we should emit the global value to a
|
// If we have -ffunction-sections then we should emit the global value to a
|
||||||
// uniqued section specifically for it.
|
// uniqued section specifically for it.
|
||||||
bool EmitUniquedSection;
|
bool EmitUniquedSection;
|
||||||
@ -971,7 +964,7 @@ void TargetLoweringObjectFileCOFF::getNameWithPrefix(
|
|||||||
Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
|
Mang.getNameWithPrefix(OutName, GV, CannotUsePrivateLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
|
MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable(
|
||||||
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
|
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
|
||||||
// If the function can be removed, produce a unique section so that
|
// If the function can be removed, produce a unique section so that
|
||||||
// the table doesn't prevent the removal.
|
// the table doesn't prevent the removal.
|
||||||
@ -1026,7 +1019,7 @@ emitModuleFlags(MCStreamer &Streamer,
|
|||||||
|
|
||||||
// Emit the linker options to the linker .drectve section. According to the
|
// Emit the linker options to the linker .drectve section. According to the
|
||||||
// spec, this section is a space-separated string containing flags for linker.
|
// spec, this section is a space-separated string containing flags for linker.
|
||||||
const MCSection *Sec = getDrectveSection();
|
MCSection *Sec = getDrectveSection();
|
||||||
Streamer.SwitchSection(Sec);
|
Streamer.SwitchSection(Sec);
|
||||||
for (unsigned i = 0, e = LinkerOptions->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = LinkerOptions->getNumOperands(); i != e; ++i) {
|
||||||
MDNode *MDOptions = cast<MDNode>(LinkerOptions->getOperand(i));
|
MDNode *MDOptions = cast<MDNode>(LinkerOptions->getOperand(i));
|
||||||
@ -1040,13 +1033,13 @@ emitModuleFlags(MCStreamer &Streamer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileCOFF::getStaticCtorSection(
|
MCSection *TargetLoweringObjectFileCOFF::getStaticCtorSection(
|
||||||
unsigned Priority, const MCSymbol *KeySym) const {
|
unsigned Priority, const MCSymbol *KeySym) const {
|
||||||
return getContext().getAssociativeCOFFSection(
|
return getContext().getAssociativeCOFFSection(
|
||||||
cast<MCSectionCOFF>(StaticCtorSection), KeySym);
|
cast<MCSectionCOFF>(StaticCtorSection), KeySym);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFileCOFF::getStaticDtorSection(
|
MCSection *TargetLoweringObjectFileCOFF::getStaticDtorSection(
|
||||||
unsigned Priority, const MCSymbol *KeySym) const {
|
unsigned Priority, const MCSymbol *KeySym) const {
|
||||||
return getContext().getAssociativeCOFFSection(
|
return getContext().getAssociativeCOFFSection(
|
||||||
cast<MCSectionCOFF>(StaticDtorSection), KeySym);
|
cast<MCSectionCOFF>(StaticDtorSection), KeySym);
|
||||||
|
@ -48,8 +48,7 @@ bool ConstantPool::empty() { return Entries.empty(); }
|
|||||||
//
|
//
|
||||||
// AssemblerConstantPools implementation
|
// AssemblerConstantPools implementation
|
||||||
//
|
//
|
||||||
ConstantPool *
|
ConstantPool *AssemblerConstantPools::getConstantPool(MCSection *Section) {
|
||||||
AssemblerConstantPools::getConstantPool(const MCSection *Section) {
|
|
||||||
ConstantPoolMapTy::iterator CP = ConstantPools.find(Section);
|
ConstantPoolMapTy::iterator CP = ConstantPools.find(Section);
|
||||||
if (CP == ConstantPools.end())
|
if (CP == ConstantPools.end())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -58,11 +57,11 @@ AssemblerConstantPools::getConstantPool(const MCSection *Section) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConstantPool &
|
ConstantPool &
|
||||||
AssemblerConstantPools::getOrCreateConstantPool(const MCSection *Section) {
|
AssemblerConstantPools::getOrCreateConstantPool(MCSection *Section) {
|
||||||
return ConstantPools[Section];
|
return ConstantPools[Section];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void emitConstantPool(MCStreamer &Streamer, const MCSection *Section,
|
static void emitConstantPool(MCStreamer &Streamer, MCSection *Section,
|
||||||
ConstantPool &CP) {
|
ConstantPool &CP) {
|
||||||
if (!CP.empty()) {
|
if (!CP.empty()) {
|
||||||
Streamer.SwitchSection(Section);
|
Streamer.SwitchSection(Section);
|
||||||
@ -75,7 +74,7 @@ void AssemblerConstantPools::emitAll(MCStreamer &Streamer) {
|
|||||||
for (ConstantPoolMapTy::iterator CPI = ConstantPools.begin(),
|
for (ConstantPoolMapTy::iterator CPI = ConstantPools.begin(),
|
||||||
CPE = ConstantPools.end();
|
CPE = ConstantPools.end();
|
||||||
CPI != CPE; ++CPI) {
|
CPI != CPE; ++CPI) {
|
||||||
const MCSection *Section = CPI->first;
|
MCSection *Section = CPI->first;
|
||||||
ConstantPool &CP = CPI->second;
|
ConstantPool &CP = CPI->second;
|
||||||
|
|
||||||
emitConstantPool(Streamer, Section, CP);
|
emitConstantPool(Streamer, Section, CP);
|
||||||
@ -83,7 +82,7 @@ void AssemblerConstantPools::emitAll(MCStreamer &Streamer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
|
void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
|
||||||
const MCSection *Section = Streamer.getCurrentSection().first;
|
MCSection *Section = Streamer.getCurrentSection().first;
|
||||||
if (ConstantPool *CP = getConstantPool(Section)) {
|
if (ConstantPool *CP = getConstantPool(Section)) {
|
||||||
emitConstantPool(Streamer, Section, *CP);
|
emitConstantPool(Streamer, Section, *CP);
|
||||||
}
|
}
|
||||||
@ -92,7 +91,7 @@ void AssemblerConstantPools::emitForCurrentSection(MCStreamer &Streamer) {
|
|||||||
const MCExpr *AssemblerConstantPools::addEntry(MCStreamer &Streamer,
|
const MCExpr *AssemblerConstantPools::addEntry(MCStreamer &Streamer,
|
||||||
const MCExpr *Expr,
|
const MCExpr *Expr,
|
||||||
unsigned Size) {
|
unsigned Size) {
|
||||||
const MCSection *Section = Streamer.getCurrentSection().first;
|
MCSection *Section = Streamer.getCurrentSection().first;
|
||||||
return getOrCreateConstantPool(Section).addEntry(Expr, Streamer.getContext(),
|
return getOrCreateConstantPool(Section).addEntry(Expr, Streamer.getContext(),
|
||||||
Size);
|
Size);
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,8 @@ class ELFObjectWriter : public MCObjectWriter {
|
|||||||
unsigned ShstrtabIndex;
|
unsigned ShstrtabIndex;
|
||||||
|
|
||||||
// Sections in the order they are to be output in the section table.
|
// Sections in the order they are to be output in the section table.
|
||||||
std::vector<const MCSectionELF *> SectionTable;
|
std::vector<MCSectionELF *> SectionTable;
|
||||||
unsigned addToSectionTable(const MCSectionELF *Sec);
|
unsigned addToSectionTable(MCSectionELF *Sec);
|
||||||
|
|
||||||
// TargetObjectWriter wrappers.
|
// TargetObjectWriter wrappers.
|
||||||
bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
|
bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
|
||||||
@ -221,8 +221,8 @@ class ELFObjectWriter : public MCObjectWriter {
|
|||||||
const SectionIndexMapTy &SectionIndexMap,
|
const SectionIndexMapTy &SectionIndexMap,
|
||||||
const RevGroupMapTy &RevGroupMap);
|
const RevGroupMapTy &RevGroupMap);
|
||||||
|
|
||||||
const MCSectionELF *createRelocationSection(MCAssembler &Asm,
|
MCSectionELF *createRelocationSection(MCAssembler &Asm,
|
||||||
const MCSectionELF &Sec);
|
const MCSectionELF &Sec);
|
||||||
|
|
||||||
const MCSectionELF *createSectionHeaderStringTable();
|
const MCSectionELF *createSectionHeaderStringTable();
|
||||||
const MCSectionELF *createStringTable(MCContext &Ctx);
|
const MCSectionELF *createStringTable(MCContext &Ctx);
|
||||||
@ -261,7 +261,7 @@ class ELFObjectWriter : public MCObjectWriter {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned ELFObjectWriter::addToSectionTable(const MCSectionELF *Sec) {
|
unsigned ELFObjectWriter::addToSectionTable(MCSectionELF *Sec) {
|
||||||
SectionTable.push_back(Sec);
|
SectionTable.push_back(Sec);
|
||||||
ShStrTabBuilder.add(Sec->getSectionName());
|
ShStrTabBuilder.add(Sec->getSectionName());
|
||||||
return SectionTable.size();
|
return SectionTable.size();
|
||||||
@ -549,7 +549,7 @@ void ELFObjectWriter::WriteSymbolTable(MCAssembler &Asm,
|
|||||||
unsigned EntrySize = is64Bit() ? ELF::SYMENTRY_SIZE64 : ELF::SYMENTRY_SIZE32;
|
unsigned EntrySize = is64Bit() ? ELF::SYMENTRY_SIZE64 : ELF::SYMENTRY_SIZE32;
|
||||||
|
|
||||||
// Symbol table
|
// Symbol table
|
||||||
const MCSectionELF *SymtabSection =
|
MCSectionELF *SymtabSection =
|
||||||
Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0, EntrySize, "");
|
Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0, EntrySize, "");
|
||||||
MCSectionData &SymtabSD = Asm.getOrCreateSectionData(*SymtabSection);
|
MCSectionData &SymtabSD = Asm.getOrCreateSectionData(*SymtabSection);
|
||||||
SymtabSD.setAlignment(is64Bit() ? 8 : 4);
|
SymtabSD.setAlignment(is64Bit() ? 8 : 4);
|
||||||
@ -608,7 +608,7 @@ void ELFObjectWriter::WriteSymbolTable(MCAssembler &Asm,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SecStart = OS.tell();
|
SecStart = OS.tell();
|
||||||
const MCSectionELF *SymtabShndxSection =
|
MCSectionELF *SymtabShndxSection =
|
||||||
Ctx.getELFSection(".symtab_shndxr", ELF::SHT_SYMTAB_SHNDX, 0, 4, "");
|
Ctx.getELFSection(".symtab_shndxr", ELF::SHT_SYMTAB_SHNDX, 0, 4, "");
|
||||||
addToSectionTable(SymtabShndxSection);
|
addToSectionTable(SymtabShndxSection);
|
||||||
MCSectionData *SymtabShndxSD =
|
MCSectionData *SymtabShndxSD =
|
||||||
@ -1064,7 +1064,7 @@ void ELFObjectWriter::computeSymbolTable(
|
|||||||
UndefinedSymbolData[i].Symbol->getData().setIndex(Index++);
|
UndefinedSymbolData[i].Symbol->getData().setIndex(Index++);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *
|
MCSectionELF *
|
||||||
ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
|
ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
|
||||||
const MCSectionELF &Sec) {
|
const MCSectionELF &Sec) {
|
||||||
if (Relocations[&Sec].empty())
|
if (Relocations[&Sec].empty())
|
||||||
@ -1085,7 +1085,7 @@ ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
|
|||||||
if (Sec.getFlags() & ELF::SHF_GROUP)
|
if (Sec.getFlags() & ELF::SHF_GROUP)
|
||||||
Flags = ELF::SHF_GROUP;
|
Flags = ELF::SHF_GROUP;
|
||||||
|
|
||||||
const MCSectionELF *RelaSection = Ctx.createELFRelSection(
|
MCSectionELF *RelaSection = Ctx.createELFRelSection(
|
||||||
RelaSectionName, hasRelocationAddend() ? ELF::SHT_RELA : ELF::SHT_REL,
|
RelaSectionName, hasRelocationAddend() ? ELF::SHT_RELA : ELF::SHT_REL,
|
||||||
Flags, EntrySize, Sec.getGroup(), &Sec);
|
Flags, EntrySize, Sec.getGroup(), &Sec);
|
||||||
MCSectionData &RelSD = Asm.getOrCreateSectionData(*RelaSection);
|
MCSectionData &RelSD = Asm.getOrCreateSectionData(*RelaSection);
|
||||||
@ -1141,8 +1141,7 @@ prependCompressionHeader(uint64_t Size,
|
|||||||
void ELFObjectWriter::writeSectionData(const MCAssembler &Asm,
|
void ELFObjectWriter::writeSectionData(const MCAssembler &Asm,
|
||||||
const MCSectionData &SD,
|
const MCSectionData &SD,
|
||||||
const MCAsmLayout &Layout) {
|
const MCAsmLayout &Layout) {
|
||||||
const MCSectionELF &Section =
|
MCSectionELF &Section = static_cast<MCSectionELF &>(SD.getSection());
|
||||||
static_cast<const MCSectionELF &>(SD.getSection());
|
|
||||||
StringRef SectionName = Section.getSectionName();
|
StringRef SectionName = Section.getSectionName();
|
||||||
|
|
||||||
// Compressing debug_frame requires handling alignment fragments which is
|
// Compressing debug_frame requires handling alignment fragments which is
|
||||||
@ -1245,7 +1244,7 @@ const MCSectionELF *ELFObjectWriter::createSectionHeaderStringTable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *ELFObjectWriter::createStringTable(MCContext &Ctx) {
|
const MCSectionELF *ELFObjectWriter::createStringTable(MCContext &Ctx) {
|
||||||
const MCSectionELF *StrtabSection =
|
MCSectionELF *StrtabSection =
|
||||||
Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0);
|
Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0);
|
||||||
StringTableIndex = addToSectionTable(StrtabSection);
|
StringTableIndex = addToSectionTable(StrtabSection);
|
||||||
OS << StrTabBuilder.data();
|
OS << StrTabBuilder.data();
|
||||||
@ -1315,7 +1314,7 @@ void ELFObjectWriter::writeSectionHeader(
|
|||||||
(NumSections + 1) >= ELF::SHN_LORESERVE ? NumSections + 1 : 0;
|
(NumSections + 1) >= ELF::SHN_LORESERVE ? NumSections + 1 : 0;
|
||||||
WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, 0, 0);
|
WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, 0, 0);
|
||||||
|
|
||||||
for (const MCSectionELF *Section : SectionTable) {
|
for (MCSectionELF *Section : SectionTable) {
|
||||||
const MCSectionData &SD = Asm.getOrCreateSectionData(*Section);
|
const MCSectionData &SD = Asm.getOrCreateSectionData(*Section);
|
||||||
uint32_t GroupSymbolIndex;
|
uint32_t GroupSymbolIndex;
|
||||||
unsigned Type = Section->getType();
|
unsigned Type = Section->getType();
|
||||||
@ -1337,7 +1336,7 @@ void ELFObjectWriter::writeSectionHeader(
|
|||||||
void ELFObjectWriter::WriteObject(MCAssembler &Asm,
|
void ELFObjectWriter::WriteObject(MCAssembler &Asm,
|
||||||
const MCAsmLayout &Layout) {
|
const MCAsmLayout &Layout) {
|
||||||
MCContext &Ctx = Asm.getContext();
|
MCContext &Ctx = Asm.getContext();
|
||||||
const MCSectionELF *ShstrtabSection =
|
MCSectionELF *ShstrtabSection =
|
||||||
Ctx.getELFSection(".shstrtab", ELF::SHT_STRTAB, 0);
|
Ctx.getELFSection(".shstrtab", ELF::SHT_STRTAB, 0);
|
||||||
ShstrtabIndex = addToSectionTable(ShstrtabSection);
|
ShstrtabIndex = addToSectionTable(ShstrtabSection);
|
||||||
|
|
||||||
@ -1353,8 +1352,7 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
|
|||||||
SectionOffsetsTy SectionOffsets;
|
SectionOffsetsTy SectionOffsets;
|
||||||
bool ComputedSymtab = false;
|
bool ComputedSymtab = false;
|
||||||
for (const MCSectionData &SD : Asm) {
|
for (const MCSectionData &SD : Asm) {
|
||||||
const MCSectionELF &Section =
|
MCSectionELF &Section = static_cast<MCSectionELF &>(SD.getSection());
|
||||||
static_cast<const MCSectionELF &>(SD.getSection());
|
|
||||||
|
|
||||||
uint64_t Padding = OffsetToAlignment(OS.tell(), SD.getAlignment());
|
uint64_t Padding = OffsetToAlignment(OS.tell(), SD.getAlignment());
|
||||||
WriteZeros(Padding);
|
WriteZeros(Padding);
|
||||||
@ -1388,13 +1386,13 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
|
|||||||
if (Type == ELF::SHT_GROUP || Type == ELF::SHT_REL || Type == ELF::SHT_RELA)
|
if (Type == ELF::SHT_GROUP || Type == ELF::SHT_REL || Type == ELF::SHT_RELA)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const MCSectionELF *RelSection = createRelocationSection(Asm, Section);
|
MCSectionELF *RelSection = createRelocationSection(Asm, Section);
|
||||||
|
|
||||||
if (SignatureSymbol) {
|
if (SignatureSymbol) {
|
||||||
Asm.getOrCreateSymbolData(*SignatureSymbol);
|
Asm.getOrCreateSymbolData(*SignatureSymbol);
|
||||||
unsigned &GroupIdx = RevGroupMap[SignatureSymbol];
|
unsigned &GroupIdx = RevGroupMap[SignatureSymbol];
|
||||||
if (!GroupIdx) {
|
if (!GroupIdx) {
|
||||||
const MCSectionELF *Group = Ctx.createELFGroupSection(SignatureSymbol);
|
MCSectionELF *Group = Ctx.createELFGroupSection(SignatureSymbol);
|
||||||
GroupIdx = addToSectionTable(Group);
|
GroupIdx = addToSectionTable(Group);
|
||||||
MCSectionData *GroupD = &Asm.getOrCreateSectionData(*Group);
|
MCSectionData *GroupD = &Asm.getOrCreateSectionData(*Group);
|
||||||
GroupD->setAlignment(4);
|
GroupD->setAlignment(4);
|
||||||
|
@ -20,8 +20,7 @@ using namespace llvm;
|
|||||||
|
|
||||||
void MCAsmInfoELF::anchor() { }
|
void MCAsmInfoELF::anchor() { }
|
||||||
|
|
||||||
const MCSection *
|
MCSection *MCAsmInfoELF::getNonexecutableStackSection(MCContext &Ctx) const {
|
||||||
MCAsmInfoELF::getNonexecutableStackSection(MCContext &Ctx) const {
|
|
||||||
return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS, 0);
|
return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,8 +114,7 @@ public:
|
|||||||
/// @name MCStreamer Interface
|
/// @name MCStreamer Interface
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
void ChangeSection(const MCSection *Section,
|
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override;
|
||||||
const MCExpr *Subsection) override;
|
|
||||||
|
|
||||||
void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override;
|
void EmitLOHDirective(MCLOHType Kind, const MCLOHArgs &Args) override;
|
||||||
void EmitLabel(MCSymbol *Symbol) override;
|
void EmitLabel(MCSymbol *Symbol) override;
|
||||||
@ -150,11 +149,11 @@ public:
|
|||||||
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) override;
|
unsigned ByteAlignment) override;
|
||||||
|
|
||||||
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
|
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
|
||||||
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
|
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
|
||||||
|
|
||||||
void EmitTBSSSymbol (const MCSection *Section, MCSymbol *Symbol,
|
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
uint64_t Size, unsigned ByteAlignment = 0) override;
|
unsigned ByteAlignment = 0) override;
|
||||||
|
|
||||||
void EmitBytes(StringRef Data) override;
|
void EmitBytes(StringRef Data) override;
|
||||||
|
|
||||||
@ -297,7 +296,7 @@ void MCAsmStreamer::emitRawComment(const Twine &T, bool TabPrefix) {
|
|||||||
EmitEOL();
|
EmitEOL();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAsmStreamer::ChangeSection(const MCSection *Section,
|
void MCAsmStreamer::ChangeSection(MCSection *Section,
|
||||||
const MCExpr *Subsection) {
|
const MCExpr *Subsection) {
|
||||||
assert(Section && "Cannot switch to a null section!");
|
assert(Section && "Cannot switch to a null section!");
|
||||||
Section->PrintSwitchToSection(*MAI, OS, Subsection);
|
Section->PrintSwitchToSection(*MAI, OS, Subsection);
|
||||||
@ -542,7 +541,7 @@ void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
EmitEOL();
|
EmitEOL();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
|
void MCAsmStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, unsigned ByteAlignment) {
|
||||||
if (Symbol)
|
if (Symbol)
|
||||||
AssignSection(Symbol, Section);
|
AssignSection(Symbol, Section);
|
||||||
@ -565,7 +564,7 @@ void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
|
|||||||
// .tbss sym, size, align
|
// .tbss sym, size, align
|
||||||
// This depends that the symbol has already been mangled from the original,
|
// This depends that the symbol has already been mangled from the original,
|
||||||
// e.g. _a.
|
// e.g. _a.
|
||||||
void MCAsmStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
void MCAsmStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, unsigned ByteAlignment) {
|
||||||
AssignSection(Symbol, Section);
|
AssignSection(Symbol, Section);
|
||||||
|
|
||||||
@ -1102,7 +1101,7 @@ void MCAsmStreamer::EmitWinEHHandlerData() {
|
|||||||
// We only do this so the section switch that terminates the handler
|
// We only do this so the section switch that terminates the handler
|
||||||
// data block is visible.
|
// data block is visible.
|
||||||
WinEH::FrameInfo *CurFrame = getCurrentWinFrameInfo();
|
WinEH::FrameInfo *CurFrame = getCurrentWinFrameInfo();
|
||||||
if (const MCSection *XData = WinEH::UnwindEmitter::getXDataSection(
|
if (MCSection *XData = WinEH::UnwindEmitter::getXDataSection(
|
||||||
CurFrame->Function, getContext()))
|
CurFrame->Function, getContext()))
|
||||||
SwitchSectionNoChange(XData);
|
SwitchSectionNoChange(XData);
|
||||||
|
|
||||||
|
@ -292,14 +292,20 @@ MCEncodedFragmentWithFixups::~MCEncodedFragmentWithFixups() {
|
|||||||
|
|
||||||
MCSectionData::MCSectionData() : Section(nullptr) {}
|
MCSectionData::MCSectionData() : Section(nullptr) {}
|
||||||
|
|
||||||
MCSectionData::MCSectionData(const MCSection &Section, MCAssembler *A)
|
MCSectionData::MCSectionData(MCSection &Section, MCAssembler *A)
|
||||||
: Section(&Section), Ordinal(~UINT32_C(0)), Alignment(1),
|
: Section(&Section), Ordinal(~UINT32_C(0)),
|
||||||
BundleLockState(NotBundleLocked), BundleLockNestingDepth(0),
|
BundleLockState(NotBundleLocked), BundleLockNestingDepth(0),
|
||||||
BundleGroupBeforeFirstInst(false), HasInstructions(false) {
|
BundleGroupBeforeFirstInst(false), HasInstructions(false) {
|
||||||
if (A)
|
if (A)
|
||||||
A->getSectionList().push_back(this);
|
A->getSectionList().push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned MCSectionData::getAlignment() const { return Section->getAlignment(); }
|
||||||
|
|
||||||
|
void MCSectionData::setAlignment(unsigned Value) {
|
||||||
|
Section->setAlignment(Value);
|
||||||
|
}
|
||||||
|
|
||||||
MCSectionData::iterator
|
MCSectionData::iterator
|
||||||
MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {
|
MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {
|
||||||
if (Subsection == 0 && SubsectionFragmentMap.empty())
|
if (Subsection == 0 && SubsectionFragmentMap.empty())
|
||||||
|
@ -241,10 +241,10 @@ MCSymbol *MCContext::lookupSymbol(const Twine &Name) const {
|
|||||||
// Section Management
|
// Section Management
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
const MCSectionMachO *
|
MCSectionMachO *MCContext::getMachOSection(StringRef Segment, StringRef Section,
|
||||||
MCContext::getMachOSection(StringRef Segment, StringRef Section,
|
unsigned TypeAndAttributes,
|
||||||
unsigned TypeAndAttributes, unsigned Reserved2,
|
unsigned Reserved2, SectionKind Kind,
|
||||||
SectionKind Kind, const char *BeginSymName) {
|
const char *BeginSymName) {
|
||||||
|
|
||||||
// We unique sections by their segment/section pair. The returned section
|
// We unique sections by their segment/section pair. The returned section
|
||||||
// may not have the same flags as the requested section, if so this should be
|
// may not have the same flags as the requested section, if so this should be
|
||||||
@ -257,7 +257,7 @@ MCContext::getMachOSection(StringRef Segment, StringRef Section,
|
|||||||
Name += Section;
|
Name += Section;
|
||||||
|
|
||||||
// Do the lookup, if we have a hit, return it.
|
// Do the lookup, if we have a hit, return it.
|
||||||
const MCSectionMachO *&Entry = MachOUniquingMap[Name];
|
MCSectionMachO *&Entry = MachOUniquingMap[Name];
|
||||||
if (Entry)
|
if (Entry)
|
||||||
return Entry;
|
return Entry;
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ MCContext::getMachOSection(StringRef Segment, StringRef Section,
|
|||||||
Reserved2, Kind, Begin);
|
Reserved2, Kind, Begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) {
|
void MCContext::renameELFSection(MCSectionELF *Section, StringRef Name) {
|
||||||
StringRef GroupName;
|
StringRef GroupName;
|
||||||
if (const MCSymbol *Group = Section->getGroup())
|
if (const MCSymbol *Group = Section->getGroup())
|
||||||
GroupName = Group->getName();
|
GroupName = Group->getName();
|
||||||
@ -286,10 +286,10 @@ void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) {
|
|||||||
const_cast<MCSectionELF *>(Section)->setSectionName(CachedName);
|
const_cast<MCSectionELF *>(Section)->setSectionName(CachedName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *
|
MCSectionELF *MCContext::createELFRelSection(StringRef Name, unsigned Type,
|
||||||
MCContext::createELFRelSection(StringRef Name, unsigned Type, unsigned Flags,
|
unsigned Flags, unsigned EntrySize,
|
||||||
unsigned EntrySize, const MCSymbol *Group,
|
const MCSymbol *Group,
|
||||||
const MCSectionELF *Associated) {
|
const MCSectionELF *Associated) {
|
||||||
StringMap<bool>::iterator I;
|
StringMap<bool>::iterator I;
|
||||||
bool Inserted;
|
bool Inserted;
|
||||||
std::tie(I, Inserted) = ELFRelSecNames.insert(std::make_pair(Name, true));
|
std::tie(I, Inserted) = ELFRelSecNames.insert(std::make_pair(Name, true));
|
||||||
@ -299,10 +299,10 @@ MCContext::createELFRelSection(StringRef Name, unsigned Type, unsigned Flags,
|
|||||||
EntrySize, Group, true, nullptr, Associated);
|
EntrySize, Group, true, nullptr, Associated);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
|
MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
StringRef Group, unsigned UniqueID,
|
StringRef Group, unsigned UniqueID,
|
||||||
const char *BeginSymName) {
|
const char *BeginSymName) {
|
||||||
MCSymbol *GroupSym = nullptr;
|
MCSymbol *GroupSym = nullptr;
|
||||||
if (!Group.empty())
|
if (!Group.empty())
|
||||||
GroupSym = getOrCreateSymbol(Group);
|
GroupSym = getOrCreateSymbol(Group);
|
||||||
@ -311,12 +311,12 @@ const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
|
|||||||
BeginSymName, nullptr);
|
BeginSymName, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
|
MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
const MCSymbol *GroupSym,
|
const MCSymbol *GroupSym,
|
||||||
unsigned UniqueID,
|
unsigned UniqueID,
|
||||||
const char *BeginSymName,
|
const char *BeginSymName,
|
||||||
const MCSectionELF *Associated) {
|
const MCSectionELF *Associated) {
|
||||||
StringRef Group = "";
|
StringRef Group = "";
|
||||||
if (GroupSym)
|
if (GroupSym)
|
||||||
Group = GroupSym->getName();
|
Group = GroupSym->getName();
|
||||||
@ -346,17 +346,18 @@ const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionELF *MCContext::createELFGroupSection(const MCSymbol *Group) {
|
MCSectionELF *MCContext::createELFGroupSection(const MCSymbol *Group) {
|
||||||
MCSectionELF *Result = new (*this)
|
MCSectionELF *Result = new (*this)
|
||||||
MCSectionELF(".group", ELF::SHT_GROUP, 0, SectionKind::getReadOnly(), 4,
|
MCSectionELF(".group", ELF::SHT_GROUP, 0, SectionKind::getReadOnly(), 4,
|
||||||
Group, ~0, nullptr, nullptr);
|
Group, ~0, nullptr, nullptr);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionCOFF *
|
MCSectionCOFF *MCContext::getCOFFSection(StringRef Section,
|
||||||
MCContext::getCOFFSection(StringRef Section, unsigned Characteristics,
|
unsigned Characteristics,
|
||||||
SectionKind Kind, StringRef COMDATSymName,
|
SectionKind Kind,
|
||||||
int Selection, const char *BeginSymName) {
|
StringRef COMDATSymName, int Selection,
|
||||||
|
const char *BeginSymName) {
|
||||||
MCSymbol *COMDATSymbol = nullptr;
|
MCSymbol *COMDATSymbol = nullptr;
|
||||||
if (!COMDATSymName.empty()) {
|
if (!COMDATSymName.empty()) {
|
||||||
COMDATSymbol = getOrCreateSymbol(COMDATSymName);
|
COMDATSymbol = getOrCreateSymbol(COMDATSymName);
|
||||||
@ -382,14 +383,14 @@ MCContext::getCOFFSection(StringRef Section, unsigned Characteristics,
|
|||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionCOFF *MCContext::getCOFFSection(StringRef Section,
|
MCSectionCOFF *MCContext::getCOFFSection(StringRef Section,
|
||||||
unsigned Characteristics,
|
unsigned Characteristics,
|
||||||
SectionKind Kind,
|
SectionKind Kind,
|
||||||
const char *BeginSymName) {
|
const char *BeginSymName) {
|
||||||
return getCOFFSection(Section, Characteristics, Kind, "", 0, BeginSymName);
|
return getCOFFSection(Section, Characteristics, Kind, "", 0, BeginSymName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionCOFF *MCContext::getCOFFSection(StringRef Section) {
|
MCSectionCOFF *MCContext::getCOFFSection(StringRef Section) {
|
||||||
COFFSectionKey T{Section, "", 0};
|
COFFSectionKey T{Section, "", 0};
|
||||||
auto Iter = COFFUniquingMap.find(T);
|
auto Iter = COFFUniquingMap.find(T);
|
||||||
if (Iter == COFFUniquingMap.end())
|
if (Iter == COFFUniquingMap.end())
|
||||||
@ -397,9 +398,8 @@ const MCSectionCOFF *MCContext::getCOFFSection(StringRef Section) {
|
|||||||
return Iter->second;
|
return Iter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSectionCOFF *
|
MCSectionCOFF *MCContext::getAssociativeCOFFSection(MCSectionCOFF *Sec,
|
||||||
MCContext::getAssociativeCOFFSection(const MCSectionCOFF *Sec,
|
const MCSymbol *KeySym) {
|
||||||
const MCSymbol *KeySym) {
|
|
||||||
// Return the normal section if we don't have to be associative.
|
// Return the normal section if we don't have to be associative.
|
||||||
if (!KeySym)
|
if (!KeySym)
|
||||||
return Sec;
|
return Sec;
|
||||||
@ -440,8 +440,8 @@ bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
|
|||||||
/// Remove empty sections from SectionStartEndSyms, to avoid generating
|
/// Remove empty sections from SectionStartEndSyms, to avoid generating
|
||||||
/// useless debug info for them.
|
/// useless debug info for them.
|
||||||
void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
|
void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
|
||||||
std::vector<const MCSection *> Keep;
|
std::vector<MCSection *> Keep;
|
||||||
for (const MCSection *Sec : SectionsForRanges) {
|
for (MCSection *Sec : SectionsForRanges) {
|
||||||
if (MCOS.mayHaveInstructions(*Sec))
|
if (MCOS.mayHaveInstructions(*Sec))
|
||||||
Keep.push_back(Sec);
|
Keep.push_back(Sec);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ static inline uint64_t ScaleAddrDelta(MCContext &Context, uint64_t AddrDelta) {
|
|||||||
// and if there is information from the last .loc directive that has yet to have
|
// and if there is information from the last .loc directive that has yet to have
|
||||||
// a line entry made for it is made.
|
// a line entry made for it is made.
|
||||||
//
|
//
|
||||||
void MCLineEntry::Make(MCObjectStreamer *MCOS, const MCSection *Section) {
|
void MCLineEntry::Make(MCObjectStreamer *MCOS, MCSection *Section) {
|
||||||
if (!MCOS->getContext().getDwarfLocSeen())
|
if (!MCOS->getContext().getDwarfLocSeen())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ static inline const MCExpr *MakeStartMinusEndExpr(const MCStreamer &MCOS,
|
|||||||
// in the LineSection.
|
// in the LineSection.
|
||||||
//
|
//
|
||||||
static inline void
|
static inline void
|
||||||
EmitDwarfLineTable(MCObjectStreamer *MCOS, const MCSection *Section,
|
EmitDwarfLineTable(MCObjectStreamer *MCOS, MCSection *Section,
|
||||||
const MCLineSection::MCLineEntryCollection &LineEntries) {
|
const MCLineSection::MCLineEntryCollection &LineEntries) {
|
||||||
unsigned FileNum = 1;
|
unsigned FileNum = 1;
|
||||||
unsigned LastLine = 1;
|
unsigned LastLine = 1;
|
||||||
@ -610,8 +610,8 @@ static void EmitGenDwarfAranges(MCStreamer *MCOS,
|
|||||||
|
|
||||||
// Now emit the table of pairs of PointerSize'ed values for the section
|
// Now emit the table of pairs of PointerSize'ed values for the section
|
||||||
// addresses and sizes.
|
// addresses and sizes.
|
||||||
for (const MCSection *Sec : Sections) {
|
for (MCSection *Sec : Sections) {
|
||||||
MCSymbol *StartSymbol = Sec->getBeginSymbol();
|
const MCSymbol *StartSymbol = Sec->getBeginSymbol();
|
||||||
MCSymbol *EndSymbol = Sec->getEndSymbol(context);
|
MCSymbol *EndSymbol = Sec->getEndSymbol(context);
|
||||||
assert(StartSymbol && "StartSymbol must not be NULL");
|
assert(StartSymbol && "StartSymbol must not be NULL");
|
||||||
assert(EndSymbol && "EndSymbol must not be NULL");
|
assert(EndSymbol && "EndSymbol must not be NULL");
|
||||||
@ -805,8 +805,8 @@ static void EmitGenDwarfRanges(MCStreamer *MCOS) {
|
|||||||
|
|
||||||
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfRangesSection());
|
MCOS->SwitchSection(context.getObjectFileInfo()->getDwarfRangesSection());
|
||||||
|
|
||||||
for (const MCSection *Sec : Sections) {
|
for (MCSection *Sec : Sections) {
|
||||||
MCSymbol *StartSymbol = Sec->getBeginSymbol();
|
const MCSymbol *StartSymbol = Sec->getBeginSymbol();
|
||||||
MCSymbol *EndSymbol = Sec->getEndSymbol(context);
|
MCSymbol *EndSymbol = Sec->getEndSymbol(context);
|
||||||
assert(StartSymbol && "StartSymbol must not be NULL");
|
assert(StartSymbol && "StartSymbol must not be NULL");
|
||||||
assert(EndSymbol && "EndSymbol must not be NULL");
|
assert(EndSymbol && "EndSymbol must not be NULL");
|
||||||
@ -1520,9 +1520,9 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
|
|||||||
|
|
||||||
if (!NeedsEHFrameSection) return;
|
if (!NeedsEHFrameSection) return;
|
||||||
|
|
||||||
const MCSection &Section =
|
MCSection &Section =
|
||||||
IsEH ? *const_cast<MCObjectFileInfo*>(MOFI)->getEHFrameSection() :
|
IsEH ? *const_cast<MCObjectFileInfo *>(MOFI)->getEHFrameSection()
|
||||||
*MOFI->getDwarfFrameSection();
|
: *MOFI->getDwarfFrameSection();
|
||||||
|
|
||||||
Streamer.SwitchSection(&Section);
|
Streamer.SwitchSection(&Section);
|
||||||
MCSymbol *SectionStart = Context.createTempSymbol();
|
MCSymbol *SectionStart = Context.createTempSymbol();
|
||||||
|
@ -141,7 +141,7 @@ static void setSectionAlignmentForBundling(
|
|||||||
Section->setAlignment(Assembler.getBundleAlignSize());
|
Section->setAlignment(Assembler.getBundleAlignSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::ChangeSection(const MCSection *Section,
|
void MCELFStreamer::ChangeSection(MCSection *Section,
|
||||||
const MCExpr *Subsection) {
|
const MCExpr *Subsection) {
|
||||||
MCSectionData *CurSection = getCurrentSectionData();
|
MCSectionData *CurSection = getCurrentSectionData();
|
||||||
if (CurSection && CurSection->isBundleLocked())
|
if (CurSection && CurSection->isBundleLocked())
|
||||||
@ -314,7 +314,7 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
MCELF::SetType(SD, ELF::STT_OBJECT);
|
MCELF::SetType(SD, ELF::STT_OBJECT);
|
||||||
|
|
||||||
if (MCELF::GetBinding(SD) == ELF_STB_Local) {
|
if (MCELF::GetBinding(SD) == ELF_STB_Local) {
|
||||||
const MCSection *Section = getAssembler().getContext().getELFSection(
|
MCSection *Section = getAssembler().getContext().getELFSection(
|
||||||
".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
|
".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
|
||||||
|
|
||||||
AssignSection(Symbol, Section);
|
AssignSection(Symbol, Section);
|
||||||
@ -369,7 +369,7 @@ void MCELFStreamer::EmitFileDirective(StringRef Filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::EmitIdent(StringRef IdentString) {
|
void MCELFStreamer::EmitIdent(StringRef IdentString) {
|
||||||
const MCSection *Comment = getAssembler().getContext().getELFSection(
|
MCSection *Comment = getAssembler().getContext().getELFSection(
|
||||||
".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | ELF::SHF_STRINGS, 1, "");
|
".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | ELF::SHF_STRINGS, 1, "");
|
||||||
PushSection();
|
PushSection();
|
||||||
SwitchSection(Comment);
|
SwitchSection(Comment);
|
||||||
@ -633,7 +633,7 @@ void MCELFStreamer::Flush() {
|
|||||||
const MCSymbol &Symbol = *i->Symbol;
|
const MCSymbol &Symbol = *i->Symbol;
|
||||||
uint64_t Size = i->Size;
|
uint64_t Size = i->Size;
|
||||||
unsigned ByteAlignment = i->ByteAlignment;
|
unsigned ByteAlignment = i->ByteAlignment;
|
||||||
const MCSection &Section = Symbol.getSection();
|
MCSection &Section = Symbol.getSection();
|
||||||
|
|
||||||
MCSectionData &SectData = getAssembler().getOrCreateSectionData(Section);
|
MCSectionData &SectData = getAssembler().getOrCreateSectionData(Section);
|
||||||
new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment, &SectData);
|
new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment, &SectData);
|
||||||
@ -693,12 +693,12 @@ void MCELFStreamer::EndCOFFSymbolDef() {
|
|||||||
llvm_unreachable("ELF doesn't support this directive");
|
llvm_unreachable("ELF doesn't support this directive");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
|
void MCELFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, unsigned ByteAlignment) {
|
||||||
llvm_unreachable("ELF doesn't support this directive");
|
llvm_unreachable("ELF doesn't support this directive");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
void MCELFStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, unsigned ByteAlignment) {
|
||||||
llvm_unreachable("ELF doesn't support this directive");
|
llvm_unreachable("ELF doesn't support this directive");
|
||||||
}
|
}
|
||||||
|
@ -755,7 +755,7 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
|
|||||||
llvm_unreachable("Invalid assembly expression kind!");
|
llvm_unreachable("Invalid assembly expression kind!");
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *MCExpr::FindAssociatedSection() const {
|
MCSection *MCExpr::FindAssociatedSection() const {
|
||||||
switch (getKind()) {
|
switch (getKind()) {
|
||||||
case Target:
|
case Target:
|
||||||
// We never look through target specific expressions.
|
// We never look through target specific expressions.
|
||||||
@ -779,8 +779,8 @@ const MCSection *MCExpr::FindAssociatedSection() const {
|
|||||||
|
|
||||||
case Binary: {
|
case Binary: {
|
||||||
const MCBinaryExpr *BE = cast<MCBinaryExpr>(this);
|
const MCBinaryExpr *BE = cast<MCBinaryExpr>(this);
|
||||||
const MCSection *LHS_S = BE->getLHS()->FindAssociatedSection();
|
MCSection *LHS_S = BE->getLHS()->FindAssociatedSection();
|
||||||
const MCSection *RHS_S = BE->getRHS()->FindAssociatedSection();
|
MCSection *RHS_S = BE->getRHS()->FindAssociatedSection();
|
||||||
|
|
||||||
// If either section is absolute, return the other.
|
// If either section is absolute, return the other.
|
||||||
if (LHS_S == MCSymbol::AbsolutePseudoSection)
|
if (LHS_S == MCSymbol::AbsolutePseudoSection)
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
/// @name MCStreamer Interface
|
/// @name MCStreamer Interface
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
void ChangeSection(const MCSection *Sect, const MCExpr *Subsect) override;
|
void ChangeSection(MCSection *Sect, const MCExpr *Subsect) override;
|
||||||
void EmitLabel(MCSymbol *Symbol) override;
|
void EmitLabel(MCSymbol *Symbol) override;
|
||||||
void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol) override;
|
void EmitEHSymAttributes(const MCSymbol *Symbol, MCSymbol *EHSymbol) override;
|
||||||
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
|
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
|
||||||
@ -98,9 +98,9 @@ public:
|
|||||||
}
|
}
|
||||||
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) override;
|
unsigned ByteAlignment) override;
|
||||||
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
|
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
|
||||||
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
|
uint64_t Size = 0, unsigned ByteAlignment = 0) override;
|
||||||
void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment = 0) override;
|
unsigned ByteAlignment = 0) override;
|
||||||
|
|
||||||
void EmitFileDirective(StringRef Filename) override {
|
void EmitFileDirective(StringRef Filename) override {
|
||||||
@ -149,7 +149,7 @@ static bool canGoAfterDWARF(const MCSectionMachO &MSec) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCMachOStreamer::ChangeSection(const MCSection *Section,
|
void MCMachOStreamer::ChangeSection(MCSection *Section,
|
||||||
const MCExpr *Subsection) {
|
const MCExpr *Subsection) {
|
||||||
// Change the section normally.
|
// Change the section normally.
|
||||||
bool Created = MCObjectStreamer::changeSectionImpl(Section, Subsection);
|
bool Created = MCObjectStreamer::changeSectionImpl(Section, Subsection);
|
||||||
@ -401,7 +401,7 @@ void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
Symbol, Size, ByteAlignment);
|
Symbol, Size, ByteAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCMachOStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
|
void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, unsigned ByteAlignment) {
|
||||||
MCSectionData &SectData = getAssembler().getOrCreateSectionData(*Section);
|
MCSectionData &SectData = getAssembler().getOrCreateSectionData(*Section);
|
||||||
|
|
||||||
@ -432,7 +432,7 @@ void MCMachOStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
|
|||||||
|
|
||||||
// This should always be called with the thread local bss section. Like the
|
// This should always be called with the thread local bss section. Like the
|
||||||
// .zerofill directive this doesn't actually switch sections on us.
|
// .zerofill directive this doesn't actually switch sections on us.
|
||||||
void MCMachOStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
void MCMachOStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, unsigned ByteAlignment) {
|
||||||
EmitZerofill(Section, Symbol, Size, ByteAlignment);
|
EmitZerofill(Section, Symbol, Size, ByteAlignment);
|
||||||
return;
|
return;
|
||||||
|
@ -31,7 +31,7 @@ namespace {
|
|||||||
|
|
||||||
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) override {}
|
unsigned ByteAlignment) override {}
|
||||||
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = nullptr,
|
void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
|
||||||
uint64_t Size = 0, unsigned ByteAlignment = 0) override {}
|
uint64_t Size = 0, unsigned ByteAlignment = 0) override {}
|
||||||
void EmitGPRel32Value(const MCExpr *Value) override {}
|
void EmitGPRel32Value(const MCExpr *Value) override {}
|
||||||
};
|
};
|
||||||
|
@ -768,7 +768,7 @@ void MCObjectFileInfo::InitMCObjectFileInfo(StringRef T, Reloc::Model relocm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const {
|
MCSection *MCObjectFileInfo::getDwarfTypesSection(uint64_t Hash) const {
|
||||||
return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
|
return Ctx->getELFSection(".debug_types", ELF::SHT_PROGBITS, ELF::SHF_GROUP,
|
||||||
0, utostr(Hash));
|
0, utostr(Hash));
|
||||||
}
|
}
|
||||||
|
@ -201,12 +201,12 @@ void MCObjectStreamer::EmitWeakReference(MCSymbol *Alias,
|
|||||||
report_fatal_error("This file format doesn't support weak aliases.");
|
report_fatal_error("This file format doesn't support weak aliases.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCObjectStreamer::ChangeSection(const MCSection *Section,
|
void MCObjectStreamer::ChangeSection(MCSection *Section,
|
||||||
const MCExpr *Subsection) {
|
const MCExpr *Subsection) {
|
||||||
changeSectionImpl(Section, Subsection);
|
changeSectionImpl(Section, Subsection);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MCObjectStreamer::changeSectionImpl(const MCSection *Section,
|
bool MCObjectStreamer::changeSectionImpl(MCSection *Section,
|
||||||
const MCExpr *Subsection) {
|
const MCExpr *Subsection) {
|
||||||
assert(Section && "Cannot switch to a null section!");
|
assert(Section && "Cannot switch to a null section!");
|
||||||
flushPendingLabels(nullptr);
|
flushPendingLabels(nullptr);
|
||||||
|
@ -632,7 +632,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
|
|||||||
if (getContext().getGenDwarfForAssembly()) {
|
if (getContext().getGenDwarfForAssembly()) {
|
||||||
MCSymbol *SectionStartSym = getContext().createTempSymbol();
|
MCSymbol *SectionStartSym = getContext().createTempSymbol();
|
||||||
getStreamer().EmitLabel(SectionStartSym);
|
getStreamer().EmitLabel(SectionStartSym);
|
||||||
const MCSection *Sec = getStreamer().getCurrentSection().first;
|
MCSection *Sec = getStreamer().getCurrentSection().first;
|
||||||
bool InsertResult = getContext().addGenDwarfSection(Sec);
|
bool InsertResult = getContext().addGenDwarfSection(Sec);
|
||||||
assert(InsertResult && ".text section should not have debug info yet");
|
assert(InsertResult && ".text section should not have debug info yet");
|
||||||
(void)InsertResult;
|
(void)InsertResult;
|
||||||
|
@ -527,8 +527,8 @@ EndStmt:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *ELFSection = getContext().getELFSection(
|
MCSection *ELFSection = getContext().getELFSection(SectionName, Type, Flags,
|
||||||
SectionName, Type, Flags, Size, GroupName, UniqueID);
|
Size, GroupName, UniqueID);
|
||||||
getStreamer().SwitchSection(ELFSection, Subsection);
|
getStreamer().SwitchSection(ELFSection, Subsection);
|
||||||
|
|
||||||
if (getContext().getGenDwarfForAssembly()) {
|
if (getContext().getGenDwarfForAssembly()) {
|
||||||
@ -677,7 +677,7 @@ bool ELFAsmParser::ParseDirectiveVersion(StringRef, SMLoc) {
|
|||||||
|
|
||||||
Lex();
|
Lex();
|
||||||
|
|
||||||
const MCSection *Note = getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
|
MCSection *Note = getContext().getELFSection(".note", ELF::SHT_NOTE, 0);
|
||||||
|
|
||||||
getStreamer().PushSection();
|
getStreamer().PushSection();
|
||||||
getStreamer().SwitchSection(Note);
|
getStreamer().SwitchSection(Note);
|
||||||
|
@ -18,7 +18,7 @@ using namespace llvm;
|
|||||||
// MCSection
|
// MCSection
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
MCSymbol *MCSection::getEndSymbol(MCContext &Ctx) const {
|
MCSymbol *MCSection::getEndSymbol(MCContext &Ctx) {
|
||||||
if (!End)
|
if (!End)
|
||||||
End = Ctx.createTempSymbol("sec_end", true);
|
End = Ctx.createTempSymbol("sec_end", true);
|
||||||
return End;
|
return End;
|
||||||
|
@ -188,7 +188,7 @@ void MCStreamer::InitSections(bool NoExecStack) {
|
|||||||
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
|
SwitchSection(getContext().getObjectFileInfo()->getTextSection());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCStreamer::AssignSection(MCSymbol *Symbol, const MCSection *Section) {
|
void MCStreamer::AssignSection(MCSymbol *Symbol, MCSection *Section) {
|
||||||
if (Section)
|
if (Section)
|
||||||
Symbol->setSection(*Section);
|
Symbol->setSection(*Section);
|
||||||
else
|
else
|
||||||
@ -640,9 +640,9 @@ void MCStreamer::EmitCOFFSymbolType(int Type) {}
|
|||||||
void MCStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
|
void MCStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {}
|
||||||
void MCStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void MCStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) {}
|
unsigned ByteAlignment) {}
|
||||||
void MCStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
|
void MCStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {}
|
uint64_t Size, unsigned ByteAlignment) {}
|
||||||
void MCStreamer::ChangeSection(const MCSection *, const MCExpr *) {}
|
void MCStreamer::ChangeSection(MCSection *, const MCExpr *) {}
|
||||||
void MCStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
|
void MCStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
|
||||||
void MCStreamer::EmitBytes(StringRef Data) {}
|
void MCStreamer::EmitBytes(StringRef Data) {}
|
||||||
void MCStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
void MCStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||||
@ -664,8 +664,7 @@ void MCStreamer::EmitBundleLock(bool AlignToEnd) {}
|
|||||||
void MCStreamer::FinishImpl() {}
|
void MCStreamer::FinishImpl() {}
|
||||||
void MCStreamer::EmitBundleUnlock() {}
|
void MCStreamer::EmitBundleUnlock() {}
|
||||||
|
|
||||||
void MCStreamer::SwitchSection(const MCSection *Section,
|
void MCStreamer::SwitchSection(MCSection *Section, const MCExpr *Subsection) {
|
||||||
const MCExpr *Subsection) {
|
|
||||||
assert(Section && "Cannot switch to a null section!");
|
assert(Section && "Cannot switch to a null section!");
|
||||||
MCSectionSubPair curSection = SectionStack.back().first;
|
MCSectionSubPair curSection = SectionStack.back().first;
|
||||||
SectionStack.back().second = curSection;
|
SectionStack.back().second = curSection;
|
||||||
@ -679,7 +678,7 @@ void MCStreamer::SwitchSection(const MCSection *Section,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSymbol *MCStreamer::endSection(const MCSection *Section) {
|
MCSymbol *MCStreamer::endSection(MCSection *Section) {
|
||||||
// TODO: keep track of the last subsection so that this symbol appears in the
|
// TODO: keep track of the last subsection so that this symbol appears in the
|
||||||
// correct place.
|
// correct place.
|
||||||
MCSymbol *Sym = Section->getEndSymbol(Context);
|
MCSymbol *Sym = Section->getEndSymbol(Context);
|
||||||
|
@ -14,8 +14,7 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// Sentinel value for the absolute pseudo section.
|
// Sentinel value for the absolute pseudo section.
|
||||||
const MCSection *MCSymbol::AbsolutePseudoSection =
|
MCSection *MCSymbol::AbsolutePseudoSection = reinterpret_cast<MCSection *>(1);
|
||||||
reinterpret_cast<const MCSection *>(1);
|
|
||||||
|
|
||||||
static bool isAcceptableChar(char C) {
|
static bool isAcceptableChar(char C) {
|
||||||
if ((C < 'a' || C > 'z') &&
|
if ((C < 'a' || C > 'z') &&
|
||||||
|
@ -224,16 +224,14 @@ void UnwindEmitter::Emit(MCStreamer &Streamer) const {
|
|||||||
|
|
||||||
// Emit the unwind info structs first.
|
// Emit the unwind info structs first.
|
||||||
for (const auto &CFI : Streamer.getWinFrameInfos()) {
|
for (const auto &CFI : Streamer.getWinFrameInfos()) {
|
||||||
const MCSection *XData =
|
MCSection *XData = getXDataSection(CFI->Function, Context);
|
||||||
getXDataSection(CFI->Function, Context);
|
|
||||||
Streamer.SwitchSection(XData);
|
Streamer.SwitchSection(XData);
|
||||||
EmitUnwindInfo(Streamer, CFI);
|
EmitUnwindInfo(Streamer, CFI);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now emit RUNTIME_FUNCTION entries.
|
// Now emit RUNTIME_FUNCTION entries.
|
||||||
for (const auto &CFI : Streamer.getWinFrameInfos()) {
|
for (const auto &CFI : Streamer.getWinFrameInfos()) {
|
||||||
const MCSection *PData =
|
MCSection *PData = getPDataSection(CFI->Function, Context);
|
||||||
getPDataSection(CFI->Function, Context);
|
|
||||||
Streamer.SwitchSection(PData);
|
Streamer.SwitchSection(PData);
|
||||||
EmitRuntimeFunction(Streamer, CFI);
|
EmitRuntimeFunction(Streamer, CFI);
|
||||||
}
|
}
|
||||||
@ -244,8 +242,7 @@ void UnwindEmitter::EmitUnwindInfo(MCStreamer &Streamer,
|
|||||||
// Switch sections (the static function above is meant to be called from
|
// Switch sections (the static function above is meant to be called from
|
||||||
// here and from Emit().
|
// here and from Emit().
|
||||||
MCContext &context = Streamer.getContext();
|
MCContext &context = Streamer.getContext();
|
||||||
const MCSection *xdataSect =
|
MCSection *xdataSect = getXDataSection(info->Function, context);
|
||||||
getXDataSection(info->Function, context);
|
|
||||||
Streamer.SwitchSection(xdataSect);
|
Streamer.SwitchSection(xdataSect);
|
||||||
|
|
||||||
llvm::EmitUnwindInfo(Streamer, info);
|
llvm::EmitUnwindInfo(Streamer, info);
|
||||||
|
@ -25,9 +25,10 @@ namespace WinEH {
|
|||||||
/// associated with that comdat. If the code described is not in the main .text
|
/// associated with that comdat. If the code described is not in the main .text
|
||||||
/// section, make a new section for it. Otherwise use the main unwind info
|
/// section, make a new section for it. Otherwise use the main unwind info
|
||||||
/// section.
|
/// section.
|
||||||
static const MCSection *getUnwindInfoSection(
|
static MCSection *getUnwindInfoSection(StringRef SecName,
|
||||||
StringRef SecName, const MCSectionCOFF *UnwindSec, const MCSymbol *Function,
|
MCSectionCOFF *UnwindSec,
|
||||||
MCContext &Context) {
|
const MCSymbol *Function,
|
||||||
|
MCContext &Context) {
|
||||||
if (Function && Function->isInSection()) {
|
if (Function && Function->isInSection()) {
|
||||||
// If Function is in a COMDAT, get or create an unwind info section in that
|
// If Function is in a COMDAT, get or create an unwind info section in that
|
||||||
// COMDAT group.
|
// COMDAT group.
|
||||||
@ -59,16 +60,16 @@ static const MCSection *getUnwindInfoSection(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *UnwindEmitter::getPDataSection(const MCSymbol *Function,
|
MCSection *UnwindEmitter::getPDataSection(const MCSymbol *Function,
|
||||||
MCContext &Context) {
|
MCContext &Context) {
|
||||||
const MCSectionCOFF *PData =
|
MCSectionCOFF *PData =
|
||||||
cast<MCSectionCOFF>(Context.getObjectFileInfo()->getPDataSection());
|
cast<MCSectionCOFF>(Context.getObjectFileInfo()->getPDataSection());
|
||||||
return getUnwindInfoSection(".pdata", PData, Function, Context);
|
return getUnwindInfoSection(".pdata", PData, Function, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *UnwindEmitter::getXDataSection(const MCSymbol *Function,
|
MCSection *UnwindEmitter::getXDataSection(const MCSymbol *Function,
|
||||||
MCContext &Context) {
|
MCContext &Context) {
|
||||||
const MCSectionCOFF *XData =
|
MCSectionCOFF *XData =
|
||||||
cast<MCSectionCOFF>(Context.getObjectFileInfo()->getXDataSection());
|
cast<MCSectionCOFF>(Context.getObjectFileInfo()->getXDataSection());
|
||||||
return getUnwindInfoSection(".xdata", XData, Function, Context);
|
return getUnwindInfoSection(".xdata", XData, Function, Context);
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
unsigned ByteAlignment) {
|
unsigned ByteAlignment) {
|
||||||
assert(!Symbol->isInSection() && "Symbol must not already have a section!");
|
assert(!Symbol->isInSection() && "Symbol must not already have a section!");
|
||||||
|
|
||||||
const MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
|
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
|
||||||
MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
|
MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
|
||||||
if (SectionData.getAlignment() < ByteAlignment)
|
if (SectionData.getAlignment() < ByteAlignment)
|
||||||
SectionData.setAlignment(ByteAlignment);
|
SectionData.setAlignment(ByteAlignment);
|
||||||
@ -238,15 +238,13 @@ void MCWinCOFFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
SD.setFragment(Fragment);
|
SD.setFragment(Fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCWinCOFFStreamer::EmitZerofill(const MCSection *Section,
|
void MCWinCOFFStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
||||||
MCSymbol *Symbol, uint64_t Size,
|
uint64_t Size, unsigned ByteAlignment) {
|
||||||
unsigned ByteAlignment) {
|
|
||||||
llvm_unreachable("not implemented");
|
llvm_unreachable("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCWinCOFFStreamer::EmitTBSSSymbol(const MCSection *Section,
|
void MCWinCOFFStreamer::EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
MCSymbol *Symbol, uint64_t Size,
|
uint64_t Size, unsigned ByteAlignment) {
|
||||||
unsigned ByteAlignment) {
|
|
||||||
llvm_unreachable("not implemented");
|
llvm_unreachable("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ bool RecordStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
|
void RecordStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, unsigned ByteAlignment) {
|
||||||
markDefined(*Symbol);
|
markDefined(*Symbol);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
void EmitLabel(MCSymbol *Symbol) override;
|
void EmitLabel(MCSymbol *Symbol) override;
|
||||||
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
|
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override;
|
||||||
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
|
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
|
||||||
void EmitZerofill(const MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
void EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) override;
|
unsigned ByteAlignment) override;
|
||||||
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) override;
|
unsigned ByteAlignment) override;
|
||||||
|
@ -96,8 +96,7 @@ public:
|
|||||||
|
|
||||||
~AArch64ELFStreamer() override {}
|
~AArch64ELFStreamer() override {}
|
||||||
|
|
||||||
void ChangeSection(const MCSection *Section,
|
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override {
|
||||||
const MCExpr *Subsection) override {
|
|
||||||
// We have to keep track of the mapping symbol state of any sections we
|
// We have to keep track of the mapping symbol state of any sections we
|
||||||
// use. Each one should start off as EMS_None, which is provided as the
|
// use. Each one should start off as EMS_None, which is provided as the
|
||||||
// default constructor by DenseMap::lookup.
|
// default constructor by DenseMap::lookup.
|
||||||
|
@ -86,7 +86,7 @@ void AArch64MCExpr::visitUsedExpr(MCStreamer &Streamer) const {
|
|||||||
Streamer.visitUsedExpr(*getSubExpr());
|
Streamer.visitUsedExpr(*getSubExpr());
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *AArch64MCExpr::FindAssociatedSection() const {
|
MCSection *AArch64MCExpr::FindAssociatedSection() const {
|
||||||
llvm_unreachable("FIXME: what goes here?");
|
llvm_unreachable("FIXME: what goes here?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public:
|
|||||||
|
|
||||||
void visitUsedExpr(MCStreamer &Streamer) const override;
|
void visitUsedExpr(MCStreamer &Streamer) const override;
|
||||||
|
|
||||||
const MCSection *FindAssociatedSection() const override;
|
MCSection *FindAssociatedSection() const override;
|
||||||
|
|
||||||
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
bool EvaluateAsRelocatableImpl(MCValue &Res,
|
||||||
const MCAsmLayout *Layout,
|
const MCAsmLayout *Layout,
|
||||||
|
@ -275,7 +275,7 @@ private:
|
|||||||
unsigned EmittedArch;
|
unsigned EmittedArch;
|
||||||
SmallVector<AttributeItem, 64> Contents;
|
SmallVector<AttributeItem, 64> Contents;
|
||||||
|
|
||||||
const MCSection *AttributeSection;
|
MCSection *AttributeSection;
|
||||||
|
|
||||||
AttributeItem *getAttributeItem(unsigned Attribute) {
|
AttributeItem *getAttributeItem(unsigned Attribute) {
|
||||||
for (size_t i = 0; i < Contents.size(); ++i)
|
for (size_t i = 0; i < Contents.size(); ++i)
|
||||||
@ -431,8 +431,7 @@ public:
|
|||||||
void emitRegSave(const SmallVectorImpl<unsigned> &RegList, bool isVector);
|
void emitRegSave(const SmallVectorImpl<unsigned> &RegList, bool isVector);
|
||||||
void emitUnwindRaw(int64_t Offset, const SmallVectorImpl<uint8_t> &Opcodes);
|
void emitUnwindRaw(int64_t Offset, const SmallVectorImpl<uint8_t> &Opcodes);
|
||||||
|
|
||||||
void ChangeSection(const MCSection *Section,
|
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override {
|
||||||
const MCExpr *Subsection) override {
|
|
||||||
// We have to keep track of the mapping symbol state of any sections we
|
// We have to keep track of the mapping symbol state of any sections we
|
||||||
// use. Each one should start off as EMS_None, which is provided as the
|
// use. Each one should start off as EMS_None, which is provided as the
|
||||||
// default constructor by DenseMap::lookup.
|
// default constructor by DenseMap::lookup.
|
||||||
@ -1028,7 +1027,7 @@ inline void ARMELFStreamer::SwitchToEHSection(const char *Prefix,
|
|||||||
const MCSymbol *Group = FnSection.getGroup();
|
const MCSymbol *Group = FnSection.getGroup();
|
||||||
if (Group)
|
if (Group)
|
||||||
Flags |= ELF::SHF_GROUP;
|
Flags |= ELF::SHF_GROUP;
|
||||||
const MCSectionELF *EHSection =
|
MCSectionELF *EHSection =
|
||||||
getContext().getELFSection(EHSecName, Type, Flags, 0, Group,
|
getContext().getELFSection(EHSecName, Type, Flags, 0, Group,
|
||||||
FnSection.getUniqueID(), nullptr, &FnSection);
|
FnSection.getUniqueID(), nullptr, &FnSection);
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ public:
|
|||||||
const MCFixup *Fixup) const override {
|
const MCFixup *Fixup) const override {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void visitUsedExpr(MCStreamer &Streamer) const override;
|
void visitUsedExpr(MCStreamer &Streamer) const override;
|
||||||
const MCSection *FindAssociatedSection() const override {
|
MCSection *FindAssociatedSection() const override {
|
||||||
return getSubExpr()->FindAssociatedSection();
|
return getSubExpr()->FindAssociatedSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *
|
MCSection *
|
||||||
HexagonTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
HexagonTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
||||||
SectionKind Kind, Mangler &Mang,
|
SectionKind Kind, Mangler &Mang,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
class HexagonTargetObjectFile : public TargetLoweringObjectFileELF {
|
class HexagonTargetObjectFile : public TargetLoweringObjectFileELF {
|
||||||
const MCSectionELF *SmallDataSection;
|
MCSectionELF *SmallDataSection;
|
||||||
const MCSectionELF *SmallBSSSection;
|
MCSectionELF *SmallBSSSection;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
||||||
|
|
||||||
@ -30,9 +31,9 @@ namespace llvm {
|
|||||||
const TargetMachine &TM) const;
|
const TargetMachine &TM) const;
|
||||||
|
|
||||||
bool IsSmallDataEnabled () const;
|
bool IsSmallDataEnabled () const;
|
||||||
const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
|
MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SectionKind Kind, Mangler &Mang,
|
Mangler &Mang,
|
||||||
const TargetMachine &TM) const override;
|
const TargetMachine &TM) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace llvm
|
} // namespace llvm
|
||||||
|
@ -58,7 +58,7 @@ void MipsELFStreamer::EmitLabel(MCSymbol *Symbol) {
|
|||||||
Labels.push_back(Symbol);
|
Labels.push_back(Symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MipsELFStreamer::SwitchSection(const MCSection * Section,
|
void MipsELFStreamer::SwitchSection(MCSection *Section,
|
||||||
const MCExpr *Subsection) {
|
const MCExpr *Subsection) {
|
||||||
MCELFStreamer::SwitchSection(Section, Subsection);
|
MCELFStreamer::SwitchSection(Section, Subsection);
|
||||||
Labels.clear();
|
Labels.clear();
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
/// Overriding this function allows us to dismiss all labels that are
|
/// Overriding this function allows us to dismiss all labels that are
|
||||||
/// candidates for marking as microMIPS when .section directive is processed.
|
/// candidates for marking as microMIPS when .section directive is processed.
|
||||||
void SwitchSection(const MCSection *Section,
|
void SwitchSection(MCSection *Section,
|
||||||
const MCExpr *Subsection = nullptr) override;
|
const MCExpr *Subsection = nullptr) override;
|
||||||
|
|
||||||
/// Overriding this function allows us to dismiss all labels that are
|
/// Overriding this function allows us to dismiss all labels that are
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
const MCAsmLayout *Layout,
|
const MCAsmLayout *Layout,
|
||||||
const MCFixup *Fixup) const override;
|
const MCFixup *Fixup) const override;
|
||||||
void visitUsedExpr(MCStreamer &Streamer) const override;
|
void visitUsedExpr(MCStreamer &Streamer) const override;
|
||||||
const MCSection *FindAssociatedSection() const override {
|
MCSection *FindAssociatedSection() const override {
|
||||||
return getSubExpr()->FindAssociatedSection();
|
return getSubExpr()->FindAssociatedSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
|
|||||||
if (MTS->getABI().IsN64()) {
|
if (MTS->getABI().IsN64()) {
|
||||||
// The EntrySize value of 1 seems strange since the records are neither
|
// The EntrySize value of 1 seems strange since the records are neither
|
||||||
// 1-byte long nor fixed length but it matches the value GAS emits.
|
// 1-byte long nor fixed length but it matches the value GAS emits.
|
||||||
const MCSectionELF *Sec =
|
MCSectionELF *Sec =
|
||||||
Context.getELFSection(".MIPS.options", ELF::SHT_MIPS_OPTIONS,
|
Context.getELFSection(".MIPS.options", ELF::SHT_MIPS_OPTIONS,
|
||||||
ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP, 1, "");
|
ELF::SHF_ALLOC | ELF::SHF_MIPS_NOSTRIP, 1, "");
|
||||||
MCA.getOrCreateSectionData(*Sec).setAlignment(8);
|
MCA.getOrCreateSectionData(*Sec).setAlignment(8);
|
||||||
@ -46,8 +46,8 @@ void MipsRegInfoRecord::EmitMipsOptionRecord() {
|
|||||||
Streamer->EmitIntValue(ri_cprmask[3], 4);
|
Streamer->EmitIntValue(ri_cprmask[3], 4);
|
||||||
Streamer->EmitIntValue(ri_gp_value, 8);
|
Streamer->EmitIntValue(ri_gp_value, 8);
|
||||||
} else {
|
} else {
|
||||||
const MCSectionELF *Sec = Context.getELFSection(
|
MCSectionELF *Sec = Context.getELFSection(".reginfo", ELF::SHT_MIPS_REGINFO,
|
||||||
".reginfo", ELF::SHT_MIPS_REGINFO, ELF::SHF_ALLOC, 24, "");
|
ELF::SHF_ALLOC, 24, "");
|
||||||
MCA.getOrCreateSectionData(*Sec)
|
MCA.getOrCreateSectionData(*Sec)
|
||||||
.setAlignment(MTS->getABI().IsN32() ? 8 : 4);
|
.setAlignment(MTS->getABI().IsN32() ? 8 : 4);
|
||||||
Streamer->SwitchSection(Sec);
|
Streamer->SwitchSection(Sec);
|
||||||
|
@ -564,8 +564,8 @@ void MipsTargetELFStreamer::emitDirectiveEnd(StringRef Name) {
|
|||||||
MCContext &Context = MCA.getContext();
|
MCContext &Context = MCA.getContext();
|
||||||
MCStreamer &OS = getStreamer();
|
MCStreamer &OS = getStreamer();
|
||||||
|
|
||||||
const MCSectionELF *Sec = Context.getELFSection(
|
MCSectionELF *Sec = Context.getELFSection(".pdr", ELF::SHT_PROGBITS,
|
||||||
".pdr", ELF::SHT_PROGBITS, ELF::SHF_ALLOC | ELF::SHT_REL);
|
ELF::SHF_ALLOC | ELF::SHT_REL);
|
||||||
|
|
||||||
const MCSymbolRefExpr *ExprRef =
|
const MCSymbolRefExpr *ExprRef =
|
||||||
MCSymbolRefExpr::Create(Name, MCSymbolRefExpr::VK_None, Context);
|
MCSymbolRefExpr::Create(Name, MCSymbolRefExpr::VK_None, Context);
|
||||||
@ -786,7 +786,7 @@ void MipsTargetELFStreamer::emitMipsAbiFlags() {
|
|||||||
MCAssembler &MCA = getStreamer().getAssembler();
|
MCAssembler &MCA = getStreamer().getAssembler();
|
||||||
MCContext &Context = MCA.getContext();
|
MCContext &Context = MCA.getContext();
|
||||||
MCStreamer &OS = getStreamer();
|
MCStreamer &OS = getStreamer();
|
||||||
const MCSectionELF *Sec = Context.getELFSection(
|
MCSectionELF *Sec = Context.getELFSection(
|
||||||
".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS, ELF::SHF_ALLOC, 24, "");
|
".MIPS.abiflags", ELF::SHT_MIPS_ABIFLAGS, ELF::SHF_ALLOC, 24, "");
|
||||||
MCSectionData &ABIShndxSD = MCA.getOrCreateSectionData(*Sec);
|
MCSectionData &ABIShndxSD = MCA.getOrCreateSectionData(*Sec);
|
||||||
ABIShndxSD.setAlignment(8);
|
ABIShndxSD.setAlignment(8);
|
||||||
|
@ -963,7 +963,7 @@ void MipsAsmPrinter::EmitFPCallStub(
|
|||||||
//
|
//
|
||||||
// .section mips16.call.fpxxxx,"ax",@progbits
|
// .section mips16.call.fpxxxx,"ax",@progbits
|
||||||
//
|
//
|
||||||
const MCSectionELF *M = OutContext.getELFSection(
|
MCSectionELF *M = OutContext.getELFSection(
|
||||||
".mips16.call.fp." + std::string(Symbol), ELF::SHT_PROGBITS,
|
".mips16.call.fp." + std::string(Symbol), ELF::SHT_PROGBITS,
|
||||||
ELF::SHF_ALLOC | ELF::SHF_EXECINSTR);
|
ELF::SHF_ALLOC | ELF::SHF_EXECINSTR);
|
||||||
OutStreamer->SwitchSection(M, nullptr);
|
OutStreamer->SwitchSection(M, nullptr);
|
||||||
|
@ -110,9 +110,10 @@ IsGlobalInSmallSectionImpl(const GlobalValue *GV,
|
|||||||
return IsInSmallSection(TM.getDataLayout()->getTypeAllocSize(Ty));
|
return IsInSmallSection(TM.getDataLayout()->getTypeAllocSize(Ty));
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *MipsTargetObjectFile::
|
MCSection *
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
MipsTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
||||||
Mangler &Mang, const TargetMachine &TM) const {
|
SectionKind Kind, Mangler &Mang,
|
||||||
|
const TargetMachine &TM) const {
|
||||||
// TODO: Could also support "weak" symbols as well with ".gnu.linkonce.s.*"
|
// TODO: Could also support "weak" symbols as well with ".gnu.linkonce.s.*"
|
||||||
// sections?
|
// sections?
|
||||||
|
|
||||||
@ -136,8 +137,9 @@ IsConstantInSmallSection(const Constant *CN, const TargetMachine &TM) const {
|
|||||||
CN->getType())));
|
CN->getType())));
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *MipsTargetObjectFile::
|
MCSection *
|
||||||
getSectionForConstant(SectionKind Kind, const Constant *C) const {
|
MipsTargetObjectFile::getSectionForConstant(SectionKind Kind,
|
||||||
|
const Constant *C) const {
|
||||||
if (IsConstantInSmallSection(C, *TM))
|
if (IsConstantInSmallSection(C, *TM))
|
||||||
return SmallDataSection;
|
return SmallDataSection;
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
class MipsTargetMachine;
|
class MipsTargetMachine;
|
||||||
class MipsTargetObjectFile : public TargetLoweringObjectFileELF {
|
class MipsTargetObjectFile : public TargetLoweringObjectFileELF {
|
||||||
const MCSection *SmallDataSection;
|
MCSection *SmallDataSection;
|
||||||
const MCSection *SmallBSSSection;
|
MCSection *SmallBSSSection;
|
||||||
const MipsTargetMachine *TM;
|
const MipsTargetMachine *TM;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -31,16 +31,16 @@ class MipsTargetMachine;
|
|||||||
bool IsGlobalInSmallSectionImpl(const GlobalValue *GV,
|
bool IsGlobalInSmallSectionImpl(const GlobalValue *GV,
|
||||||
const TargetMachine &TM) const;
|
const TargetMachine &TM) const;
|
||||||
|
|
||||||
const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
|
MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SectionKind Kind, Mangler &Mang,
|
Mangler &Mang,
|
||||||
const TargetMachine &TM) const override;
|
const TargetMachine &TM) const override;
|
||||||
|
|
||||||
/// Return true if this constant should be placed into small data section.
|
/// Return true if this constant should be placed into small data section.
|
||||||
bool IsConstantInSmallSection(const Constant *CN,
|
bool IsConstantInSmallSection(const Constant *CN,
|
||||||
const TargetMachine &TM) const;
|
const TargetMachine &TM) const;
|
||||||
|
|
||||||
const MCSection *getSectionForConstant(SectionKind Kind,
|
MCSection *getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const override;
|
const Constant *C) const override;
|
||||||
};
|
};
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
|
@ -4520,7 +4520,7 @@ NVPTXTargetObjectFile::~NVPTXTargetObjectFile() {
|
|||||||
delete DwarfRangesSection;
|
delete DwarfRangesSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *
|
MCSection *
|
||||||
NVPTXTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
NVPTXTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
||||||
SectionKind Kind, Mangler &Mang,
|
SectionKind Kind, Mangler &Mang,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
|
@ -68,9 +68,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void visitUsedExpr(MCStreamer &Streamer) const override {};
|
void visitUsedExpr(MCStreamer &Streamer) const override {};
|
||||||
const MCSection *FindAssociatedSection() const override {
|
MCSection *FindAssociatedSection() const override { return nullptr; }
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There are no TLS NVPTXMCExprs at the moment.
|
// There are no TLS NVPTXMCExprs at the moment.
|
||||||
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
|
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
|
||||||
@ -112,9 +110,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void visitUsedExpr(MCStreamer &Streamer) const override {};
|
void visitUsedExpr(MCStreamer &Streamer) const override {};
|
||||||
const MCSection *FindAssociatedSection() const override {
|
MCSection *FindAssociatedSection() const override { return nullptr; }
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// There are no TLS NVPTXMCExprs at the moment.
|
// There are no TLS NVPTXMCExprs at the moment.
|
||||||
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
|
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
|
||||||
|
@ -84,20 +84,20 @@ public:
|
|||||||
new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
|
new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *getSectionForConstant(SectionKind Kind,
|
MCSection *getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const override {
|
const Constant *C) const override {
|
||||||
return ReadOnlySection;
|
return ReadOnlySection;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *getExplicitSectionGlobal(const GlobalValue *GV,
|
MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SectionKind Kind, Mangler &Mang,
|
Mangler &Mang,
|
||||||
const TargetMachine &TM) const override {
|
const TargetMachine &TM) const override {
|
||||||
return DataSection;
|
return DataSection;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *
|
MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
Mangler &Mang,
|
||||||
const TargetMachine &TM) const override;
|
const TargetMachine &TM) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
@ -82,7 +82,7 @@ public:
|
|||||||
const MCAsmLayout *Layout,
|
const MCAsmLayout *Layout,
|
||||||
const MCFixup *Fixup) const override;
|
const MCFixup *Fixup) const override;
|
||||||
void visitUsedExpr(MCStreamer &Streamer) const override;
|
void visitUsedExpr(MCStreamer &Streamer) const override;
|
||||||
const MCSection *FindAssociatedSection() const override {
|
MCSection *FindAssociatedSection() const override {
|
||||||
return getSubExpr()->FindAssociatedSection();
|
return getSubExpr()->FindAssociatedSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,7 +1054,7 @@ void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
|
|||||||
|
|
||||||
// Emit an official procedure descriptor.
|
// Emit an official procedure descriptor.
|
||||||
MCSectionSubPair Current = OutStreamer->getCurrentSection();
|
MCSectionSubPair Current = OutStreamer->getCurrentSection();
|
||||||
const MCSectionELF *Section = OutStreamer->getContext().getELFSection(
|
MCSectionELF *Section = OutStreamer->getContext().getELFSection(
|
||||||
".opd", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
|
".opd", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
|
||||||
OutStreamer->SwitchSection(Section);
|
OutStreamer->SwitchSection(Section);
|
||||||
OutStreamer->EmitLabel(CurrentFnSym);
|
OutStreamer->EmitLabel(CurrentFnSym);
|
||||||
@ -1084,8 +1084,8 @@ bool PPCLinuxAsmPrinter::doFinalization(Module &M) {
|
|||||||
static_cast<PPCTargetStreamer &>(*OutStreamer->getTargetStreamer());
|
static_cast<PPCTargetStreamer &>(*OutStreamer->getTargetStreamer());
|
||||||
|
|
||||||
if (!TOC.empty()) {
|
if (!TOC.empty()) {
|
||||||
const MCSectionELF *Section;
|
MCSectionELF *Section;
|
||||||
|
|
||||||
if (isPPC64)
|
if (isPPC64)
|
||||||
Section = OutStreamer->getContext().getELFSection(
|
Section = OutStreamer->getContext().getELFSection(
|
||||||
".toc", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
|
".toc", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
|
||||||
@ -1285,15 +1285,14 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
|||||||
static_cast<const TargetLoweringObjectFileMachO &>(getObjFileLowering());
|
static_cast<const TargetLoweringObjectFileMachO &>(getObjFileLowering());
|
||||||
|
|
||||||
// .lazy_symbol_pointer
|
// .lazy_symbol_pointer
|
||||||
const MCSection *LSPSection = TLOFMacho.getLazySymbolPointerSection();
|
MCSection *LSPSection = TLOFMacho.getLazySymbolPointerSection();
|
||||||
|
|
||||||
// Output stubs for dynamically-linked functions
|
// Output stubs for dynamically-linked functions
|
||||||
if (TM.getRelocationModel() == Reloc::PIC_) {
|
if (TM.getRelocationModel() == Reloc::PIC_) {
|
||||||
const MCSection *StubSection =
|
MCSection *StubSection = OutContext.getMachOSection(
|
||||||
OutContext.getMachOSection("__TEXT", "__picsymbolstub1",
|
"__TEXT", "__picsymbolstub1",
|
||||||
MachO::S_SYMBOL_STUBS |
|
MachO::S_SYMBOL_STUBS | MachO::S_ATTR_PURE_INSTRUCTIONS, 32,
|
||||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
SectionKind::getText());
|
||||||
32, SectionKind::getText());
|
|
||||||
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
|
||||||
OutStreamer->SwitchSection(StubSection);
|
OutStreamer->SwitchSection(StubSection);
|
||||||
EmitAlignment(4);
|
EmitAlignment(4);
|
||||||
@ -1356,12 +1355,11 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
|||||||
OutStreamer->AddBlankLine();
|
OutStreamer->AddBlankLine();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *StubSection =
|
MCSection *StubSection = OutContext.getMachOSection(
|
||||||
OutContext.getMachOSection("__TEXT","__symbol_stub1",
|
"__TEXT", "__symbol_stub1",
|
||||||
MachO::S_SYMBOL_STUBS |
|
MachO::S_SYMBOL_STUBS | MachO::S_ATTR_PURE_INSTRUCTIONS, 16,
|
||||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
SectionKind::getText());
|
||||||
16, SectionKind::getText());
|
|
||||||
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
|
||||||
MCSymbol *Stub = Stubs[i].first;
|
MCSymbol *Stub = Stubs[i].first;
|
||||||
MCSymbol *RawSym = Stubs[i].second.getPointer();
|
MCSymbol *RawSym = Stubs[i].second.getPointer();
|
||||||
|
@ -22,7 +22,7 @@ Initialize(MCContext &Ctx, const TargetMachine &TM) {
|
|||||||
InitializeELF(TM.Options.UseInitArray);
|
InitializeELF(TM.Options.UseInitArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *PPC64LinuxTargetObjectFile::SelectSectionForGlobal(
|
MCSection *PPC64LinuxTargetObjectFile::SelectSectionForGlobal(
|
||||||
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
// Here override ReadOnlySection to DataRelROSection for PPC64 SVR4 ABI
|
// Here override ReadOnlySection to DataRelROSection for PPC64 SVR4 ABI
|
||||||
|
@ -22,9 +22,9 @@ namespace llvm {
|
|||||||
|
|
||||||
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
||||||
|
|
||||||
const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
|
MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SectionKind Kind, Mangler &Mang,
|
Mangler &Mang,
|
||||||
const TargetMachine &TM) const override;
|
const TargetMachine &TM) const override;
|
||||||
|
|
||||||
/// \brief Describe a TLS variable address within debug info.
|
/// \brief Describe a TLS variable address within debug info.
|
||||||
const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
|
const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const override;
|
||||||
|
@ -107,7 +107,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
SetupMachineFunction(MF);
|
SetupMachineFunction(MF);
|
||||||
|
|
||||||
MCContext &Context = getObjFileLowering().getContext();
|
MCContext &Context = getObjFileLowering().getContext();
|
||||||
const MCSectionELF *ConfigSection =
|
MCSectionELF *ConfigSection =
|
||||||
Context.getELFSection(".AMDGPU.config", ELF::SHT_PROGBITS, 0);
|
Context.getELFSection(".AMDGPU.config", ELF::SHT_PROGBITS, 0);
|
||||||
OutStreamer->SwitchSection(ConfigSection);
|
OutStreamer->SwitchSection(ConfigSection);
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ bool AMDGPUAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
EmitFunctionBody();
|
EmitFunctionBody();
|
||||||
|
|
||||||
if (isVerbose()) {
|
if (isVerbose()) {
|
||||||
const MCSectionELF *CommentSection =
|
MCSectionELF *CommentSection =
|
||||||
Context.getELFSection(".AMDGPU.csdata", ELF::SHT_PROGBITS, 0);
|
Context.getELFSection(".AMDGPU.csdata", ELF::SHT_PROGBITS, 0);
|
||||||
OutStreamer->SwitchSection(CommentSection);
|
OutStreamer->SwitchSection(CommentSection);
|
||||||
|
|
||||||
@ -509,7 +509,7 @@ void AMDGPUAsmPrinter::EmitAmdKernelCodeT(const MachineFunction &MF,
|
|||||||
|
|
||||||
header.wavefront_size = STM.getWavefrontSize();
|
header.wavefront_size = STM.getWavefrontSize();
|
||||||
|
|
||||||
const MCSectionELF *VersionSection =
|
MCSectionELF *VersionSection =
|
||||||
OutContext.getELFSection(".hsa.version", ELF::SHT_PROGBITS, 0);
|
OutContext.getELFSection(".hsa.version", ELF::SHT_PROGBITS, 0);
|
||||||
OutStreamer->SwitchSection(VersionSection);
|
OutStreamer->SwitchSection(VersionSection);
|
||||||
OutStreamer->EmitBytes(Twine("HSA Code Unit:" +
|
OutStreamer->EmitBytes(Twine("HSA Code Unit:" +
|
||||||
|
@ -90,7 +90,7 @@ public:
|
|||||||
const MCAsmLayout *Layout,
|
const MCAsmLayout *Layout,
|
||||||
const MCFixup *Fixup) const override;
|
const MCFixup *Fixup) const override;
|
||||||
void visitUsedExpr(MCStreamer &Streamer) const override;
|
void visitUsedExpr(MCStreamer &Streamer) const override;
|
||||||
const MCSection *FindAssociatedSection() const override {
|
MCSection *FindAssociatedSection() const override {
|
||||||
return getSubExpr()->FindAssociatedSection();
|
return getSubExpr()->FindAssociatedSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,12 +255,13 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalValue *GV,
|
|||||||
llvm_unreachable("Invalid relocation");
|
llvm_unreachable("Invalid relocation");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SectionForGlobal - This method computes the appropriate section to emit
|
/// This method computes the appropriate section to emit the specified global
|
||||||
/// the specified global variable or function definition. This should not
|
/// variable or function definition. This should not be passed external (or
|
||||||
/// be passed external (or available externally) globals.
|
/// available externally) globals.
|
||||||
const MCSection *TargetLoweringObjectFile::
|
MCSection *
|
||||||
SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
TargetLoweringObjectFile::SectionForGlobal(const GlobalValue *GV,
|
||||||
const TargetMachine &TM) const {
|
SectionKind Kind, Mangler &Mang,
|
||||||
|
const TargetMachine &TM) const {
|
||||||
// Select section name.
|
// Select section name.
|
||||||
if (GV->hasSection())
|
if (GV->hasSection())
|
||||||
return getExplicitSectionGlobal(GV, Kind, Mang, TM);
|
return getExplicitSectionGlobal(GV, Kind, Mang, TM);
|
||||||
@ -270,7 +271,7 @@ SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
|||||||
return SelectSectionForGlobal(GV, Kind, Mang, TM);
|
return SelectSectionForGlobal(GV, Kind, Mang, TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *TargetLoweringObjectFile::getSectionForJumpTable(
|
MCSection *TargetLoweringObjectFile::getSectionForJumpTable(
|
||||||
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
|
const Function &F, Mangler &Mang, const TargetMachine &TM) const {
|
||||||
return getSectionForConstant(SectionKind::getReadOnly(), /*C=*/nullptr);
|
return getSectionForConstant(SectionKind::getReadOnly(), /*C=*/nullptr);
|
||||||
}
|
}
|
||||||
@ -293,10 +294,9 @@ bool TargetLoweringObjectFile::shouldPutJumpTableInFunctionSection(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getSectionForConstant - Given a mergable constant with the
|
/// Given a mergable constant with the specified size and relocation
|
||||||
/// specified size and relocation information, return a section that it
|
/// information, return a section that it should be placed in.
|
||||||
/// should be placed in.
|
MCSection *
|
||||||
const MCSection *
|
|
||||||
TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind,
|
TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const {
|
const Constant *C) const {
|
||||||
if (Kind.isReadOnly() && ReadOnlySection != nullptr)
|
if (Kind.isReadOnly() && ReadOnlySection != nullptr)
|
||||||
|
@ -615,12 +615,11 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
|||||||
|
|
||||||
Stubs = MMIMacho.GetFnStubList();
|
Stubs = MMIMacho.GetFnStubList();
|
||||||
if (!Stubs.empty()) {
|
if (!Stubs.empty()) {
|
||||||
const MCSection *TheSection =
|
MCSection *TheSection = OutContext.getMachOSection(
|
||||||
OutContext.getMachOSection("__IMPORT", "__jump_table",
|
"__IMPORT", "__jump_table",
|
||||||
MachO::S_SYMBOL_STUBS |
|
MachO::S_SYMBOL_STUBS | MachO::S_ATTR_SELF_MODIFYING_CODE |
|
||||||
MachO::S_ATTR_SELF_MODIFYING_CODE |
|
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
5, SectionKind::getMetadata());
|
||||||
5, SectionKind::getMetadata());
|
|
||||||
OutStreamer->SwitchSection(TheSection);
|
OutStreamer->SwitchSection(TheSection);
|
||||||
|
|
||||||
for (const auto &Stub : Stubs) {
|
for (const auto &Stub : Stubs) {
|
||||||
@ -641,10 +640,9 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
|||||||
// Output stubs for external and common global variables.
|
// Output stubs for external and common global variables.
|
||||||
Stubs = MMIMacho.GetGVStubList();
|
Stubs = MMIMacho.GetGVStubList();
|
||||||
if (!Stubs.empty()) {
|
if (!Stubs.empty()) {
|
||||||
const MCSection *TheSection =
|
MCSection *TheSection = OutContext.getMachOSection(
|
||||||
OutContext.getMachOSection("__IMPORT", "__pointers",
|
"__IMPORT", "__pointers", MachO::S_NON_LAZY_SYMBOL_POINTERS,
|
||||||
MachO::S_NON_LAZY_SYMBOL_POINTERS,
|
SectionKind::getMetadata());
|
||||||
SectionKind::getMetadata());
|
|
||||||
OutStreamer->SwitchSection(TheSection);
|
OutStreamer->SwitchSection(TheSection);
|
||||||
|
|
||||||
for (auto &Stub : Stubs)
|
for (auto &Stub : Stubs)
|
||||||
@ -656,10 +654,9 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
|||||||
|
|
||||||
Stubs = MMIMacho.GetHiddenGVStubList();
|
Stubs = MMIMacho.GetHiddenGVStubList();
|
||||||
if (!Stubs.empty()) {
|
if (!Stubs.empty()) {
|
||||||
const MCSection *TheSection =
|
MCSection *TheSection = OutContext.getMachOSection(
|
||||||
OutContext.getMachOSection("__IMPORT", "__pointers",
|
"__IMPORT", "__pointers", MachO::S_NON_LAZY_SYMBOL_POINTERS,
|
||||||
MachO::S_NON_LAZY_SYMBOL_POINTERS,
|
SectionKind::getMetadata());
|
||||||
SectionKind::getMetadata());
|
|
||||||
OutStreamer->SwitchSection(TheSection);
|
OutStreamer->SwitchSection(TheSection);
|
||||||
|
|
||||||
for (auto &Stub : Stubs)
|
for (auto &Stub : Stubs)
|
||||||
|
@ -149,7 +149,7 @@ static std::string scalarConstantToHexString(const Constant *C) {
|
|||||||
return APIntToHexString(AI);
|
return APIntToHexString(AI);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *
|
MCSection *
|
||||||
X86WindowsTargetObjectFile::getSectionForConstant(SectionKind Kind,
|
X86WindowsTargetObjectFile::getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const {
|
const Constant *C) const {
|
||||||
if (Kind.isReadOnly()) {
|
if (Kind.isReadOnly()) {
|
||||||
|
@ -58,8 +58,8 @@ namespace llvm {
|
|||||||
|
|
||||||
/// \brief Given a mergeable constant with the specified size and relocation
|
/// \brief Given a mergeable constant with the specified size and relocation
|
||||||
/// information, return a section that it should be placed in.
|
/// information, return a section that it should be placed in.
|
||||||
const MCSection *getSectionForConstant(SectionKind Kind,
|
MCSection *getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const override;
|
const Constant *C) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
@ -95,7 +95,7 @@ static unsigned getXCoreSectionFlags(SectionKind K, bool IsCPRel) {
|
|||||||
return Flags;
|
return Flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *
|
MCSection *
|
||||||
XCoreTargetObjectFile::getExplicitSectionGlobal(const GlobalValue *GV,
|
XCoreTargetObjectFile::getExplicitSectionGlobal(const GlobalValue *GV,
|
||||||
SectionKind Kind, Mangler &Mang,
|
SectionKind Kind, Mangler &Mang,
|
||||||
const TargetMachine &TM) const {
|
const TargetMachine &TM) const {
|
||||||
@ -108,9 +108,10 @@ XCoreTargetObjectFile::getExplicitSectionGlobal(const GlobalValue *GV,
|
|||||||
getXCoreSectionFlags(Kind, IsCPRel));
|
getXCoreSectionFlags(Kind, IsCPRel));
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *XCoreTargetObjectFile::
|
MCSection *
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
XCoreTargetObjectFile::SelectSectionForGlobal(const GlobalValue *GV,
|
||||||
const TargetMachine &TM) const{
|
SectionKind Kind, Mangler &Mang,
|
||||||
|
const TargetMachine &TM) const {
|
||||||
|
|
||||||
bool UseCPRel = GV->isLocalLinkage(GV->getLinkage());
|
bool UseCPRel = GV->isLocalLinkage(GV->getLinkage());
|
||||||
|
|
||||||
@ -141,7 +142,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
|
|||||||
report_fatal_error("Target does not support TLS or Common sections");
|
report_fatal_error("Target does not support TLS or Common sections");
|
||||||
}
|
}
|
||||||
|
|
||||||
const MCSection *
|
MCSection *
|
||||||
XCoreTargetObjectFile::getSectionForConstant(SectionKind Kind,
|
XCoreTargetObjectFile::getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const {
|
const Constant *C) const {
|
||||||
if (Kind.isMergeableConst4()) return MergeableConst4Section;
|
if (Kind.isMergeableConst4()) return MergeableConst4Section;
|
||||||
|
@ -17,25 +17,24 @@ namespace llvm {
|
|||||||
static const unsigned CodeModelLargeSize = 256;
|
static const unsigned CodeModelLargeSize = 256;
|
||||||
|
|
||||||
class XCoreTargetObjectFile : public TargetLoweringObjectFileELF {
|
class XCoreTargetObjectFile : public TargetLoweringObjectFileELF {
|
||||||
const MCSection *BSSSectionLarge;
|
MCSection *BSSSectionLarge;
|
||||||
const MCSection *DataSectionLarge;
|
MCSection *DataSectionLarge;
|
||||||
const MCSection *ReadOnlySectionLarge;
|
MCSection *ReadOnlySectionLarge;
|
||||||
const MCSection *DataRelROSectionLarge;
|
MCSection *DataRelROSectionLarge;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
|
||||||
|
|
||||||
const MCSection *
|
MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
getExplicitSectionGlobal(const GlobalValue *GV,
|
Mangler &Mang,
|
||||||
SectionKind Kind, Mangler &Mang,
|
const TargetMachine &TM) const override;
|
||||||
const TargetMachine &TM) const override;
|
|
||||||
|
|
||||||
const MCSection *
|
MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
||||||
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
|
Mangler &Mang,
|
||||||
Mangler &Mang,
|
const TargetMachine &TM) const override;
|
||||||
const TargetMachine &TM) const override;
|
|
||||||
|
|
||||||
const MCSection *getSectionForConstant(SectionKind Kind,
|
MCSection *getSectionForConstant(SectionKind Kind,
|
||||||
const Constant *C) const override;
|
const Constant *C) const override;
|
||||||
};
|
};
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ class DwarfStreamer {
|
|||||||
|
|
||||||
/// \brief Emit the pubnames or pubtypes section contribution for \p
|
/// \brief Emit the pubnames or pubtypes section contribution for \p
|
||||||
/// Unit into \p Sec. The data is provided in \p Names.
|
/// Unit into \p Sec. The data is provided in \p Names.
|
||||||
void emitPubSectionForUnit(const MCSection *Sec, StringRef Name,
|
void emitPubSectionForUnit(MCSection *Sec, StringRef Name,
|
||||||
const CompileUnit &Unit,
|
const CompileUnit &Unit,
|
||||||
const std::vector<CompileUnit::AccelInfo> &Names);
|
const std::vector<CompileUnit::AccelInfo> &Names);
|
||||||
|
|
||||||
@ -913,7 +913,7 @@ void DwarfStreamer::emitLineTableForUnit(StringRef PrologueBytes,
|
|||||||
/// \brief Emit the pubnames or pubtypes section contribution for \p
|
/// \brief Emit the pubnames or pubtypes section contribution for \p
|
||||||
/// Unit into \p Sec. The data is provided in \p Names.
|
/// Unit into \p Sec. The data is provided in \p Names.
|
||||||
void DwarfStreamer::emitPubSectionForUnit(
|
void DwarfStreamer::emitPubSectionForUnit(
|
||||||
const MCSection *Sec, StringRef SecName, const CompileUnit &Unit,
|
MCSection *Sec, StringRef SecName, const CompileUnit &Unit,
|
||||||
const std::vector<CompileUnit::AccelInfo> &Names) {
|
const std::vector<CompileUnit::AccelInfo> &Names) {
|
||||||
if (Names.empty())
|
if (Names.empty())
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user