Remove "JumpTableDataSection" from TAI, instead, have AsmPrinter
compute it based on what it knows. As part of this, rename getSectionForMergeableConstant
to getSectionForConstant because it works for non-mergable constants also.
The only functionality change from this is that Xcore will start dropping
its jump tables into readonly section instead of data section in -static mode.
This should be fine as the linker resolves the relocations. If this is a
problem, let me know and we'll come up with another solution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77833 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/DarwinTargetAsmInfo.cpp b/lib/Target/DarwinTargetAsmInfo.cpp
index 7000b4f..cca12c0 100644
--- a/lib/Target/DarwinTargetAsmInfo.cpp
+++ b/lib/Target/DarwinTargetAsmInfo.cpp
@@ -49,8 +49,6 @@
HiddenDirective = "\t.private_extern ";
// Sections:
- JumpTableDataSection = "\t.const";
-
if (TM.getRelocationModel() == Reloc::Static) {
StaticCtorsSection = ".constructor";
StaticDtorsSection = ".destructor";
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 1fb6563..add1dbf 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -69,7 +69,6 @@
TextSectionStartSuffix = "";
DataSectionStartSuffix = "";
SectionEndDirectiveSuffix = 0;
- JumpTableDataSection = "\t.section .rodata";
JumpTableDirective = 0;
// FIXME: Flags are ELFish - replace with normal section stuff.
StaticCtorsSection = "\t.section .ctors,\"aw\",@progbits";
diff --git a/lib/Target/TargetLoweringObjectFile.cpp b/lib/Target/TargetLoweringObjectFile.cpp
index 8424779..7eb9a4a 100644
--- a/lib/Target/TargetLoweringObjectFile.cpp
+++ b/lib/Target/TargetLoweringObjectFile.cpp
@@ -228,12 +228,11 @@
return getDataSection();
}
-/// getSectionForMergableConstant - Given a mergable constant with the
+/// getSectionForConstant - Given a mergable constant with the
/// specified size and relocation information, return a section that it
/// should be placed in.
const MCSection *
-TargetLoweringObjectFile::
-getSectionForMergeableConstant(SectionKind Kind) const {
+TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const {
if (Kind.isReadOnly() && ReadOnlySection != 0)
return ReadOnlySection;
@@ -459,11 +458,11 @@
return DataRelROSection;
}
-/// getSectionForMergeableConstant - Given a mergeable constant with the
+/// getSectionForConstant - Given a mergeable constant with the
/// specified size and relocation information, return a section that it
/// should be placed in.
const MCSection *TargetLoweringObjectFileELF::
-getSectionForMergeableConstant(SectionKind Kind) const {
+getSectionForConstant(SectionKind Kind) const {
if (Kind.isMergeableConst4())
return MergeableConst4Section;
if (Kind.isMergeableConst8())
@@ -582,8 +581,7 @@
}
const MCSection *
-TargetLoweringObjectFileMachO::
-getSectionForMergeableConstant(SectionKind Kind) const {
+TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind) const {
// If this constant requires a relocation, we have to put it in the data
// segment, not in the text segment.
if (Kind.isDataRel())
diff --git a/lib/Target/X86/X86TargetAsmInfo.cpp b/lib/Target/X86/X86TargetAsmInfo.cpp
index c13d9ac..c30f337 100644
--- a/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -228,7 +228,6 @@
AlignmentIsInBytes = true;
- JumpTableDataSection = NULL;
SwitchToSectionDirective = "";
TextSectionStartSuffix = "\tSEGMENT PARA 'CODE'";
DataSectionStartSuffix = "\tSEGMENT PARA 'DATA'";
diff --git a/lib/Target/XCore/XCoreTargetAsmInfo.cpp b/lib/Target/XCore/XCoreTargetAsmInfo.cpp
index 33a7eed..48502d0 100644
--- a/lib/Target/XCore/XCoreTargetAsmInfo.cpp
+++ b/lib/Target/XCore/XCoreTargetAsmInfo.cpp
@@ -18,7 +18,7 @@
Data64bitsDirective = 0;
ZeroDirective = "\t.space\t";
CommentString = "#";
- JumpTableDataSection = "\t.section\t.dp.data,\"awd\",@progbits";
+
PrivateGlobalPrefix = ".L";
AscizDirective = ".asciiz";
WeakDefDirective = "\t.weak\t";