{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/48967","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/48967/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/48967/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/48967/events","html_url":"https://github.com/rust-lang/rust/issues/48967","id":304550163,"number":48967,"title":"aarch64 musl binaries panic since 2018-02-05 nightly","user":{"login":"tjkirch","id":13994,"avatar_url":"https://avatars1.githubusercontent.com/u/13994?v=4","gravatar_id":"","url":"https://api.github.com/users/tjkirch","html_url":"https://github.com/tjkirch","followers_url":"https://api.github.com/users/tjkirch/followers","following_url":"https://api.github.com/users/tjkirch/following{/other_user}","gists_url":"https://api.github.com/users/tjkirch/gists{/gist_id}","starred_url":"https://api.github.com/users/tjkirch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tjkirch/subscriptions","organizations_url":"https://api.github.com/users/tjkirch/orgs","repos_url":"https://api.github.com/users/tjkirch/repos","events_url":"https://api.github.com/users/tjkirch/events{/privacy}","received_events_url":"https://api.github.com/users/tjkirch/received_events","type":"User","site_admin":false},"labels":[{"id":650731663,"url":"https://api.github.com/repos/rust-lang/rust/labels/C-bug","name":"C-bug","color":"f5f1fd","default":false},{"id":55301954,"url":"https://api.github.com/repos/rust-lang/rust/labels/O-ARM","name":"O-ARM","color":"6e6ec0","default":false},{"id":630662867,"url":"https://api.github.com/repos/rust-lang/rust/labels/O-musl","name":"O-musl","color":"6e6ec0","default":false},{"id":203429200,"url":"https://api.github.com/repos/rust-lang/rust/labels/P-high","name":"P-high","color":"eb6420","default":false},{"id":211668100,"url":"https://api.github.com/repos/rust-lang/rust/labels/T-compiler","name":"T-compiler","color":"bfd4f2","default":false},{"id":262252628,"url":"https://api.github.com/repos/rust-lang/rust/labels/regression-from-stable-to-beta","name":"regression-from-stable-to-beta","color":"e4008a","default":false}],"state":"open","locked":false,"assignee":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars0.githubusercontent.com/u/155238?v=4","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"assignees":[{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars0.githubusercontent.com/u/155238?v=4","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/rust-lang/rust/milestones/44","html_url":"https://github.com/rust-lang/rust/milestone/44","labels_url":"https://api.github.com/repos/rust-lang/rust/milestones/44/labels","id":3036984,"number":44,"title":"1.25","description":"","creator":{"login":"Mark-Simulacrum","id":5047365,"avatar_url":"https://avatars0.githubusercontent.com/u/5047365?v=4","gravatar_id":"","url":"https://api.github.com/users/Mark-Simulacrum","html_url":"https://github.com/Mark-Simulacrum","followers_url":"https://api.github.com/users/Mark-Simulacrum/followers","following_url":"https://api.github.com/users/Mark-Simulacrum/following{/other_user}","gists_url":"https://api.github.com/users/Mark-Simulacrum/gists{/gist_id}","starred_url":"https://api.github.com/users/Mark-Simulacrum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mark-Simulacrum/subscriptions","organizations_url":"https://api.github.com/users/Mark-Simulacrum/orgs","repos_url":"https://api.github.com/users/Mark-Simulacrum/repos","events_url":"https://api.github.com/users/Mark-Simulacrum/events{/privacy}","received_events_url":"https://api.github.com/users/Mark-Simulacrum/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":10,"state":"open","created_at":"2018-01-15T18:13:50Z","updated_at":"2018-03-16T00:08:00Z","due_on":"2018-03-29T07:00:00Z","closed_at":null},"comments":13,"created_at":"2018-03-12T21:39:20Z","updated_at":"2018-03-16T16:31:21Z","closed_at":null,"author_association":"NONE","body":"aarch64-unknown-linux-musl binaries crash immediately when built using Rust nightly since 2018-02-05, including the current beta, 1.25.0-beta.9.\r\n\r\nThis happens in debug and release builds.\r\n\r\nIt works fine with 2018-02-04, or with stable Rust 1.24.1.  This is building on an x86_64-unknown-linux-gnu host, which shows no errors or warnings, and running on an embedded Linux 4.9 device.\r\n\r\nI tried this code:\r\n\r\nA fresh `cargo new --bin testme`.  (Same thing with a completely empty \"main {}\" function.)\r\n\r\nI expected to see this happen:\r\n\r\nThe binary should run without panicking.  With nightly 2018-02-04, it looks like this, through strace:\r\n\r\n```\r\nexecve(\"/tmp/testme\", [\"/tmp/testme\"], 0x7fe28422a0 /* 9 vars */) = 0\r\nmmap(NULL, 448, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f87569000\r\nset_tid_address(0x7f87569038)           = 19524\r\nrt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x425660}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0\r\nrt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0\r\nrt_sigaction(SIGSEGV, {sa_handler=0x408844, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO|SA_ONSTACK, sa_restorer=0x425660}, NULL, 8) = 0\r\nrt_sigaction(SIGBUS, {sa_handler=0x408844, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO|SA_ONSTACK, sa_restorer=0x425660}, NULL, 8) = 0\r\nsigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0\r\nmmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f87566000\r\nHello, world!\r\nsigaltstack({ss_sp=0x7f87566000, ss_flags=0, ss_size=12288}, NULL) = 0\r\nbrk(NULL)                               = 0x451000\r\nbrk(0x452000)                           = 0x452000\r\nwrite(1, \"Hello, world!\\n\", 14)         = 14\r\nsigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=12288}, NULL) = 0\r\nmunmap(0x7f87566000, 12288)             = 0\r\nexit_group(0)                           = ?\r\n+++ exited with 0 +++\r\n```\r\n\r\nInstead, with 2018-02-05+, this happened:\r\n\r\n```\r\nthread panicked while processing panic. aborting.\r\nTrace/breakpoint trap (core dumped)\r\n```\r\n\r\nWith strace:\r\n\r\n```\r\nexecve(\"/tmp/testme\", [\"/tmp/testme\"], 0x7fe4522920 /* 9 vars */) = 0\r\nmmap(NULL, 520, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82fb0000\r\nset_tid_address(0x7f82fb0040)           = 6644\r\nrt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x424780}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0\r\nrt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0\r\nrt_sigaction(SIGSEGV, {sa_handler=0x40cad8, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO|SA_ONSTACK, sa_restorer=0x424780}, NULL, 8) = 0\r\nrt_sigaction(SIGBUS, {sa_handler=0x40cad8, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO|SA_ONSTACK, sa_restorer=0x424780}, NULL, 8) = 0\r\nsigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0\r\nmmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82fad000\r\nsigaltstack({ss_sp=0x7f82fad000, ss_flags=0, ss_size=12288}, NULL) = 0\r\nbrk(NULL)                               = 0x44f000\r\nbrk(0x450000)                           = 0x450000\r\n--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---\r\nwrite(2, \"thread panicked while processing panic. aborting.\\n\", 50thread panicked while processing panic. aborting.\r\n) = 50\r\n--- SIGTRAP {si_signo=SIGTRAP, si_code=TRAP_BRKPT, si_pid=4242620, si_uid=0} ---\r\n+++ killed by SIGTRAP (core dumped) +++\r\nTrace/breakpoint trap (core dumped)\r\n```\r\n\r\nHere's the backtrace from the core, using gdb 7.1.2:\r\n\r\n```\r\n(gdb) bt\r\n#0  std::panicking::rust_panic_with_hook::h32ba6c175ffd549b () at libstd/panicking.rs:562\r\n#1  0x000000000040bbb4 in std::panicking::begin_panic::h54415e6a8d568874 () at libstd/panicking.rs:537\r\n#2  0x000000000040bb24 in std::panicking::begin_panic_fmt::he7ac75f1ed16a44d () at libstd/panicking.rs:521\r\n#3  0x000000000040bab8 in rust_begin_unwind () at libstd/panicking.rs:497\r\n#4  0x0000000000425740 in core::panicking::panic_fmt::he44a5deca1206c59 () at libcore/panicking.rs:71\r\n#5  0x0000000000401e34 in core::result::unwrap_failed::h3872e2fc78d2079d () at /checkout/src/libcore/macros.rs:23\r\n#6  0x000000000040316c in _$LT$core..result..Result$LT$T$C$$u20$E$GT$$GT$::expect::hd60da7509cc07397 () at /checkout/src/libcore/result.rs:809\r\n#7  _$LT$core..cell..RefCell$LT$T$GT$$GT$::borrow::hb3e1337e98c3fd8c () at /checkout/src/libcore/cell.rs:692\r\n#8  std::sys_common::thread_info::ThreadInfo::with::_$u7b$$u7b$closure$u7d$$u7d$::h8953affb3be93291 () at libstd/sys_common/thread_info.rs:26\r\n#9  _$LT$std..thread..local..LocalKey$LT$T$GT$$GT$::try_with::h26bdeb702705cd55 () at libstd/thread/local.rs:377\r\n#10 0x000000000040b3d0 in std::sys_common::thread_info::ThreadInfo::with::hea74330e81f8e238 () at libstd/sys_common/thread_info.rs:25\r\n#11 std::sys_common::thread_info::current_thread::h1ca059562bf90a53 () at libstd/sys_common/thread_info.rs:38\r\n#12 std::panicking::default_hook::h1c4df4ccc9dbcc8f () at libstd/panicking.rs:366\r\n#13 0x000000000040bd5c in std::panicking::rust_panic_with_hook::h32ba6c175ffd549b () at libstd/panicking.rs:576\r\n#14 0x000000000040bbb4 in std::panicking::begin_panic::h54415e6a8d568874 () at libstd/panicking.rs:537\r\n#15 0x000000000040bb24 in std::panicking::begin_panic_fmt::he7ac75f1ed16a44d () at libstd/panicking.rs:521\r\n#16 0x000000000040bab8 in rust_begin_unwind () at libstd/panicking.rs:497\r\n#17 0x0000000000425740 in core::panicking::panic_fmt::he44a5deca1206c59 () at libcore/panicking.rs:71\r\n#18 0x0000000000401e34 in core::result::unwrap_failed::h3872e2fc78d2079d () at /checkout/src/libcore/macros.rs:23\r\n#19 0x000000000040cf80 in _$LT$core..result..Result$LT$T$C$$u20$E$GT$$GT$::expect::hd60da7509cc07397 () at /checkout/src/libcore/result.rs:809\r\n#20 _$LT$core..cell..RefCell$LT$T$GT$$GT$::borrow::hb3e1337e98c3fd8c () at /checkout/src/libcore/cell.rs:692\r\n#21 std::sys_common::thread_info::ThreadInfo::with::_$u7b$$u7b$closure$u7d$$u7d$::h9b784f47e02471dc () at libstd/sys_common/thread_info.rs:26\r\n#22 _$LT$std..thread..local..LocalKey$LT$T$GT$$GT$::try_with::h679d37f9412a06de () at libstd/thread/local.rs:377\r\n#23 std::sys_common::thread_info::ThreadInfo::with::hbe63383438d236c7 () at libstd/sys_common/thread_info.rs:25\r\n#24 std::sys_common::thread_info::stack_guard::h9e3b15191b000f90 () at libstd/sys_common/thread_info.rs:42\r\n#25 std::sys::unix::stack_overflow::imp::signal_handler::h7311ce70e0648552 () at libstd/sys/unix/stack_overflow.rs:105\r\n#26 <signal handler called>\r\n#27 core::sync::atomic::atomic_add::h28be0c5b8884ec73 () at /checkout/src/libcore/sync/atomic.rs:1529\r\n#28 core::sync::atomic::AtomicUsize::fetch_add::h6d05bf1ec9fefec2 () at /checkout/src/libcore/sync/atomic.rs:1285\r\n#29 _$LT$alloc..arc..Arc$LT$T$GT$$u20$as$u20$core..clone..Clone$GT$::clone::h6010f845e6b4f7cd () at /checkout/src/liballoc/arc.rs:713\r\n#30 _$LT$std..thread..Thread$u20$as$u20$core..clone..Clone$GT$::clone::h676320869dc42c9e () at libstd/thread/mod.rs:995\r\n#31 std::sys_common::thread_info::current_thread::_$u7b$$u7b$closure$u7d$$u7d$::h9421a40bb49e2782 () at libstd/sys_common/thread_info.rs:38\r\n#32 std::sys_common::thread_info::ThreadInfo::with::_$u7b$$u7b$closure$u7d$$u7d$::h8953affb3be93291 () at libstd/sys_common/thread_info.rs:32\r\n#33 _$LT$std..thread..local..LocalKey$LT$T$GT$$GT$::try_with::h26bdeb702705cd55 () at libstd/thread/local.rs:377\r\n#34 0x000000000040b3d0 in std::sys_common::thread_info::ThreadInfo::with::hea74330e81f8e238 () at libstd/sys_common/thread_info.rs:25\r\n#35 std::sys_common::thread_info::current_thread::h1ca059562bf90a53 () at libstd/sys_common/thread_info.rs:38\r\n#36 std::panicking::default_hook::h1c4df4ccc9dbcc8f () at libstd/panicking.rs:366\r\n#37 0x000000000040bd5c in std::panicking::rust_panic_with_hook::h32ba6c175ffd549b () at libstd/panicking.rs:576\r\n#38 0x000000000040bc1c in std::panicking::begin_panic::hd820cd84b7494cee () at libstd/panicking.rs:537\r\n#39 0x000000000040a854 in std::sys_common::thread_info::set::_$u7b$$u7b$closure$u7d$$u7d$::he4d3a0675b98919e () at libstd/sys_common/thread_info.rs:46\r\n#40 _$LT$std..thread..local..LocalKey$LT$T$GT$$GT$::try_with::ha14bf0d7b1a87bd1 () at libstd/thread/local.rs:377\r\n#41 _$LT$std..thread..local..LocalKey$LT$T$GT$$GT$::with::he00cc2566a9cc88e () at libstd/thread/local.rs:288\r\n#42 std::sys_common::thread_info::set::he3dc668f6080c88a () at libstd/sys_common/thread_info.rs:46\r\n#43 0x000000000040bfa4 in std::rt::lang_start_internal::h60dd5b329f127bc1 () at libstd/rt.rs:51\r\n#44 0x0000000000400304 in main ()\r\n```\r\n\r\n## Meta\r\n\r\n`rustc --version --verbose`:\r\n\r\nAny nightly Rust since 2018-02-05, installed through rustup.  Example:\r\n\r\n```\r\nrustc 1.25.0-nightly (0c6091fbd 2018-02-04)\r\nbinary: rustc\r\ncommit-hash: 0c6091fbd0eee290c651f73be899f221eeab3c05\r\ncommit-date: 2018-02-04\r\nhost: x86_64-unknown-linux-gnu\r\nrelease: 1.25.0-nightly\r\nLLVM version: 4.0\r\n```\r\n\r\nMy ~/.cargo/config:\r\n\r\n```\r\n[target.aarch64-unknown-linux-musl]\r\nlinker = \"aarch64-unknown-linux-musl-gcc\"\r\nrustflags = [\r\n  \"-C\", \"link-arg=-lgcc\",\r\n  \"-C\", \"target-feature=+crt-static\"\r\n]\r\n```\r\n\r\n`aarch64-unknown-linux-musl-gcc` is from GCC 7.2.0 via Buildroot 2017.08.\r\n\r\nNote: I've tried adding `-C llvm-args=-fast-isel` per #48673 but it made no difference."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/373769677","html_url":"https://github.com/rust-lang/rust/issues/48967#issuecomment-373769677","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/48967","id":373769677,"user":{"login":"nikomatsakis","id":155238,"avatar_url":"https://avatars0.githubusercontent.com/u/155238?v=4","gravatar_id":"","url":"https://api.github.com/users/nikomatsakis","html_url":"https://github.com/nikomatsakis","followers_url":"https://api.github.com/users/nikomatsakis/followers","following_url":"https://api.github.com/users/nikomatsakis/following{/other_user}","gists_url":"https://api.github.com/users/nikomatsakis/gists{/gist_id}","starred_url":"https://api.github.com/users/nikomatsakis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikomatsakis/subscriptions","organizations_url":"https://api.github.com/users/nikomatsakis/orgs","repos_url":"https://api.github.com/users/nikomatsakis/repos","events_url":"https://api.github.com/users/nikomatsakis/events{/privacy}","received_events_url":"https://api.github.com/users/nikomatsakis/received_events","type":"User","site_admin":false},"created_at":"2018-03-16T16:31:21Z","updated_at":"2018-03-16T16:31:21Z","author_association":"CONTRIBUTOR","body":"I could use any suggestions for how to reproduce this problem =) Some have suggested qemu?\r\n\r\nThat said, I'm not sure where to start debugging this. Seems...likely, possible?...to be an LLVM problem? I'm sort of hoping that one of the LLVM upgrades will make it go away. =)\r\n\r\nIn any case, reproducing it would be a start. "}}
{"actor":{"display_login":"nikomatsakis"}}