WasmObjectWriter mostly operates with function segments offsets that do not
include their size fields. WasmObjectFile needs to have and provide this
information to the lld to maintain proper R_WEBASSEMBLY_FUNCTION_OFFSET_I32
relocations entries.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Object/WasmObjectFile.cpp | ||
---|---|---|
878 ↗ | (On Diff #146370) | As an alternative, perhaps we could just move the const uint8_t *FunctionStart = Ptr; down a couple of lines so that the function body no longer includes its size? The downside would be that the linker would need to re-encode the size for each function. @aardappel was recently looking making objdump -d work and he ran into issues relating to pointer the actual start of the instructions. Having said all that, this seems like a perfectly reasonable interim fix. |
lib/Object/WasmObjectFile.cpp | ||
---|---|---|
878 ↗ | (On Diff #146370) | I could already fix objdump to give correct output for wasm disassembly, but that would require a some wasm-specific parsing in objdump. Question is, can we do this more generically such that objdump does things correctly automatically? |
lib/Object/WasmObjectFile.cpp | ||
---|---|---|
878 ↗ | (On Diff #146370) | It looks like it is possible to exclude function size from data and use CodeSectionOffset as a start of the function. (LLD's CodeSection needs to be changed to generate function size/header) Would you like to do that instead? |