<div dir="ltr"><div>Hi Sam,</div><div><br></div><div>First, I want to know the symbol resolution semantics. I can imagine that that is set in stone yet, but just that you guys are still discussing what would be the best semantics or file format for the linkable wasm object file. I think by knowing more about the format and semantics, we can give you guys valuable feedback, as we've been actively working on the linker for a few years now. (And we know a lot of issues in existing object file format, so I don't want you guys to copy these failures.)</div><div><br></div>As Sean pointed out, this looks very different from ELF or COFF in object construction. Does this mean the linker has to reconstruct everything? The ELF and COFF linkers are multi-threaded, as each thread can work on different sections simultaneously when writing to an output file. I wonder if it's still doable in wasm.<div><br></div><div>Also, I wonder if there's a way to parallelize symbol resolution. Since there's no linkable wasm programs, we can take a radical approach.</div><div><br></div><div>Have you ever considered making the file format more efficiently than ELF or COFF so that they are linked really fast? For example, in order to avoid a lot of (possibly very long due to name mangling) symbols, you could store SHA hashes or something so that linkers are able to handle symbols as an array of fixed-size elements.</div><div><br></div><div>That is just an example. There are a lot of possible improvements we can make for a completely new file format.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 30, 2017 at 5:19 PM, Sean Silva via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Can you link to docs about the wasm object format? (both relocatable and executable)<div><br></div><div>Also, traditional object file linkers are primarily concerned with concatenating binary blobs with small amount of patching of said binary blobs based on computed virtual (memory) addresses. Or perhaps to put it another way, what traditional object file linkers do is construct program images meant to be mapped directly into memory.</div><div><br></div><div>My understanding is that wasm is pretty different from this (though "linker frontend" things like the symbol resolution process is presumably similar). Looking at Writer::run in your patch it seems like wasm is indeed very different. E.g. the linker is aware of things like "types" and knowing internal structure of functions (e.g. write_sig knows about how many parameters a function has)</div><div><br></div><div>Can you elaborate on semantically what the linker is actually doing for wasm?</div><div><br></div><div>-- Sean Silva</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 30, 2017 at 4:46 PM, Sam Clegg via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi llvmers,<br>
<br>
As you may know, work has been progressing on the experimental<br>
WebAssembly backend in llvm. However, there is currently not a good<br>
linking story. Most the of existing linking strategies (i.e. those in<br>
the emscripten toolchain) involve bitcode linking and whole program<br>
compilation at link time.<br>
<br>
To improve this situation I've been working on adding a wasm backend<br>
for lld. My current work is here: <a href="https://reviews.llvm.org/D34851" rel="noreferrer" target="_blank">https://reviews.llvm.org/D3485<wbr>1</a><br>
<br>
Although this port is not ready for production use (its missing<br>
several key features such as comdat support and full support for weak<br>
aliases) its already getting a some testing on the wasm waterfall:<br>
<a href="https://wasm-stat.us/builders/linux" rel="noreferrer" target="_blank">https://wasm-stat.us/builders/<wbr>linux</a><br>
<br>
I'm hopeful that my patch may now be at an MVP stage that could be<br>
considered for merging into upstream lld. Thoughts? LLD maintainers,<br>
would you support the addition of a new backend?<br>
<br>
cheers,<br>
sam<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>