summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCSectionELF.cpp19
-rw-r--r--llvm/lib/Target/PowerPC/PPCISelLowering.cpp2
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp3
-rw-r--r--llvm/lib/Target/TargetAsmInfo.cpp1
-rw-r--r--llvm/lib/Target/TargetLoweringObjectFile.cpp4
5 files changed, 17 insertions, 12 deletions
diff --git a/llvm/lib/MC/MCSectionELF.cpp b/llvm/lib/MC/MCSectionELF.cpp
index 56f803496ac..6e6f9990fe8 100644
--- a/llvm/lib/MC/MCSectionELF.cpp
+++ b/llvm/lib/MC/MCSectionELF.cpp
@@ -16,20 +16,21 @@ using namespace llvm;
MCSectionELF *MCSectionELF::
Create(const StringRef &Section, unsigned Type, unsigned Flags,
- SectionKind K, bool hasCrazyBSS, bool isExplicit, MCContext &Ctx) {
+ SectionKind K, bool isExplicit, MCContext &Ctx) {
return new
- (Ctx) MCSectionELF(Section, Type, Flags, K, hasCrazyBSS, isExplicit);
+ (Ctx) MCSectionELF(Section, Type, Flags, K, isExplicit);
}
// ShouldOmitSectionDirective - Decides whether a '.section' directive
// should be printed before the section name
-bool MCSectionELF::ShouldOmitSectionDirective(const char *Name) const {
+bool MCSectionELF::ShouldOmitSectionDirective(const char *Name,
+ const TargetAsmInfo &TAI) const {
- // PPC/Linux doesn't support the .bss directive, it needs .section .bss.
// FIXME: Does .section .bss/.data/.text work everywhere??
- if ((!HasCrazyBSS && strncmp(Name, ".bss", 4) == 0) ||
- strncmp(Name, ".text", 5) == 0 ||
- strncmp(Name, ".data", 5) == 0)
+ if (strncmp(Name, ".text", 5) == 0 ||
+ strncmp(Name, ".data", 5) == 0 ||
+ (strncmp(Name, ".bss", 4) == 0 &&
+ !TAI.usesELFSectionDirectiveForBSS()))
return true;
return false;
@@ -46,8 +47,8 @@ bool MCSectionELF::ShouldPrintSectionType(unsigned Ty) const {
void MCSectionELF::PrintSwitchToSection(const TargetAsmInfo &TAI,
raw_ostream &OS) const {
-
- if (ShouldOmitSectionDirective(SectionName.c_str())) {
+
+ if (ShouldOmitSectionDirective(SectionName.c_str(), TAI)) {
OS << '\t' << getSectionName() << '\n';
return;
}
diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index 569026fbb7c..7ad81f8936b 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -60,7 +60,7 @@ cl::desc("enable preincrement load/store generation on PPC (experimental)"),
static TargetLoweringObjectFile *CreateTLOF(const PPCTargetMachine &TM) {
if (TM.getSubtargetImpl()->isDarwin())
return new TargetLoweringObjectFileMachO();
- return new TargetLoweringObjectFileELF(true);
+ return new TargetLoweringObjectFileELF();
}
diff --git a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
index 36cf2a5570d..864475b30a8 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
@@ -30,6 +30,9 @@ PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(bool is64Bit) {
PrivateGlobalPrefix = ".L";
UsedDirective = "\t# .no_dead_strip\t";
WeakRefDirective = "\t.weak\t";
+
+ // Uses '.section' before '.bss' directive
+ UsesELFSectionDirectiveForBSS = true;
// Debug Information
AbsoluteDebugSectionOffsets = true;
diff --git a/llvm/lib/Target/TargetAsmInfo.cpp b/llvm/lib/Target/TargetAsmInfo.cpp
index 253d72c359c..20a584916f7 100644
--- a/llvm/lib/Target/TargetAsmInfo.cpp
+++ b/llvm/lib/Target/TargetAsmInfo.cpp
@@ -50,6 +50,7 @@ TargetAsmInfo::TargetAsmInfo() {
Data32bitsDirective = "\t.long\t";
Data64bitsDirective = "\t.quad\t";
SunStyleELFSectionSwitchSyntax = false;
+ UsesELFSectionDirectiveForBSS = false;
AlignDirective = "\t.align\t";
AlignmentIsInBytes = true;
TextAlignFillValue = 0;
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index edc9ed3ba43..7cb87efd404 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -298,8 +298,8 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
const MCSectionELF *&Entry = Map[Section];
if (Entry) return Entry;
- return Entry = MCSectionELF::Create(Section, Type, Flags, Kind, HasCrazyBSS,
- IsExplicit, getContext());
+ return Entry = MCSectionELF::Create(Section, Type, Flags, Kind, IsExplicit,
+ getContext());
}
void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
OpenPOWER on IntegriCloud