summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-12-04 00:31:13 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-12-04 00:31:13 +0000
commit1048e75fb9f76233152e3848cef65c18d6d39e03 (patch)
treec3d24efa5e4c7cb60f071a9966b5dbaa13807198 /llvm/lib
parentce18d7ebb5e17df724c1e0289c9897b0c717a691 (diff)
downloadbcm5719-llvm-1048e75fb9f76233152e3848cef65c18d6d39e03.tar.gz
bcm5719-llvm-1048e75fb9f76233152e3848cef65c18d6d39e03.zip
Next step: Only pad debug_line when the target is darwin. Add a FIXME to avoid
doing that if the target is darwin10 or newer. This fixes *) Direct object emission was producing objects without the workaround on darwin9. *) Assembly printing was producing objects with the workaround on linux. llvm-svn: 120866
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCAsmInfo.cpp1
-rw-r--r--llvm/lib/MC/MCAsmInfoDarwin.cpp3
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp3
-rw-r--r--llvm/lib/MC/MCDwarf.cpp7
4 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCAsmInfo.cpp b/llvm/lib/MC/MCAsmInfo.cpp
index 37444c9c256..9cf4019e312 100644
--- a/llvm/lib/MC/MCAsmInfo.cpp
+++ b/llvm/lib/MC/MCAsmInfo.cpp
@@ -23,6 +23,7 @@ MCAsmInfo::MCAsmInfo() {
HasMachoZeroFillDirective = false;
HasMachoTBSSDirective = false;
HasStaticCtorDtorReferenceInStaticMode = false;
+ LinkerRequiresNonEmptyDwarfLines = false;
MaxInstLength = 4;
PCSymbol = "$";
SeparatorChar = ';';
diff --git a/llvm/lib/MC/MCAsmInfoDarwin.cpp b/llvm/lib/MC/MCAsmInfoDarwin.cpp
index fd155135df0..1147f02a596 100644
--- a/llvm/lib/MC/MCAsmInfoDarwin.cpp
+++ b/llvm/lib/MC/MCAsmInfoDarwin.cpp
@@ -37,6 +37,9 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
HasMachoZeroFillDirective = true; // Uses .zerofill
HasMachoTBSSDirective = true; // Uses .tbss
HasStaticCtorDtorReferenceInStaticMode = true;
+
+ // FIXME: Darwin 10 and newer don't need this.
+ LinkerRequiresNonEmptyDwarfLines = true;
HiddenVisibilityAttr = MCSA_PrivateExtern;
// Doesn't support protected visibility.
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 7189a90406e..40a234ea85f 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -896,8 +896,7 @@ void MCAsmStreamer::EmitRawText(StringRef String) {
void MCAsmStreamer::Finish() {
// Dump out the dwarf file & directory tables and line tables.
if (getContext().hasDwarfFiles() && TLOF)
- MCDwarfFileTable::Emit(this, TLOF->getDwarfLineSection(),
- TLOF->getTextSection());
+ MCDwarfFileTable::Emit(this, TLOF->getDwarfLineSection());
}
MCStreamer *llvm::createAsmStreamer(MCContext &Context,
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 194c324ab6c..a33b0c596ba 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCStreamer.h"
@@ -198,8 +199,7 @@ static inline void EmitDwarfLineTable(MCStreamer *MCOS,
// This emits the Dwarf file and the line tables.
//
void MCDwarfFileTable::Emit(MCStreamer *MCOS,
- const MCSection *DwarfLineSection,
- const MCSection *TextSection) {
+ const MCSection *DwarfLineSection) {
// Switch to the section where the table will be emitted into.
MCOS->SwitchSection(DwarfLineSection);
@@ -296,7 +296,8 @@ void MCDwarfFileTable::Emit(MCStreamer *MCOS,
delete Line;
}
- if (TextSection && MCLineSectionOrder.begin() == MCLineSectionOrder.end()) {
+ if (MCOS->getContext().getAsmInfo().getLinkerRequiresNonEmptyDwarfLines()
+ && MCLineSectionOrder.begin() == MCLineSectionOrder.end()) {
// The darwin9 linker has a bug (see PR8715). For for 32-bit architectures
// it requires:
// total_length >= prologue_length + 10
OpenPOWER on IntegriCloud