From a57ff3c61125b890dbd5f4937e6c9ea26c830cfc Mon Sep 17 00:00:00 2001 From: Paolo Severini Date: Wed, 27 May 2020 08:03:46 -0700 Subject: Fix DWARF location list updating with nonzero compilation unit base addr (#2862) In the .debug_loc section the Start/End address offsets in a location list are relative to the address of the compilation unit that refers that location list. There is a problem in function wasm::Debug:: updateLoc(), which compares these offsets with the actual module addresses of expressions and functions, causing the generation of invalid location lists. The fix is not trivial, because the DWARF debug_loc section does not specify which is the compilation unit associated to each location list entry. A simple workaround is to store, in LocationUpdater, a map of location list offsets to the base address of the compilation units referencing them, and that can be easily calculated in updateDIE(). --- third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h | 1 + 1 file changed, 1 insertion(+) (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 948418c7b..bd4aa2007 100644 --- a/third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h +++ b/third_party/llvm-project/include/llvm/ObjectYAML/DWARFYAML.h @@ -82,6 +82,7 @@ struct Loc { uint32_t Start; uint32_t End; std::vector Location; + uint64_t CompileUnitOffset; }; // XXX BINARYEN --> -- cgit v1.2.3