Summary: | dev-lang/go fails to compile on mips with sys-devel/binutils-2.39 and CGO_ENABLED | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | matoro <matoro_gentoo> |
Component: | Current packages | Assignee: | William Hubbs <williamh> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | jstein, matoro_gentoo, mips, sam, toolchain |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | MIPS | ||
OS: | Linux | ||
URL: | https://github.com/golang/go/issues/55096 | ||
See Also: | https://sourceware.org/bugzilla/show_bug.cgi?id=29592 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 868111 |
Description
matoro
![]() Complete build log, unfortunately way too big to attach even compressed: https://0x0.st/oOOp.c Hey, Can you try this again with the newest version of go-bootstrap? Thanks, William (In reply to William Hubbs from comment #2) > Hey, > > Can you try this again with the newest version of go-bootstrap? > > Thanks, > > William Hmm, just tried this again but it's erroring with: * ERROR: dev-lang/go-1.19.1::gentoo failed (compile phase): * USE Flag 'abi_mips_o32' not in IUSE for dev-lang/go-1.19.1 * * Call stack: * ebuild.sh, line 122: Called src_compile * environment, line 1269: Called go_arch 'mips64-unknown-linux-gnu' * environment, line 922: Called use 'abi_mips_o32' * phase-helpers.sh, line 256: Called die * The specific snippet of code: * die "USE Flag '${u}' not in IUSE for ${CATEGORY}/${PF}" * * If you need support, post the output of `emerge --info '=dev-lang/go-1.19.1::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-lang/go-1.19.1::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-lang/go-1.19.1/temp/build.log.gz'. * The ebuild environment file is located at '/var/tmp/portage/dev-lang/go-1.19.1/temp/environment'. * Working directory: '/var/tmp/portage/dev-lang/go-1.19.1/work/go' * S: '/var/tmp/portage/dev-lang/go-1.19.1/work/go' IUSE has been updated, so try this again. Thanks, William This was technically fixed in https://github.com/gentoo/gentoo/commit/8db889827661b38cfbe74f335e095a4288a83ff7. I don't think there's an understanding of why this fixes it, but it does. (In reply to matoro from comment #5) > This was technically fixed in > https://github.com/gentoo/gentoo/commit/ > 8db889827661b38cfbe74f335e095a4288a83ff7. I don't think there's an > understanding of why this fixes it, but it does. I have vague recollections of some weirdness in the MIPS ELF ABI regarding execstacks being discussed on the old linux-mips mailing list years ago, possibly in relation to MIPS not supporting execstacks originally? I think there was a specific CPU feature that added support for exec stacks (RI/XI), so building for MIPS targets that don't support that feature could be what triggers the error? Kinda guessing here, as I never did wrap my head about the various quirks that the MIPS ELF ABI uses. Probably the one linux-mips maintainer that would actually know this answer is Maciej W. Rozycki. If there is a desire for an answer, and someone can format a specific question for me, I can go and ask. (In reply to matoro from comment #5) > This was technically fixed in > https://github.com/gentoo/gentoo/commit/ > 8db889827661b38cfbe74f335e095a4288a83ff7. I don't think there's an > understanding of why this fixes it, but it does. OK The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=86ac5c16e3149458710b691e1cad81c50be8d661 commit 86ac5c16e3149458710b691e1cad81c50be8d661 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-07-30 16:26:38 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-07-30 16:42:29 +0000 sys-devel/binutils: add various hardening options to 2.41 Newer Binutils has its several configure arguments we can use: * --enable-textrel-check={warning,error} * --enable-warn-execstack=yes (*) * --enable-warn-rwx-segments=yes (*) * --enable-default-execstack=no We chuck these in now unconditionally (with some stricter changes for USE=hardened, as described below) except for those marked with (*) where we whitelist certain arches (amd64/arm64/x86 for now) because the autoconf logic is broken, see https://sourceware.org/bugzilla/show_bug.cgi?id=29592 (it both needs --enable...=no rather than --disable, but it also breaks arches where executable stacks are unavoidable.) In the past (see 47b8db23ff55dd29992198dfbadda53984a4ab2d, e4b8746852919960969944904c59334cecddfe25 in binutils-patches.git), we patched Binutils to always warn on textrels opt-out on a per-build basis with '--no-warn-shared-textrel'). From >= Binutils 2.35, upstream has a '--enable-textrel-check=warning' configure option we use. For USE=hardened, our new changes for TEXTRELs are equivalent to `-z text` which make TEXTRELs fatal. Now, while at it, also make TEXTRELs fatal on musl unconditionally because musl doesn't support them and they explode at runtime. Yet another reason to get rid of them entirely. So, in summary: there's several changes here: * Make textrels fatal for USE=hardened (we've warned about them for a while on all profiles) * Make textrels fatal for musl (they don't work there at all, bug #707660) * Disable implicit/automatic executable stacks for USE=hardened (plan to do this in general later on) * Warn on executable stacks in general * Warn on RWX segments in general See also https://www.redhat.com/en/blog/linkers-warnings-about-executable-stacks-and-segments for more information. All of this came to mind again after reading the Qualys writeup for the recent OpenSSH bug (bug #910553): https://www.qualys.com/2023/07/19/cve-2023-38408/rce-openssh-forwarded-ssh-agent.txt. (Note their use of various gadgets involving these.) Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29592 Bug: https://bugs.gentoo.org/707660 Bug: https://bugs.gentoo.org/869881 Bug: https://bugs.gentoo.org/871150 Bug: https://bugs.gentoo.org/910553 Signed-off-by: Sam James <sam@gentoo.org> sys-devel/binutils/binutils-2.41.ebuild | 43 +++++++++++++++++++++++------- sys-devel/binutils/binutils-9999.ebuild | 47 ++++++++++++++++++++++++--------- 2 files changed, 68 insertions(+), 22 deletions(-) |