[llvm-commits] [llvm] r83178 - in /llvm/trunk: include/llvm/Target/TargetLoweringObjectFile.h lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
Bob Wilson
bob.wilson at apple.com
Wed Sep 30 15:25:37 PDT 2009
Author: bwilson
Date: Wed Sep 30 17:25:37 2009
New Revision: 83178
URL: http://llvm.org/viewvc/llvm-project?rev=83178&view=rev
Log:
Use OutStreamer.SwitchSection instead of writing out textual section directives.
Add a new TargetLoweringObjectFileMachO::getConstTextCoalSection method to
get access to that section.
Modified:
llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=83178&r1=83177&r2=83178&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Wed Sep 30 17:25:37 2009
@@ -301,11 +301,17 @@
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 {
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=83178&r1=83177&r2=83178&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Wed Sep 30 17:25:37 2009
@@ -1053,13 +1053,24 @@
// 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);
+ }
}
}
More information about the llvm-commits
mailing list