]> git.lizzy.rs Git - rust.git/commit
rustc: Work around an upstream wasm ThinLTO bug
authorAlex Crichton <alex@alexcrichton.com>
Wed, 18 Jul 2018 19:12:53 +0000 (12:12 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 18 Jul 2018 19:12:53 +0000 (12:12 -0700)
commite08fcbbd8d241ab68d72dc8b288ca55b8c1114fe
treeeddeeb70161b48a90aa6b3e2e79d9395830df24d
parent12ed235adc62e63b16bb4f715b143c37a5efa00d
rustc: Work around an upstream wasm ThinLTO bug

This commit implements a workaround for an [upstream LLVM bug][1] where custom
sections were accidentally duplicated amongst codegen units when ThinLTO passes
were performed. This is due to the fact that custom sections for wasm are stored
as metadata nodes which are automatically imported into modules when ThinLTO
happens. The fix here is to forcibly delete the metadata node from imported
modules before LLVM has a chance to try to copy it over.

[1]: https://bugs.llvm.org/show_bug.cgi?id=38184
src/rustllvm/PassWrapper.cpp
src/test/run-make/wasm-custom-sections-opt/Makefile [new file with mode: 0644]
src/test/run-make/wasm-custom-sections-opt/foo.js [new file with mode: 0644]
src/test/run-make/wasm-custom-sections-opt/foo.rs [new file with mode: 0644]