Skip to content

SIGSEGV compiling bootstrap on aarch64-unknown-linux-gnu since LLVM 7 #53742

New issue

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

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

Already on GitHub? # to your account

Closed
parched opened this issue Aug 27, 2018 · 7 comments
Closed

SIGSEGV compiling bootstrap on aarch64-unknown-linux-gnu since LLVM 7 #53742

parched opened this issue Aug 27, 2018 · 7 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@parched
Copy link
Contributor

parched commented Aug 27, 2018

Building Rust fails while compiling bootstrap. I managed to narrow it down while compiling beta (5c5be09) and setting build.rustc.

rustc 1.29.0-nightly (64f7de9 2018-07-12)

doesn't work

rustc 1.29.0-nightly (e5f6498 2018-07-10)

does work. So I believe it's a bug in LLVM 7

Maybe it's fixed by llvm-mirror/llvm@57aa5d9 in LLVM 7.0 RC2 but I haven't been able to try it yet.

Thread 30 "rustc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fae5bfed0 (LWP 14385)]
0x0000007fbb23f5b0 in llvm::AArch64RegisterBankInfo::getInstrMapping(llvm::MachineInstr const&) const ()
   from /home/jagduley/.rustup/toolchains/nightly-2018-07-13-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
(gdb) bt
#0  0x0000007fbb23f5b0 in llvm::AArch64RegisterBankInfo::getInstrMapping(llvm::MachineInstr const&) const ()
   from /home/jagduley/.rustup/toolchains/nightly-2018-07-13-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#1  0x0000007fbb2832c4 in llvm::RegBankSelect::assignInstr(llvm::MachineInstr&) ()
   from /home/jagduley/.rustup/toolchains/nightly-2018-07-13-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#2  0x0000007fbb28353c in llvm::RegBankSelect::runOnMachineFunction(llvm::MachineFunction&) ()
   from /home/jagduley/.rustup/toolchains/nightly-2018-07-13-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

It looks similar to #52884 but that has been fixed as I understand (I also get the problem using 'rustc 1.29.0-beta.7 (49720ea 2018-08-26)')

Full log

./x.py build --config config.toml -vvv
Updating only changed submodules
Submodules updated in 0.52 seconds
running: /home/jagduley/.cargo/bin/cargo build --manifest-path /home/jagduley/dev/rust/src/bootstrap/Cargo.toml --verbose --verbose
       Fresh unicode-xid v0.1.0                                                                                                                                       
       Fresh cc v1.0.18
       Fresh dtoa v0.4.3
       Fresh cfg-if v0.1.4
       Fresh ordermap v0.3.5
       Fresh fixedbitset v0.1.9
       Fresh itoa v0.4.2
       Fresh libc v0.2.42
       Fresh getopts v0.2.17
       Fresh build_helper v0.1.0 (file:///home/jagduley/dev/rust/src/build_helper)
       Fresh lazy_static v0.2.11
       Fresh proc-macro2 v0.4.8
       Fresh cmake v0.1.31
       Fresh petgraph v0.4.12
       Fresh num_cpus v1.8.0
       Fresh filetime v0.2.1
       Fresh time v0.1.40
       Fresh quote v0.6.3
       Fresh serde v1.0.70
       Fresh syn v0.14.4
       Fresh toml v0.4.6
       Fresh serde_json v1.0.24
       Fresh serde_derive v1.0.70
   Compiling bootstrap v0.0.0 (file:///home/jagduley/dev/rust/src/bootstrap)
     Running `/home/jagduley/.cargo/bin/rustc --crate-name bootstrap bootstrap/lib.rs --crate-type lib --emit=dep-info,link -C debug-assertions=off -C overflow-checks=on -C metadata=e19c4c4543ff4d18 -C extra-filename=-e19c4c4543ff4d18 --out-dir /home/jagduley/dev/rust/build/bootstrap/debug/deps -C incremental=/home/jagduley/dev/rust/build/bootstrap/debug/incremental -L dependency=/home/jagduley/dev/rust/build/bootstrap/debug/deps --extern build_helper=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libbuild_helper-b44f9ab7b190a804.rlib --extern cc=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libcc-f225328a0f59f427.rlib --extern cmake=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libcmake-6d38298082c5ac11.rlib --extern filetime=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libfiletime-d866b52d4d8fa9de.rlib --extern getopts=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libgetopts-83fd952ad8e839c3.rlib --extern lazy_static=/home/jagduley/dev/rust/build/bootstrap/debug/deps/liblazy_static-c9b1f81e8931854f.rlib --extern libc=/home/jagduley/dev/rust/build/bootstrap/debug/deps/liblibc-27b3233e806059ac.rlib --extern num_cpus=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libnum_cpus-94059903430f7c1c.rlib --extern petgraph=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libpetgraph-8a98459b4b2f5b60.rlib --extern serde=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libserde-4f813b6970c76624.rlib --extern serde_derive=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libserde_derive-343eae4f2fca76fb.so --extern serde_json=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libserde_json-9220186384b1645f.rlib --extern time=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libtime-3ecd8fdba96f8f4b.rlib --extern toml=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libtoml-2aca51dcd5fe933a.rlib -Cdebuginfo=2`
error: Could not compile `bootstrap`.

Caused by:
  process didn't exit successfully: `/home/jagduley/.cargo/bin/rustc --crate-name bootstrap bootstrap/lib.rs --crate-type lib --emit=dep-info,link -C debug-assertions=off -C overflow-checks=on -C metadata=e19c4c4543ff4d18 -C extra-filename=-e19c4c4543ff4d18 --out-dir /home/jagduley/dev/rust/build/bootstrap/debug/deps -C incremental=/home/jagduley/dev/rust/build/bootstrap/debug/incremental -L dependency=/home/jagduley/dev/rust/build/bootstrap/debug/deps --extern build_helper=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libbuild_helper-b44f9ab7b190a804.rlib --extern cc=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libcc-f225328a0f59f427.rlib --extern cmake=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libcmake-6d38298082c5ac11.rlib --extern filetime=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libfiletime-d866b52d4d8fa9de.rlib --extern getopts=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libgetopts-83fd952ad8e839c3.rlib --extern lazy_static=/home/jagduley/dev/rust/build/bootstrap/debug/deps/liblazy_static-c9b1f81e8931854f.rlib --extern libc=/home/jagduley/dev/rust/build/bootstrap/debug/deps/liblibc-27b3233e806059ac.rlib --extern num_cpus=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libnum_cpus-94059903430f7c1c.rlib --extern petgraph=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libpetgraph-8a98459b4b2f5b60.rlib --extern serde=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libserde-4f813b6970c76624.rlib --extern serde_derive=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libserde_derive-343eae4f2fca76fb.so --extern serde_json=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libserde_json-9220186384b1645f.rlib --extern time=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libtime-3ecd8fdba96f8f4b.rlib --extern toml=/home/jagduley/dev/rust/build/bootstrap/debug/deps/libtoml-2aca51dcd5fe933a.rlib -Cdebuginfo=2` (signal: 11, SIGSEGV: invalid memory reference)
Traceback (most recent call last):
  File "./x.py", line 20, in <module>
    bootstrap.main()
  File "/home/jagduley/dev/rust/src/bootstrap/bootstrap.py", line 843, in main
    bootstrap(help_triggered)
  File "/home/jagduley/dev/rust/src/bootstrap/bootstrap.py", line 819, in bootstrap
    build.build_bootstrap()
  File "/home/jagduley/dev/rust/src/bootstrap/bootstrap.py", line 646, in build_bootstrap
    run(args, env=env, verbose=self.verbose)
  File "/home/jagduley/dev/rust/src/bootstrap/bootstrap.py", line 148, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /home/jagduley/.cargo/bin/cargo build --manifest-path /home/jagduley/dev/rust/src/bootstrap/Cargo.toml --verbose --verbose
@parched
Copy link
Contributor Author

parched commented Aug 31, 2018

Actually, I think this is just #52884, I thought the fix had made it into beta but it hasn't. @alexcrichton, will b0337a8 go into beta?

@alexcrichton
Copy link
Member

@parched hm a full LLVM update is probably a bit too risky to backport, but backporting the relevant commit to the submodule on beta should work just fine!

@parched
Copy link
Contributor Author

parched commented Aug 31, 2018

Ok, so that's just rust-lang/llvm@cc4b526? Or perhaps just merge @cramertj's original PR to fix this #52952 it only has 2 other trivial commits rust-lang/llvm@0368490...f4130c0

@alexcrichton
Copy link
Member

Ah yeah the original PR would also work well as a beta backport!

@parched
Copy link
Contributor Author

parched commented Aug 31, 2018

Ok great, thanks, will you or @cramertj resubmit it?

@alexcrichton
Copy link
Member

Oh anyone can! Even you @parched :)

(I probably don't have time to manage this myself)

@pietroalbini pietroalbini added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Sep 4, 2018
bors added a commit that referenced this issue Sep 4, 2018
Update LLVM to fix segfault on AArch64

Fixes #53742

This is a backport of #52952 to beta

cc @alexcrichton
@parched
Copy link
Contributor Author

parched commented Sep 5, 2018

Fixed on latest beta. Thank you!

@parched parched closed this as completed Sep 5, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants