Previous topic

Next topic

This Page

Quick search

The WebAssembly version of lld takes WebAssembly binaries as inputs and produces
a WebAssembly binary as its output. For the most part it tries to mimic the
behaviour of traditional ELF linkers and specifically the ELF lld port. Where
possible that command line flags and the semantics should be the same.

This is object format that the llvm will produce when run with the
wasm32-unknown-unknown target. To build llvm with WebAssembly support
currently requires enabling the experimental backed using
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly.

Relocation targets in the code section 5-bytes wide in order to potentially
occomate the largest LEB128 value. This option will cause the linker to
shirnk the code section to remove any padding from the final output. However
because it effects code offset, this option is not comatible with outputing
debug information.

By default the function table is neither imported nor exported, but defined
for internal use only.

When building shared libraries symbols are exported if they are marked
as visibility=default. When building executables only the entry point is
exported by default. In addition any symbol included on the command line via
--export is also exported.

Since WebAssembly is designed with size in mind the linker defaults to
--gc-sections which means that all unused functions and data segments will
be stripped from the binary.