Summary: | >=dev-lang/rust-1.32.0 stage0 cargo illegal instruction | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Gutleib <gutleib> |
Component: | Current packages | Assignee: | Gentoo Rust Project <rust> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | PPC64 | ||
OS: | Linux | ||
URL: | https://github.com/rust-lang/cargo/issues/6320 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Gutleib
2019-03-08 19:48:56 UTC
sorry, typo-ed, Power4 CPU please provide emerge --info output unpacking of le snapshot is ok. as you see later is installs be version for bootstrap. we can't just know what snapshot we gonna use at unpack stage on ppc64 and unpack both. ... install: installing component 'rust-analysis-powerpc64-unknown-linux-gnu' install: installing component 'rust-std-powerpc64-unknown-linux-gnu' I can reproduce it on ppc64 /var/tmp/notmpfs/portage/dev-lang/rust-1.32.0/work/rust-stage0 # ./bin/cargo Illegal instruction so whatever comes from upstream tarball snapshot can't run. investigating. and looks like there is the reason. https://github.com/rust-lang/rust/pull/58986 <jrtc27> infinity0: ok I've found the problem <jrtc27> https://sources.debian.org/src/openssl/1.1.1a-1/crypto/rand/rand_unix.c/?hl=127#L286-L287 <jrtc27> on whatever old build machine upstream's cargo was linked against, there was no getentropy symbol in their libc <jrtc27> however, the linker has done stupid things <jrtc27> getting the address of getentropy for the function pointer != NULL comparison has remained, as it's loading it from the TOC (PPC's version of the GOT), and there's a dynamic relocation there to fill in the entry <jrtc27> so on stretch (or other older systems) the entry gets filled in as NULL at runtime and the condition gives false <jrtc27> but on sid, the entry is filled in with the non-NULL address for the function pointer and the condition gives true, so it then goes to actually call getentropy <jrtc27> however, the *call* to getentropy is done in the assembly as `bl getentropy`, ie not using the function pointer <jrtc27> and for whatever reason, the linker didn't create a PLT stub for that, but instead went "oh, call to non-existent weak function, that's a call to 0, ie crash" <jrtc27> so you get inconsistency <jrtc27> infinity0: I can reproduce it with jessie's binutils 2.25 using ld.bfd <jrtc27> but the linker bug appears to have been fixed by 2.28 <jrtc27> tried to find the relevant commit, but there are lots between 2.25 and 2.28 that mention undefined weak symbols, so I give up <jrtc27> anyway, point is, rust upstream just needs to not just an ancient build environment so basically we have 2 problems 1) cargo contains getentropy symbol that needs to be gone to work on modern glibc 2) linked in openssl crashes in OPENSSL_cpuid_setup because nothing handles signal while probing cargo[5121]: unhandled signal 4 at 00000000304cd000 nip 00000000304cd000 lr 0000000030e022a4 code 30001 the fix is stupid simple 1) sed out getentropy symbol from cargo 2) set OPENSSL_ppccap to stop openssl from probing anything at all. from crypto/ppccap.c:OPENSSL_cpuid_setup( if ((e = getenv("OPENSSL_ppccap"))) { OPENSSL_ppccap_P = strtoul(e, NULL, 0); return; } testing rust ebuilds now The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5573f88f5f07123507726c1fb516e6a0b0b440f commit c5573f88f5f07123507726c1fb516e6a0b0b440f Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2019-03-10 08:46:03 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2019-03-10 08:47:09 +0000 dev-lang/rust: fix boostrap on ppc64 Bug: https://bugs.gentoo.org/679806 Thanks-to: Sergei Trofimovich <slyfox@gentoo.org> Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust/rust-1.32.0.ebuild | 6 ++++++ dev-lang/rust/rust-1.33.0.ebuild | 6 ++++++ 2 files changed, 12 insertions(+) Works fine now with the latest ebuild. Thanks! Awesome, thanks for testing. Now I need to fix rust-bin, which is a bit more involved, cause it’ll require a cargo wrapper The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e428d13d6870832812748de67e48f170cbce6a5 commit 6e428d13d6870832812748de67e48f170cbce6a5 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2019-03-11 04:46:09 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2019-03-11 04:51:16 +0000 dev-lang/rust-bin: fix cargo on ppc64 Bug: https://bugs.gentoo.org/679806 Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust-bin/rust-bin-1.32.0.ebuild | 13 ++++++++++++- dev-lang/rust-bin/rust-bin-1.33.0.ebuild | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43fdc6b66fa0adbb56593bf0e74ffb8d7180f5a3 commit 43fdc6b66fa0adbb56593bf0e74ffb8d7180f5a3 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2019-05-24 05:18:37 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2019-05-24 09:02:30 +0000 dev-lang/rust-bin: bump to 1.35.0 EAPI=7 uninherit eutils Bug: https://bugs.gentoo.org/679806 Package-Manager: Portage-2.3.66, Repoman-2.3.12 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust-bin/Manifest | 13 +++ dev-lang/rust-bin/rust-bin-1.35.0.ebuild | 161 +++++++++++++++++++++++++++++++ 2 files changed, 174 insertions(+) so rust-bin-1.35 is free of nasty workaround and works fine on ppc64 for me rust-1.35 still has that getentropy hack but it's not a big deal, as the compiled rust is clean. leaving open until 1.36.0 lands. The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=22ad38aea43abc71360afc7bdbc63c26eb3e48c2 commit 22ad38aea43abc71360afc7bdbc63c26eb3e48c2 Author: Georgy Yakovlev <gyakovlev@gentoo.org> AuthorDate: 2019-07-08 03:00:02 +0000 Commit: Georgy Yakovlev <gyakovlev@gentoo.org> CommitDate: 2019-07-08 23:01:19 +0000 dev-lang/rust: bump to 1.36.0 couple of important fixes also it now installs i686 libs to /usr/lib/${PN} on multilib Bug: https://bugs.gentoo.org/672816 Bug: https://bugs.gentoo.org/679806 Package-Manager: Portage-2.3.68, Repoman-2.3.16 Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org> dev-lang/rust/Manifest | 14 + dev-lang/rust/files/1.34.2-fix-custom-libdir.patch | 36 +++ dev-lang/rust/rust-1.36.0.ebuild | 325 +++++++++++++++++++++ 3 files changed, 375 insertions(+) we no longer have affected versions. closing. |