Open Quuxplusone opened 6 years ago
Sorry I only just saw this. Is this still and issue for you?
We do still currently have the relevant block of code to work around this 1, although we haven't tried removing it recently to see if it's still a problem in upstream LLVM
We've recently upgraded to LLVM 7 in the Rust compiler and have started seeing some odd behavior on WebAssembly combined with ThinLTO. We're using LLVM's
wasm.custom_sections
metadata to create custom sections, but the encoding via a MDNode seems to cause ThinLTO passes to duplicate it accidentally.Specifically what we're seeing is that we've got two modules A and B. We define a wasm custom section metadata node in module A, but if B imports some functions from A during the ThinLTO passes then it will also import the named MDNode instances from A, causing both A and B to have wasm custom sections defined.
I believe the relevant code is around here -- https://github.com/llvm-mirror/llvm/blob/e5c7b32694a7580b9e7fcd0f1654ac205fc4eea0/lib/Linker/IRMover.cpp#L1105-L1117. Would it be possible to add a special case there to ignore the wasm.custom_section metadata? Or should we be preventing this through some other means?