eliminate the magic AbsoluteDebugSectionOffsets MAI hook,
which is really a property of the section being referenced.
Add a predicate to MCSection to replace it.
Yay for reduction in magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100367 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
index 7de6109..84d47ec 100644
--- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
@@ -20,6 +20,7 @@
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/TargetData.h"
@@ -61,15 +62,16 @@
// If Label has already been emitted, verify that it is in the same section as
// section label for sanity.
assert((!Label->isInSection() || &Label->getSection() == &Section) &&
- "Section offset using wrong section base for label"); (void)Section;
+ "Section offset using wrong section base for label");
// If the section in question will end up with an address of 0 anyway, we can
// just emit an absolute reference to save a relocation.
- if (MAI->isAbsoluteDebugSectionOffsets()) {
+ if (Section.isBaseAddressKnownZero()) {
Asm->OutStreamer.EmitSymbolValue(Label, 4, 0/*AddrSpace*/);
return;
}
+ // Otherwise, emit it as a label difference from the start of the section.
Asm->EmitLabelDifference(Label, SectionLabel, 4);
}