From a355a7ea6151d4bd6dbb7895317fba0f3e8e422f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 7 Aug 2020 10:45:15 -0700 Subject: DWARF: Fix debug_info references to the abbreviations section (#2997) The previous code assumed that each compile unit had its own abbreviation section, and they are all in order. That's normally how LLVM emits things, but in #2992 there is a testcase in which linking of object files with IR files somehow ends up with a different order. The proper fix is to track the binary offsets of abbreviations in the abbreviation section. That section is comprised of null-terminated lists, which each CU has an offset to the beginning of. With those offsets, we can match things properly. Add a testcase that crashes without this, to prevent regressions. Fixes #2992 Fixes #3007 --- third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h') diff --git a/third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h b/third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h index bd4aa2007..818bddede 100644 --- a/third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h +++ b/third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h @@ -55,6 +55,16 @@ struct Abbrev { llvm::dwarf::Tag Tag; llvm::dwarf::Constants Children; std::vector Attributes; + // XXX BINARYEN: Represent the binary offset in the abbreviation section for + // this abbreviation's list. The abbreviation section has multiple lists, + // each null-terminated, and those lists are what are referred to by compile + // units by offset. We need to match the offset in a compile unit to the + // abbreviation at that offset (which must be the beginning of an + // abbreviation list, that is, either the very first element, or after a null + // terminator). All abbreviations in the same list have the same offset + // (DWARFAbbreviationDeclarationSet does not track anything else, and we don't + // need it). + uint64_t ListOffset; }; struct ARangeDescriptor { -- cgit v1.2.3