mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-18 18:42:46 +02:00
[MC] Add MCSection::NonUniqueID and delete one MCContext::getELFSection overload
This commit is contained in:
parent
fdfda04ad5
commit
48a7715451
@ -435,14 +435,8 @@ namespace llvm {
|
|||||||
MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
|
MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
const Twine &Group) {
|
const Twine &Group) {
|
||||||
return getELFSection(Section, Type, Flags, EntrySize, Group, ~0);
|
return getELFSection(Section, Type, Flags, EntrySize, Group,
|
||||||
}
|
MCSection::NonUniqueID, nullptr);
|
||||||
|
|
||||||
MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
|
|
||||||
unsigned Flags, unsigned EntrySize,
|
|
||||||
const Twine &Group, unsigned UniqueID) {
|
|
||||||
return getELFSection(Section, Type, Flags, EntrySize, Group, UniqueID,
|
|
||||||
nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
|
MCSectionELF *getELFSection(const Twine &Section, unsigned Type,
|
||||||
|
@ -38,6 +38,8 @@ template <> struct ilist_alloc_traits<MCFragment> {
|
|||||||
/// current translation unit. The MCContext class uniques and creates these.
|
/// current translation unit. The MCContext class uniques and creates these.
|
||||||
class MCSection {
|
class MCSection {
|
||||||
public:
|
public:
|
||||||
|
static constexpr unsigned NonUniqueID = ~0U;
|
||||||
|
|
||||||
enum SectionVariant { SV_COFF = 0, SV_ELF, SV_MachO, SV_Wasm, SV_XCOFF };
|
enum SectionVariant { SV_COFF = 0, SV_ELF, SV_MachO, SV_Wasm, SV_XCOFF };
|
||||||
|
|
||||||
/// Express the state of bundle locked groups while emitting code.
|
/// Express the state of bundle locked groups while emitting code.
|
||||||
|
@ -81,7 +81,7 @@ public:
|
|||||||
bool UseCodeAlign() const override;
|
bool UseCodeAlign() const override;
|
||||||
bool isVirtualSection() const override;
|
bool isVirtualSection() const override;
|
||||||
|
|
||||||
bool isUnique() const { return UniqueID != ~0U; }
|
bool isUnique() const { return UniqueID != NonUniqueID; }
|
||||||
unsigned getUniqueID() const { return UniqueID; }
|
unsigned getUniqueID() const { return UniqueID; }
|
||||||
|
|
||||||
const MCSection *getLinkedToSection() const {
|
const MCSection *getLinkedToSection() const {
|
||||||
|
@ -1670,8 +1670,9 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
GV.getVisibility() != GlobalValue::DefaultVisibility)
|
GV.getVisibility() != GlobalValue::DefaultVisibility)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
OutStreamer->SwitchSection(OutContext.getELFSection(
|
OutStreamer->SwitchSection(
|
||||||
".llvm_sympart", ELF::SHT_LLVM_SYMPART, 0, 0, "", ++UniqueID));
|
OutContext.getELFSection(".llvm_sympart", ELF::SHT_LLVM_SYMPART, 0, 0,
|
||||||
|
"", ++UniqueID, nullptr));
|
||||||
OutStreamer->emitBytes(GV.getPartition());
|
OutStreamer->emitBytes(GV.getPartition());
|
||||||
OutStreamer->EmitZeros(1);
|
OutStreamer->EmitZeros(1);
|
||||||
OutStreamer->EmitValue(
|
OutStreamer->EmitValue(
|
||||||
|
@ -433,8 +433,8 @@ MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type,
|
|||||||
|
|
||||||
MCSectionELF *MCContext::createELFGroupSection(const MCSymbolELF *Group) {
|
MCSectionELF *MCContext::createELFGroupSection(const MCSymbolELF *Group) {
|
||||||
return createELFSectionImpl(".group", ELF::SHT_GROUP, 0,
|
return createELFSectionImpl(".group", ELF::SHT_GROUP, 0,
|
||||||
SectionKind::getReadOnly(), 4, Group, ~0,
|
SectionKind::getReadOnly(), 4, Group,
|
||||||
nullptr);
|
MCSection::NonUniqueID, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
MCSectionCOFF *MCContext::getCOFFSection(StringRef Section,
|
MCSectionCOFF *MCContext::getCOFFSection(StringRef Section,
|
||||||
|
@ -49,7 +49,7 @@ void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
|
|||||||
// Since we cannot modify flags for an existing section, we create a new
|
// Since we cannot modify flags for an existing section, we create a new
|
||||||
// section with the right flags, and use 0 as the unique ID for
|
// section with the right flags, and use 0 as the unique ID for
|
||||||
// execute-only text
|
// execute-only text
|
||||||
TextSection = Ctx.getELFSection(".text", Type, Flags, 0, "", 0U);
|
TextSection = Ctx.getELFSection(".text", Type, Flags, 0, "", 0U, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user