If the final linked binary contains undefined data symbols
generate inputs for these, just like we do for undefined
functions
Details
Diff Detail
- Repository
- rLLD LLVM Linker
- Build Status
Buildable 17956 Build 17956: arc lint + arc unit
Event Timeline
Hmm, does this work? I mean I can see that it generates an imported global of course, but it doesn't do anything. The code that actually references the import is still going to have 0 written in as the value of the relocation!
The "fake globals" that are currently exported for defined data are at least usable in JavaScript, as a way of finding out the address to write to when you want to modify the variable. Is there a similar use (at this stage) for these imported globals?
Maybe hold off merging this until the discussion has come up with a full solution to the problem (assuming that this is the same as https://github.com/WebAssembly/tool-conventions/issues/48).
You are right, the imported globals are never used.
And yes this was as first step to solving https://github.com/WebAssembly/tool-conventions/issues/48.
And yes I agree we probably don't want to land this without the imports actually being used.
And yes, sadly we do have use case for this, in emscripten. I injects the addresses of globals in this way.. something I only just discovered :(