diff options
| -rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 3 | ||||
| -rw-r--r-- | llvm/test/DebugInfo/Inputs/dwarfdump-abbrev-off.elf-x86-64 | bin | 0 -> 2720 bytes | |||
| -rw-r--r-- | llvm/test/DebugInfo/dwarfdump-abbrev-off.test | 8 |
3 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index 2ddbc507ff6..8e5691aebab 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -87,7 +87,10 @@ bool DWARFUnit::getStringOffsetSectionItem(uint32_t Index, bool DWARFUnit::extractImpl(DataExtractor debug_info, uint32_t *offset_ptr) { Length = debug_info.getU32(offset_ptr); Version = debug_info.getU16(offset_ptr); + auto AI = InfoSection.Relocs.find(*offset_ptr); uint64_t AbbrOffset = debug_info.getU32(offset_ptr); + if (AI != InfoSection.Relocs.end()) + AbbrOffset += AI->second.second; if (IndexEntry) { if (AbbrOffset) return false; diff --git a/llvm/test/DebugInfo/Inputs/dwarfdump-abbrev-off.elf-x86-64 b/llvm/test/DebugInfo/Inputs/dwarfdump-abbrev-off.elf-x86-64 Binary files differnew file mode 100644 index 00000000000..bc196b5995b --- /dev/null +++ b/llvm/test/DebugInfo/Inputs/dwarfdump-abbrev-off.elf-x86-64 diff --git a/llvm/test/DebugInfo/dwarfdump-abbrev-off.test b/llvm/test/DebugInfo/dwarfdump-abbrev-off.test new file mode 100644 index 00000000000..2937d8cbdde --- /dev/null +++ b/llvm/test/DebugInfo/dwarfdump-abbrev-off.test @@ -0,0 +1,8 @@ +RUN: llvm-dwarfdump -debug-dump=info %p/Inputs/dwarfdump-abbrev-off.elf-x86-64 | FileCheck %s + +Check that we apply relocations to the abbr_offset - while LLVM never produces +an object file like this, a reproduction can be produced by linking two simple +object files together with ld -r. + +CHECK: abbr_offset = 0x0000 +CHECK: abbr_offset = 0x0010 |

