summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-07-17 16:27:44 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-07-17 16:27:44 +0000
commit7d09530cef98973ed381d91d29576b3d56df21d0 (patch)
treeb0adb78a3c580a10037d6741811162e0b0725a39 /llvm/lib/MC/MCDwarf.cpp
parent862e60c75c5c41410d828f05f0f14bc53fcd7dff (diff)
downloadbcm5719-llvm-7d09530cef98973ed381d91d29576b3d56df21d0.tar.gz
bcm5719-llvm-7d09530cef98973ed381d91d29576b3d56df21d0.zip
MC: correct DWARF header for PE/COFF assembly input
The header contains an offset to the DWARF abbreviations for the CU. The offset must be section relative for COFF and absolute for others. The non-assembly code path for the DWARF header generation already had the correct emission for the headers. This corrects just the assembly path. Due to the invalid relocation, processing of the debug information would halt previously on the first assembly input as the associated abbreviations would be out of range as they would have the location increased by image base and the section offset. This address PR20332. llvm-svn: 213275
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index b14a452d85d..ae276868198 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -657,11 +657,12 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
// The 4 byte offset to the debug abbrevs from the start of the .debug_abbrev,
// it is at the start of that section so this is zero.
- if (AbbrevSectionSymbol) {
- MCOS->EmitSymbolValue(AbbrevSectionSymbol, 4);
- } else {
+ if (AbbrevSectionSymbol == nullptr)
MCOS->EmitIntValue(0, 4);
- }
+ else if (context.getAsmInfo()->needsDwarfSectionOffsetDirective())
+ MCOS->EmitCOFFSecRel32(AbbrevSectionSymbol);
+ else
+ MCOS->EmitSymbolValue(AbbrevSectionSymbol, 4);
const MCAsmInfo *asmInfo = context.getAsmInfo();
int AddrSize = asmInfo->getPointerSize();
OpenPOWER on IntegriCloud