summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-10 01:39:42 +0000
committerChris Lattner <sabre@nondot.org>2009-08-10 01:39:42 +0000
commitff4bc460c52c1f285d8a56da173641bf92d49e3f (patch)
tree7da0d5977dffaffaa4bb5da91039d0960f839f77 /lib/Target/PowerPC
parente36df3fd31a08a41d9ad04fcba182b616b030c9c (diff)
downloadllvm-ff4bc460c52c1f285d8a56da173641bf92d49e3f.tar.gz
llvm-ff4bc460c52c1f285d8a56da173641bf92d49e3f.tar.bz2
llvm-ff4bc460c52c1f285d8a56da173641bf92d49e3f.tar.xz
Make the big switch: Change MCSectionMachO to represent a section *semantically*
instead of syntactically as a string. This means that it keeps track of the segment, section, flags, etc directly and asmprints them in the right format. This also includes parsing and validation support for llvm-mc and "attribute(section)", so we should now start getting errors about invalid section attributes from the compiler instead of the assembler on darwin. Still todo: 1) Uniquing of darwin mcsections 2) Move all the Darwin stuff out to MCSectionMachO.[cpp|h] 3) there are a few FIXMEs, for example what is the syntax to get the S_GB_ZEROFILL segment type? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78547 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC')
-rw-r--r--lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp58
1 files changed, 27 insertions, 31 deletions
diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
index 9884ca32bf..73c9c03854 100644
--- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
@@ -846,22 +846,19 @@ bool PPCDarwinAsmPrinter::doInitialization(Module &M) {
// Prime text sections so they are adjacent. This reduces the likelihood a
// large data or debug section causes a branch to exceed 16M limit.
-
TargetLoweringObjectFileMachO &TLOFMacho =
static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering());
- SwitchToSection(TLOFMacho.getMachOSection("\t.section __TEXT,__textcoal_nt,"
- "coalesced,pure_instructions", true,
- SectionKind::getText()));
+ SwitchToSection(TLOFMacho.getTextCoalSection());
if (TM.getRelocationModel() == Reloc::PIC_) {
- SwitchToSection(TLOFMacho.getMachOSection("\t.section __TEXT,__picsymbolstu"
- "b1,symbol_stubs,"
- "pure_instructions,32", true,
- SectionKind::getText()));
+ SwitchToSection(TLOFMacho.getMachOSection("__TEXT", "__picsymbolstub1",
+ MCSectionMachO::S_SYMBOL_STUBS |
+ MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
+ 32, SectionKind::getText()));
} else if (TM.getRelocationModel() == Reloc::DynamicNoPIC) {
- SwitchToSection(TLOFMacho.getMachOSection("\t.section __TEXT,__symbol_stub1"
- ",symbol_stubs,"
- "pure_instructions,16", true,
- SectionKind::getText()));
+ SwitchToSection(TLOFMacho.getMachOSection("__TEXT","__symbol_stub1",
+ MCSectionMachO::S_SYMBOL_STUBS |
+ MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
+ 16, SectionKind::getText()));
}
SwitchToSection(getObjFileLowering().getTextSection());
@@ -985,17 +982,20 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
TargetLoweringObjectFileMachO &TLOFMacho =
static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering());
+
+ const MCSection *LSPSection = 0;
+ if (!FnStubs.empty()) // .lazy_symbol_pointer
+ LSPSection = TLOFMacho.getLazySymbolPointerSection();
+
+
// Output stubs for dynamically-linked functions
if (TM.getRelocationModel() == Reloc::PIC_ && !FnStubs.empty()) {
const MCSection *StubSection =
- TLOFMacho.getMachOSection("\t.section __TEXT,__picsymbolstub1,"
- "symbol_stubs,pure_instructions,32", true,
- SectionKind::getText());
- const MCSection *LSPSection =
- TLOFMacho.getMachOSection(".lazy_symbol_pointer", true,
- SectionKind::getMetadata());
-
- for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end();
+ TLOFMacho.getMachOSection("__TEXT", "__picsymbolstub1",
+ MCSectionMachO::S_SYMBOL_STUBS |
+ MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
+ 32, SectionKind::getText());
+ for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end();
I != E; ++I) {
SwitchToSection(StubSection);
EmitAlignment(4);
@@ -1020,13 +1020,11 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n";
}
} else if (!FnStubs.empty()) {
- const MCSection *StubSection =
- TLOFMacho.getMachOSection("\t.section __TEXT,__symbol_stub1,symbol_stubs,"
- "pure_instructions,16", true,
- SectionKind::getText());
- const MCSection *LSPSection =
- TLOFMacho.getMachOSection(".lazy_symbol_pointer", true,
- SectionKind::getMetadata());
+ const MCSection *StubSection =
+ TLOFMacho.getMachOSection("__TEXT","__symbol_stub1",
+ MCSectionMachO::S_SYMBOL_STUBS |
+ MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
+ 16, SectionKind::getText());
for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end();
I != E; ++I) {
@@ -1063,10 +1061,8 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
// Output macho stubs for external and common global variables.
if (!GVStubs.empty()) {
- const MCSection *TheSection =
- TLOFMacho.getMachOSection(".non_lazy_symbol_pointer", true,
- SectionKind::getMetadata());
- SwitchToSection(TheSection);
+ // Switch with ".non_lazy_symbol_pointer" directive.
+ SwitchToSection(TLOFMacho.getNonLazySymbolPointerSection());
for (StringMap<std::string>::iterator I = GVStubs.begin(),
E = GVStubs.end(); I != E; ++I) {
O << I->second << ":\n";