[lld] [lld][WebAssembly] Match the ELF linker in transitioning away from archive indexes. (PR #78658)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 14:04:30 PST 2024


sbc100 wrote:

> Aha it appears my memory has definitely failed me! IIRC we didn't use the wasm object file format because we couldn't figure out at the time how to encode the metadata somewhere such that `wasm-ld` wouldn't include it in the output. In other backends [flags are set](https://github.com/rust-lang/rust/blob/cb4d9a1902b3ea17e93872dafb76d24aa6295c47/compiler/rustc_codegen_ssa/src/back/metadata.rs#L469-L476) such as `SHF_EXCLUDE` to keep the `.rmeta` section out of the final output but we couldn't figure out the equivalent for wasm.
> 
> Do you know of a way that metadata could be placed into a wasm-looking object file in a way that doesn't end up in the final output?

Since these object would never be referenced via relocations they should never be included at all, right?

I suppose the exception would be if `--whole-archive` was used.    If you are worried about that case then I think we should be able to just use custom sections (IIRC the default behaviour is to ignore custom sections.. but I would need to check).

https://github.com/llvm/llvm-project/pull/78658


More information about the llvm-commits mailing list