eliminate an argument from PrintRelDirective, sinking
the one special case into EmitSectionOffset. MCize
the non-special case in EmitSectionOffset.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98014 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
index a40bd54..8dd72c4 100644
--- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
@@ -77,10 +77,8 @@
return 0;
}
-void DwarfPrinter::PrintRelDirective(bool Force32Bit, bool isInSection) const {
- if (isInSection && MAI->getDwarfSectionOffsetDirective())
- O << MAI->getDwarfSectionOffsetDirective();
- else if (Force32Bit || TD->getPointerSize() == sizeof(int32_t))
+void DwarfPrinter::PrintRelDirective(bool Force32Bit) const {
+ if (Force32Bit || TD->getPointerSize() == sizeof(int32_t))
O << MAI->getData32bitsDirective();
else
O << MAI->getData64bitsDirective();
@@ -253,17 +251,23 @@
void DwarfPrinter::EmitSectionOffset(const MCSymbol *Label,
const MCSymbol *Section,
bool IsSmall, bool isEH) {
- bool printAbsolute = false;
+ bool isAbsolute;
if (isEH)
- printAbsolute = MAI->isAbsoluteEHSectionOffsets();
+ isAbsolute = MAI->isAbsoluteEHSectionOffsets();
else
- printAbsolute = MAI->isAbsoluteDebugSectionOffsets();
+ isAbsolute = MAI->isAbsoluteDebugSectionOffsets();
- if (!printAbsolute)
+ if (!isAbsolute)
return EmitDifference(Label, Section, IsSmall);
- PrintRelDirective(IsSmall, true);
- PrintLabelName(Label);
+ // On COFF targets, we have to emit the weird .secrel32 directive.
+ if (const char *SecOffDir = MAI->getDwarfSectionOffsetDirective())
+ O << SecOffDir << Label->getName();
+ else {
+ unsigned Size = IsSmall ? 4 : TD->getPointerSize();
+ Asm->OutStreamer.EmitValue(MCSymbolRefExpr::Create(Label, Asm->OutContext),
+ Size, 0/*AddrSpace*/);
+ }
}
/// EmitFrameMoves - Emit frame instructions to describe the layout of the