From ef52d84bf6204a8a0f9348a9cc89e618526b8aae Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Mon, 8 Mar 2021 15:19:32 -0800 Subject: Fixed .debug_loc parsing for wasm64 files (#3660) The address size was hard-coded to 4, it now gets this information from .debug_info. This required changing the parsing order. Also made failure to parse .debug_loc fail the program, as before this error was easy to ignore. --- third_party/llvm-project/DWARFEmitter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'third_party/llvm-project/DWARFEmitter.cpp') diff --git a/third_party/llvm-project/DWARFEmitter.cpp b/third_party/llvm-project/DWARFEmitter.cpp index aa0465d9b..1dc59ed53 100644 --- a/third_party/llvm-project/DWARFEmitter.cpp +++ b/third_party/llvm-project/DWARFEmitter.cpp @@ -133,8 +133,10 @@ void DWARFYAML::EmitDebugRanges(raw_ostream &OS, const DWARFYAML::Data &DI) { // XXX BINARYEN void DWARFYAML::EmitDebugLoc(raw_ostream &OS, const DWARFYAML::Data &DI) { for (auto Loc : DI.Locs) { - writeInteger((uint32_t)Loc.Start, OS, DI.IsLittleEndian); - writeInteger((uint32_t)Loc.End, OS, DI.IsLittleEndian); + auto AddrSize = DI.CompileUnits[0].AddrSize; // XXX BINARYEN + // FIXME: Loc.Start etc should probably not be 32-bit. + writeVariableSizedInteger((uint64_t)(int32_t)Loc.Start, AddrSize, OS, DI.IsLittleEndian); + writeVariableSizedInteger((uint64_t)(int32_t)Loc.End, AddrSize, OS, DI.IsLittleEndian); if (Loc.Start == 0 && Loc.End == 0) { // End of a list. continue; -- cgit v1.2.3