summaryrefslogtreecommitdiff
path: root/third_party/llvm-project/DWARFEmitter.cpp
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2021-03-08 15:19:32 -0800
committerGitHub <noreply@github.com>2021-03-08 15:19:32 -0800
commitef52d84bf6204a8a0f9348a9cc89e618526b8aae (patch)
treeaf83bcb879b1956c0b458f2895ffd966461cd5d1 /third_party/llvm-project/DWARFEmitter.cpp
parent89b8af006bc56cb4bf68f12a80b1cfe8e7a353d4 (diff)
downloadbinaryen-ef52d84bf6204a8a0f9348a9cc89e618526b8aae.tar.gz
binaryen-ef52d84bf6204a8a0f9348a9cc89e618526b8aae.tar.bz2
binaryen-ef52d84bf6204a8a0f9348a9cc89e618526b8aae.zip
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.
Diffstat (limited to 'third_party/llvm-project/DWARFEmitter.cpp')
-rw-r--r--third_party/llvm-project/DWARFEmitter.cpp6
1 files changed, 4 insertions, 2 deletions
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;