This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix split-dwarf not emitting DW_OP_WASM_location correctly
ClosedPublic

Authored by aardappel on Feb 26 2021, 9:56 AM.

Details

Summary

It was using the regular path for target indices that uses uleb, but TI_GLOBAL_RELOC needs to be uint32_t.
Introduced here: https://reviews.llvm.org/D85685
Fixes: https://github.com/emscripten-core/emscripten/issues/13240

Diff Detail

Event Timeline

aardappel created this revision.Feb 26 2021, 9:56 AM
aardappel requested review of this revision.Feb 26 2021, 9:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2021, 9:56 AM

Would it make sense to also run e.g. llvm/test/MC/WebAssembly/debug-localvar.ll with split-dwarf?

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
475

Can we assert that the index is 0?

Would it make sense to also run e.g. llvm/test/MC/WebAssembly/debug-localvar.ll with split-dwarf?

That file doesn't contain a use of TI_GLOBAL_RELOC, so I instead added to dwarfdump.ll. Sadly the split dwarf output is sufficiently different in many places that my attempt to interleave it with the regular output became too unreadable, so it is now a side-by-side output.

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
475

Yup that is already done a little up from this code:

assert(FrameBase.Location.WasmLoc.Index == 0); // Only SP so far.

dschuff accepted this revision.Feb 26 2021, 1:13 PM

otherwise LGTM

This revision is now accepted and ready to land.Feb 26 2021, 1:13 PM
dschuff added inline comments.Feb 26 2021, 1:16 PM
llvm/test/MC/WebAssembly/dwarfdump.ll
68

wait, did my comment get eaten by Phabricator?

This path check will presumably fail on non-windows. I guess it's because %s gets expanded to an absolute path by lit. I guess we could just check for a regex that only matches DW_AT_GNU_dwo_name, and the filename?

aardappel updated this revision to Diff 327224.Mar 1 2021, 11:50 AM

Fixed windows path & test leaving non-temp files behind.

aardappel added inline comments.Mar 1 2021, 11:52 AM
llvm/test/MC/WebAssembly/dwarfdump.ll
68

Thanks, nice catch.. would have definitely broken the build.

This revision was landed with ongoing or failed builds.Mar 1 2021, 11:53 AM
This revision was automatically updated to reflect the committed changes.