diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-09-30 22:25:37 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-09-30 22:25:37 +0000 |
commit | b2120755a2fdf8e5924ee95f190f6c68629b8764 (patch) | |
tree | f2761371e136e41f462b892d71ed968f85bb86ff | |
parent | 42909754f60ef1bde47ef94f372d0d05f9a5da40 (diff) | |
download | bcm5719-llvm-b2120755a2fdf8e5924ee95f190f6c68629b8764.tar.gz bcm5719-llvm-b2120755a2fdf8e5924ee95f190f6c68629b8764.zip |
Use OutStreamer.SwitchSection instead of writing out textual section directives.
Add a new TargetLoweringObjectFileMachO::getConstTextCoalSection method to
get access to that section.
llvm-svn: 83178
-rw-r--r-- | llvm/include/llvm/Target/TargetLoweringObjectFile.h | 8 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 25 |
2 files changed, 25 insertions, 8 deletions
diff --git a/llvm/include/llvm/Target/TargetLoweringObjectFile.h b/llvm/include/llvm/Target/TargetLoweringObjectFile.h index 454a0940b97..821e53783c6 100644 --- a/llvm/include/llvm/Target/TargetLoweringObjectFile.h +++ b/llvm/include/llvm/Target/TargetLoweringObjectFile.h @@ -301,11 +301,17 @@ public: SectionKind K) const; /// getTextCoalSection - Return the "__TEXT,__textcoal_nt" section we put weak - /// symbols into. + /// text symbols into. const MCSection *getTextCoalSection() const { return TextCoalSection; } + /// getConstTextCoalSection - Return the "__TEXT,__const_coal" section + /// we put weak read-only symbols into. + const MCSection *getConstTextCoalSection() const { + return ConstTextCoalSection; + } + /// getLazySymbolPointerSection - Return the section corresponding to /// the .lazy_symbol_pointer directive. const MCSection *getLazySymbolPointerSection() const { diff --git a/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index b496a810b02..5d14a9b4d3f 100644 --- a/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/llvm/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -1053,13 +1053,24 @@ void ARMAsmPrinter::EmitStartOfAsmFile(Module &M) { // avoid out-of-range branches that are due a fundamental limitation of // the way symbol offsets are encoded with the current Darwin ARM // relocations. - O << "\t.section __TEXT,__text,regular\n" - << "\t.section __TEXT,__textcoal_nt,coalesced\n" - << "\t.section __TEXT,__const_coal,coalesced\n"; - if (RelocM == Reloc::DynamicNoPIC) - O << "\t.section __TEXT,__symbol_stub4,symbol_stubs,none,12\n"; - else - O << "\t.section __TEXT,__picsymbolstub4,symbol_stubs,none,16\n"; + TargetLoweringObjectFileMachO &TLOFMacho = + static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering()); + OutStreamer.SwitchSection(TLOFMacho.getTextSection()); + OutStreamer.SwitchSection(TLOFMacho.getTextCoalSection()); + OutStreamer.SwitchSection(TLOFMacho.getConstTextCoalSection()); + if (RelocM == Reloc::DynamicNoPIC) { + const MCSection *sect = + TLOFMacho.getMachOSection("__TEXT", "__symbol_stub4", + MCSectionMachO::S_SYMBOL_STUBS, + 12, SectionKind::getText()); + OutStreamer.SwitchSection(sect); + } else { + const MCSection *sect = + TLOFMacho.getMachOSection("__TEXT", "__picsymbolstub4", + MCSectionMachO::S_SYMBOL_STUBS, + 16, SectionKind::getText()); + OutStreamer.SwitchSection(sect); + } } } |