-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid DWARF wasm location with split-dwarf #13240
Comments
Does it work with We should probably make |
Does binaryen run with |
No. Binaryen only runs (optionally) during the link stage. |
The problem appears before binaryen then. My suspicion is that clang goes through a different codegen path for dwo files and @aardappel's reloc change is missing there. |
Sorry, I missed the |
My reloc change for reference: https://reviews.llvm.org/D77353 Writing this data happens during |
Should there be a check here whether the index is 0x3: |
Maybe an assert yes, as that code is only intended for values other than 3. Is split-dwarf causing these exps to be re-encoded, such that they go thru this generic path as opposed to the special purpose code in |
Does not repro using LLVM directly as such:
The only way the .ll file appears to honor the |
This is using LLVM from |
I just reproduced this with emcc tot:
|
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: emscripten-core/emscripten#13240 Differential Revision: https://reviews.llvm.org/D97564
Verified the fix with 2.0.15, thanks! |
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: emscripten-core/emscripten#13240 Differential Revision: https://reviews.llvm.org/D97564
When compiling with split-dwarf, Emscripten emits broken locations for wasm globals.
Reproducer:
Compile this snippet with
emcc -O1 -g -c
and withemcc -O1 -g -c -gsplit-dwarf
.In the first case, llvm-dwarfdump shows the correct
DW_AT_frame_base (DW_OP_WASM_location 0x3 0x0, DW_OP_stack_value)
.In the second case, the output is:
DW_AT_frame_base (DW_OP_WASM_location 0x3 0x0, <decoding error> 00 9f)
In that case, the location is encoded as
0xed 0x03 0x0 0x9f
even though the second argument to WASM_location should be a DW_FORM_data4, i.e., a uint32, but it's encoded as a ULEB here. In the first case, emscripten gets it right.The text was updated successfully, but these errors were encountered: