aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCDwarf.cpp
diff options
context:
space:
mode:
authorIgor Kudrin <ikudrin@accesssoftek.com>2020-06-03 16:51:07 +0700
committerIgor Kudrin <ikudrin@accesssoftek.com>2020-06-16 15:50:14 +0700
commit1e081342d4bb8963080b5a401d1740c0dc203639 (patch)
tree869e42fa603f9181af5396e2ffa4e676fca31e3f /llvm/lib/MC/MCDwarf.cpp
parentab7458fb04ae6e12925fd85f2277bb9fa78d61eb (diff)
downloadllvm-1e081342d4bb8963080b5a401d1740c0dc203639.zip
llvm-1e081342d4bb8963080b5a401d1740c0dc203639.tar.gz
llvm-1e081342d4bb8963080b5a401d1740c0dc203639.tar.bz2
[MC] Fix DWARF forms for 64-bit DWARFv3 files [6/7]
DW_FORM_sec_offset was introduced in DWARFv4, so, for 64-bit DWARFv3, DW_FORM_data8 should be used instead. Differential Revision: https://reviews.llvm.org/D81148
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r--llvm/lib/MC/MCDwarf.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index d727de4..3bb1f42 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -833,14 +833,15 @@ static void EmitGenDwarfAbbrev(MCStreamer *MCOS) {
MCOS->emitULEB128IntValue(1);
MCOS->emitULEB128IntValue(dwarf::DW_TAG_compile_unit);
MCOS->emitInt8(dwarf::DW_CHILDREN_yes);
- EmitAbbrev(MCOS, dwarf::DW_AT_stmt_list, context.getDwarfVersion() >= 4
- ? dwarf::DW_FORM_sec_offset
- : dwarf::DW_FORM_data4);
+ dwarf::Form SecOffsetForm =
+ context.getDwarfVersion() >= 4
+ ? dwarf::DW_FORM_sec_offset
+ : (context.getDwarfFormat() == dwarf::DWARF64 ? dwarf::DW_FORM_data8
+ : dwarf::DW_FORM_data4);
+ EmitAbbrev(MCOS, dwarf::DW_AT_stmt_list, SecOffsetForm);
if (context.getGenDwarfSectionSyms().size() > 1 &&
context.getDwarfVersion() >= 3) {
- EmitAbbrev(MCOS, dwarf::DW_AT_ranges, context.getDwarfVersion() >= 4
- ? dwarf::DW_FORM_sec_offset
- : dwarf::DW_FORM_data4);
+ EmitAbbrev(MCOS, dwarf::DW_AT_ranges, SecOffsetForm);
} else {
EmitAbbrev(MCOS, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr);
EmitAbbrev(MCOS, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr);