aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/AsmPrinter
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-03 21:53:27 +0000
committerChris Lattner <sabre@nondot.org>2009-08-03 21:53:27 +0000
commit11e9657eeb76dff6baaab1cbac0b1fb7e1abb439 (patch)
treed60add96d1b2d00eefbaec64b13ffe73f39f4f2c /lib/Target/X86/AsmPrinter
parenta6d658620f1b8803825d3d3adc5d5ed9b36dc422 (diff)
downloadexternal_llvm-11e9657eeb76dff6baaab1cbac0b1fb7e1abb439.zip
external_llvm-11e9657eeb76dff6baaab1cbac0b1fb7e1abb439.tar.gz
external_llvm-11e9657eeb76dff6baaab1cbac0b1fb7e1abb439.tar.bz2
Eliminate textual section switching from the x86 backend, one
more step towards "semantics sections" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter')
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
index 577d312..0be7f35 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
@@ -899,8 +899,9 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
}
if (Subtarget->isTargetDarwin()) {
- //TargetLoweringObjectFileMachO &TLOFMacho =
- // static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering());
+ // All darwin targets use mach-o.
+ TargetLoweringObjectFileMachO &TLOFMacho =
+ static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering());
// Add the (possibly multiple) personalities to the set of global value
// stubs. Only referenced functions get into the Personalities list.
@@ -916,8 +917,11 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
// Output stubs for dynamically-linked functions
if (!FnStubs.empty()) {
- SwitchToDataSection("\t.section __IMPORT,__jump_table,symbol_stubs,"
- "self_modifying_code+pure_instructions,5", 0);
+ const MCSection *TheSection =
+ TLOFMacho.getMachOSection("\t.section __IMPORT,__jump_table,symbol_stubs,"
+ "self_modifying_code+pure_instructions,5", true,
+ SectionKind::getMetadata());
+ SwitchToSection(TheSection);
for (StringMap<std::string>::iterator I = FnStubs.begin(),
E = FnStubs.end(); I != E; ++I)
O << I->getKeyData() << ":\n" << "\t.indirect_symbol " << I->second
@@ -927,8 +931,11 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
// Output stubs for external and common global variables.
if (!GVStubs.empty()) {
- SwitchToDataSection(
- "\t.section __IMPORT,__pointers,non_lazy_symbol_pointers");
+ const MCSection *TheSection =
+ TLOFMacho.getMachOSection("\t.section __IMPORT,__pointers,"
+ "non_lazy_symbol_pointers", true,
+ SectionKind::getMetadata());
+ SwitchToSection(TheSection);
for (StringMap<std::string>::iterator I = GVStubs.begin(),
E = GVStubs.end(); I != E; ++I)
O << I->getKeyData() << ":\n\t.indirect_symbol "
@@ -963,16 +970,17 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
// Output linker support code for dllexported globals on windows.
- if (!DLLExportedGVs.empty()) {
- SwitchToDataSection(".section .drectve");
+ if (!DLLExportedGVs.empty() || !DLLExportedFns.empty()) {
+ // dllexport symbols only exist on coff targets.
+ TargetLoweringObjectFileCOFF &TLOFMacho =
+ static_cast<TargetLoweringObjectFileCOFF&>(getObjFileLowering());
+
+ SwitchToSection(TLOFMacho.getCOFFSection(".section .drectve", true,
+ SectionKind::getMetadata()));
for (StringSet<>::iterator i = DLLExportedGVs.begin(),
e = DLLExportedGVs.end(); i != e; ++i)
O << "\t.ascii \" -export:" << i->getKeyData() << ",data\"\n";
- }
-
- if (!DLLExportedFns.empty()) {
- SwitchToDataSection(".section .drectve");
for (StringSet<>::iterator i = DLLExportedFns.begin(),
e = DLLExportedFns.end();