read/wasm: Expose data segments and linking SegmentInfo#901
read/wasm: Expose data segments and linking SegmentInfo#901lapla-cogito wants to merge 2 commits into
linking SegmentInfo#901Conversation
| Flags: None | ||
| Relative Address Base: 0 | ||
| Entry Address: 0 | ||
| Segment { name: ".rodata..L.str", address: 0, size: d, permissions: RW- } |
There was a problem hiding this comment.
My expectation is that a relocatable object file wouldn't have any segments, and the name given here looks more like a section name to me. Maybe this should be a section instead?
|
I'm starting to realise that the Wasm support in this crate is a little flawed. The problem is that the Wasm file structure is quite different from other file formats, and doesn't fit cleanly in the unified API. We currently treat a Wasm section as the same thing as a section in other file formats, but I don't think we should. Semantically, a Wasm section is closer to a Mach-O load command or a PE data directory entry. In particular, for data I don't think that a Wasm data section should be exposed in the unified API. It's merely a file format container for the data segments, and it is those data segments which are closer in meaning to an For the purposes of reading a relocatable object file, So if your goal with this PR is read the Wasm data segments from a relocatable object file, then I think a different change is needed. Exposing the Wasm data segments as |
Object::segments()previously returned nothing for wasm files becauseWasmSegmentandWasmSegmentIteratorwere stubs, and theSegmentInfosubsection of thelinkingcustom section was never parsed.