This ensures that each segment has a unique address.
Without this, consecutive zero sized symbols would
end up with the same address and the linker cannot
map symbols to unique data segments.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Symbols can have the same value. The problem I was running into was when a zero sized symbol was at the end of segment its not possible know if its pointing to the end one of segment of the beginning on the next. An alternative would be store the segment index for each symbol.
lib/MC/WasmObjectWriter.cpp | ||
---|---|---|
526 ↗ | (On Diff #119615) | should we set LastFragmentSize to the fill size here and/or for align frags above? I guess if the answer is "no" it's because they do not represent symbols? |
lib/MC/WasmObjectWriter.cpp | ||
---|---|---|
526 ↗ | (On Diff #119615) | Basically yes. Zero sized fill fragments do seem to exist but don't represent symbols. They seems to be generated to inject padded between elements of global arrays. So I don't think its possible to have a symbol point to them. I do think we might need a better solution to this issue in the long run though. Perhaps adding specifying explicitly which segment a symbol belongs too? |
Yeah, this seems OK for now.
I think at some point we may want to revisit the overall goals of the representation that we discussed originally (i.e. not having to encode a symbol table outside of wasm globals, a wasm object file possibly being directly loadable, etc), once we have a prototype and the constraints are clearer. Probably then it will be more clear what to do in cases like this.