mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 19:25:00 +00:00
Add interface for section override. Use this for Sparc, since it should use named BSS section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54844 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -520,9 +520,11 @@ namespace llvm {
|
|||||||
virtual ~TargetAsmInfo();
|
virtual ~TargetAsmInfo();
|
||||||
|
|
||||||
const Section* getNamedSection(const char *Name,
|
const Section* getNamedSection(const char *Name,
|
||||||
unsigned Flags = SectionFlags::None) const;
|
unsigned Flags = SectionFlags::None,
|
||||||
|
bool Override = false) const;
|
||||||
const Section* getUnnamedSection(const char *Directive,
|
const Section* getUnnamedSection(const char *Directive,
|
||||||
unsigned Flags = SectionFlags::None) const;
|
unsigned Flags = SectionFlags::None,
|
||||||
|
bool Override = false) const;
|
||||||
|
|
||||||
/// Measure the specified inline asm to determine an approximation of its
|
/// Measure the specified inline asm to determine an approximation of its
|
||||||
/// length.
|
/// length.
|
||||||
|
@@ -25,6 +25,11 @@ SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM):
|
|||||||
ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
|
ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
|
||||||
COMMDirectiveTakesAlignment = true;
|
COMMDirectiveTakesAlignment = true;
|
||||||
CStringSection=".rodata.str";
|
CStringSection=".rodata.str";
|
||||||
|
|
||||||
|
// Sparc normally uses named section for BSS.
|
||||||
|
BSSSection_ = getNamedSection("\t.bss",
|
||||||
|
SectionFlags::Writeable | SectionFlags::BSS,
|
||||||
|
/* Override */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SparcELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
|
std::string SparcELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
|
||||||
|
@@ -352,11 +352,12 @@ TargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Section*
|
const Section*
|
||||||
TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags) const {
|
TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags,
|
||||||
|
bool Override) const {
|
||||||
Section& S = Sections[Name];
|
Section& S = Sections[Name];
|
||||||
|
|
||||||
// This is newly-created section, set it up properly.
|
// This is newly-created section, set it up properly.
|
||||||
if (S.Flags == SectionFlags::Invalid) {
|
if (S.Flags == SectionFlags::Invalid || Override) {
|
||||||
S.Flags = Flags | SectionFlags::Named;
|
S.Flags = Flags | SectionFlags::Named;
|
||||||
S.Name = Name;
|
S.Name = Name;
|
||||||
}
|
}
|
||||||
@@ -365,11 +366,12 @@ TargetAsmInfo::getNamedSection(const char *Name, unsigned Flags) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Section*
|
const Section*
|
||||||
TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags) const {
|
TargetAsmInfo::getUnnamedSection(const char *Directive, unsigned Flags,
|
||||||
|
bool Override) const {
|
||||||
Section& S = Sections[Directive];
|
Section& S = Sections[Directive];
|
||||||
|
|
||||||
// This is newly-created section, set it up properly.
|
// This is newly-created section, set it up properly.
|
||||||
if (S.Flags == SectionFlags::Invalid) {
|
if (S.Flags == SectionFlags::Invalid || Override) {
|
||||||
S.Flags = Flags & ~SectionFlags::Named;
|
S.Flags = Flags & ~SectionFlags::Named;
|
||||||
S.Name = Directive;
|
S.Name = Directive;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user