Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustbuild: Update LLVM and enable ThinLTO #46008

Merged
merged 2 commits into from Nov 25, 2017

Conversation

alexcrichton
Copy link
Member

This commit updates LLVM to fix #45511 (https://reviews.llvm.org/D39981) and
also reenables ThinLTO for libtest now that we shouldn't hit #45768. This also
opportunistically enables ThinLTO for libstd which was previously blocked
(#45661) on test failures related to debuginfo with a presumed cause of #45511.

Closes #45511

@alexcrichton
Copy link
Member Author

r? @Mark-Simulacrum

@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 15, 2017

📌 Commit bf3320f has been approved by Mark-Simulacrum

@kennytm kennytm added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Nov 15, 2017
@bors
Copy link
Contributor

bors commented Nov 17, 2017

☔ The latest upstream changes (presumably #45897) made this pull request unmergeable. Please resolve the merge conflicts.

@alexcrichton
Copy link
Member Author

@bors: r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Nov 17, 2017

📌 Commit e18dbaa has been approved by Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Nov 18, 2017

⌛ Testing commit e18dbaa64dbc63737a0abc9432cac886b89c286c with merge 557e2ccf38ae65cb1522a7c755809104cb8b18a5...

@bors
Copy link
Contributor

bors commented Nov 18, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Nov 18, 2017

dist-arm-linux, cannot link stage1-rustc (libsyntax) due to multiple definitions of __aeabi_fdiv, legit.

[01:01:20] �[1m�[31merror�(B�[m�[1m: linking with `arm-unknown-linux-gnueabi-gcc` failed: exit code: 1�(B�[m
[01:01:20]   �(B�[m�[1m�[34m|�(B�[m
[01:01:20]   �(B�[m�[1m�[34m= �(B�[m�[1mnote�(B�[m: "arm-unknown-linux-gnueabi-gcc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/arm-unknown-linux-gnueabi/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax0-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax1-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax10-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax11-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax12-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax13-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax14-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax15-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax2-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax3-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax4-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax5-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax6-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax7-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax8-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.syntax9-c38c37e60f6bc02ccbfb3c47153244d8.rs.rcgu.o" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/libsyntax-da324b40dbd1707b.so" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.crate.metadata.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps/syntax-da324b40dbd1707b.crate.allocator.rcgu.o" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/release/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/arm-unknown-linux-gnueabi/lib" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps" "-l" "rustc_errors-38dc6f56c6f3e470" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps" "-l" "syntax_pos-e1b64a531751f08f" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/arm-unknown-linux-gnueabi/lib" "-l" "term-73d4291f5f301774" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps" "-l" "rustc_cratesio_shim-d04f99081b870673" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps" "-l" "rustc_data_structures-1f05fe4a3e3866a7" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/arm-unknown-linux-gnueabi/release/deps" "-l" "serialize-7e0f7d3708829388" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/arm-unknown-linux-gnueabi/lib" "-l" "std-9a578f4fbc9ae048" "-Wl,-Bstatic" "/tmp/rustc.x1VvxgXhooxy/libcompiler_builtins-bbd71924f060874e.rlib" "-Wl,-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util" "-l" "util" "-shared" "-Wl,-rpath,$ORIGIN/../lib"�(B�[m
[01:01:21]   �(B�[m�[1m�[34m= �(B�[m�[1mnote�(B�[m: /tmp/rustc.x1VvxgXhooxy/libcompiler_builtins-bbd71924f060874e.rlib(compiler_builtins-bbd71924f060874e.compiler_builtins10-579b32a8609b6b5b1087dd35d80b481e.rs.rcgu.o): In function `compiler_builtins::float::div::__divsf3::__aeabi_fdiv':�(B�[m
[01:01:21]           /checkout/src/rustc/compiler_builtins_shim/../../libcompiler_builtins/src/float/div.rs:446: multiple definition of `__aeabi_fdiv'�(B�[m
[01:01:21]           /tmp/rustc.x1VvxgXhooxy/libcompiler_builtins-bbd71924f060874e.rlib(divsf3.o):divsf3.c:(.text.__divsf3+0x0): first defined here�(B�[m
[01:01:21]           collect2: error: ld returned 1 exit status�(B�[m
[01:01:21]           �(B�[m
[01:01:21] 
[01:01:21] �[1m�[31merror�(B�[m�[1m: aborting due to previous error�(B�[m
[01:01:21] 
[01:01:21] �[m�[m�[31m�[1merror:�[m Could not compile `syntax`.

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 18, 2017
@kennytm
Copy link
Member

kennytm commented Nov 18, 2017

cc #44899 — This PR contains the fix for that issue as well.

@alexcrichton
Copy link
Member Author

Looks like that was accidentally caused by rust-lang/compiler-builtins#206

@alexcrichton
Copy link
Member Author

in that we forgot this commit -- rust-lang/compiler-builtins@02b3734

@alexcrichton
Copy link
Member Author

@bors: r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Nov 19, 2017

📌 Commit 78e13ba has been approved by Mark-Simulacrum

@kennytm kennytm added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 19, 2017
@bors
Copy link
Contributor

bors commented Nov 20, 2017

⌛ Testing commit 78e13ba6b969cf81a331869b891abb286346d453 with merge a25d81b2707b712d6b3f6b16ad7e09bfcf995be2...

@bors
Copy link
Contributor

bors commented Nov 20, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member Author

@bors: retry

@kennytm I think that's the second (hopefully) spurious failure related to sanitizers, right?

@kennytm
Copy link
Member

kennytm commented Nov 20, 2017

@alexcrichton Given that ThinLTO also affects sanitizers (#45220), I'm not so sure it is spurious or not. Let's see what bors says.

@alexcrichton
Copy link
Member Author

Turns out using LTO on Windows means you currently don't run any thread local destructors at all. Using ThinLTO just exposed this. Let's try again!

@bors: r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Nov 24, 2017

📌 Commit 7bed281 has been approved by Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Nov 24, 2017

⌛ Testing commit 7bed281dc022806efd1104e91a727fb66470d916 with merge c7b11f98b67ce0761fcda5f77ce7b33eadddf716...

@kennytm kennytm added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 24, 2017
@bors
Copy link
Contributor

bors commented Nov 24, 2017

💔 Test failed - status-travis

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 24, 2017
@kennytm
Copy link
Member

kennytm commented Nov 24, 2017

The -C lto flag in the new test conflicts with -C prefer-dynamic.

Perhaps add a // no-prefer-dynamic header.

[00:50:01] ---- [run-pass] run-pass/lto-still-runs-thread-dtors.rs stdout ----
[00:50:01] 	
[00:50:01] error: compilation failed!
[00:50:01] status: exit code: 101
[00:50:01] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/lto-still-runs-thread-dtors.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/lto-still-runs-thread-dtors.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-C" "lto" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/lto-still-runs-thread-dtors.stage2-x86_64-unknown-linux-gnu.aux"
[00:50:01] stdout:
[00:50:01] ------------------------------------------
[00:50:01] 
[00:50:01] ------------------------------------------
[00:50:01] stderr:
[00:50:01] ------------------------------------------
[00:50:01] thread '<unnamed>' panicked at 'Box<Any>', /checkout/src/librustc_trans/back/write.rs:585:28
[00:50:01] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:50:01] error: cannot prefer dynamic linking when performing LTO
[00:50:01] 
[00:50:01] note: only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO
[00:50:01] 
[00:50:01] error: aborting due to previous error

@alexcrichton
Copy link
Member Author

@bors: r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Nov 24, 2017

📌 Commit 9714458 has been approved by Mark-Simulacrum

@kennytm kennytm added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 24, 2017
@bors
Copy link
Contributor

bors commented Nov 24, 2017

⌛ Testing commit 9714458100b3b3e883d0814cc66b3bb53df323bf with merge 8b2526dd476884c6f2422fb3d58a2a19b0c46e1e...

@bors
Copy link
Contributor

bors commented Nov 24, 2017

💔 Test failed - status-travis

Turns out ThinLTO was internalizing this symbol and eliminating it. Worse yet if
you compiled with LTO turns out no TLS destructors would run on Windows! The
`#[used]` annotation should be a more bulletproof implementation (in the face of
LTO) of preserving this symbol all the way through in LLVM and ensuring it makes
it all the way to the linker which will take care of it.
@alexcrichton
Copy link
Member Author

@bors: r=Mark-Simulacrum

Woe unto thee who decides to add a test

@bors
Copy link
Contributor

bors commented Nov 24, 2017

📌 Commit 95e9609 has been approved by Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Nov 25, 2017

⌛ Testing commit 95e9609 with merge db16292...

bors added a commit that referenced this pull request Nov 25, 2017
rustbuild: Update LLVM and enable ThinLTO

This commit updates LLVM to fix #45511 (https://reviews.llvm.org/D39981) and
also reenables ThinLTO for libtest now that we shouldn't hit #45768. This also
opportunistically enables ThinLTO for libstd which was previously blocked
(#45661) on test failures related to debuginfo with a presumed cause of #45511.

Closes #45511
@bors
Copy link
Contributor

bors commented Nov 25, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: Mark-Simulacrum
Pushing db16292 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ThinLTO generates bad DWARF for libtest
4 participants