diff options
author | Wouter van Oortmerssen <aardappel@gmail.com> | 2020-11-13 12:24:36 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-13 12:24:36 -0800 |
commit | cc2b3e4175a6edc53487eec06da13b39eb66716b (patch) | |
tree | 3cc3aca2957c1755f19a1f16a22397d6e83dcab5 /src | |
parent | 0497619b7e6bc449f07778576ed53ff8297d66e3 (diff) | |
download | binaryen-cc2b3e4175a6edc53487eec06da13b39eb66716b.tar.gz binaryen-cc2b3e4175a6edc53487eec06da13b39eb66716b.tar.bz2 binaryen-cc2b3e4175a6edc53487eec06da13b39eb66716b.zip |
[wasm64] fix for Memory64Lowering affecting DWARF data (#3348)
We change the AddrSize which causes all DW_FORM_addr to be written differently.
Depends on https://reviews.llvm.org/D91395
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm/wasm-debug.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/wasm/wasm-debug.cpp b/src/wasm/wasm-debug.cpp index 448bcaaa9..2e7a10071 100644 --- a/src/wasm/wasm-debug.cpp +++ b/src/wasm/wasm-debug.cpp @@ -853,7 +853,8 @@ static void updateDIE(const llvm::DWARFDebugInfoEntry& DIE, static void updateCompileUnits(const BinaryenDWARFInfo& info, llvm::DWARFYAML::Data& yaml, - LocationUpdater& locationUpdater) { + LocationUpdater& locationUpdater, + bool is64) { // The context has the high-level information we need, and the YAML is where // we write changes. First, iterate over the compile units. size_t compileUnitIndex = 0; @@ -862,6 +863,13 @@ static void updateCompileUnits(const BinaryenDWARFInfo& info, yaml.CompileUnits, [&](const std::unique_ptr<llvm::DWARFUnit>& CU, llvm::DWARFYAML::Unit& yamlUnit) { + // Our Memory64Lowering pass may change the "architecture" of the DWARF + // data. AddrSize will cause all DW_AT_low_pc to be written as 32/64-bit. + auto NewAddrSize = is64 ? 8 : 4; + if (NewAddrSize != yamlUnit.AddrSize) { + yamlUnit.AddrSize = NewAddrSize; + yamlUnit.AddrSizeChanged = true; + } // Process the DIEs in each compile unit. iterContextAndYAML( CU->dies(), @@ -1039,7 +1047,7 @@ void writeDWARFSections(Module& wasm, const BinaryLocations& newLocations) { updateDebugLines(data, locationUpdater); - updateCompileUnits(info, data, locationUpdater); + updateCompileUnits(info, data, locationUpdater, wasm.memory.is64()); updateRanges(data, locationUpdater); |