Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 942951 - cross-i586-unknown-linux-musl/gcc-14.2.1_p20241026 fails to build: ‘-fcf-protection’ is not compatible with this target
Summary: cross-i586-unknown-linux-musl/gcc-14.2.1_p20241026 fails to build: ‘-fcf-prot...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-11-06 13:28 UTC by Denis Lisov
Modified: 2024-11-10 17:23 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge--info.txt,7.63 KB, text/plain)
2024-11-06 13:29 UTC, Denis Lisov
Details
build log (gcc-14.2.1_p20241026:20241104-212346.log.gz,98.80 KB, application/gzip)
2024-11-06 13:30 UTC, Denis Lisov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Lisov 2024-11-06 13:28:42 UTC
cross-i586-unknown-linux-musl/gcc-14.2.1_p20241026 fails to build

Reproducible: Always
Comment 1 Denis Lisov 2024-11-06 13:29:31 UTC
Created attachment 907999 [details]
emerge --info
Comment 2 Denis Lisov 2024-11-06 13:30:22 UTC
Created attachment 908000 [details]
build log
Comment 3 Andrei Horodniceanu 2024-11-07 14:13:52 UTC
So, we have a check in toolchain.eclass to pass --enable-cet only on targets that support it:
------
enable_cet_for 'i[34567]86' 'linux' 'cet'
enable_cet_for 'x86_64' 'gnu' 'cet'
enable_cet_for 'aarch64' 'gnu' 'standard-branch-protection'
-----

On amd64 and arm64 we check that the target triple contains `gnu` but on x86 we only check for linux making i586-unknown-linux-musl wrongfully pass the check.

The fix is simple, change 'linux' to 'gnu'.

One more thing. crossdev, on my machine, sets in /etc/portage/profile/package.use.mask/cross-i586-unknown-linux-musl:
------
cross-i586-unknown-linux-musl/gcc  cet multilib
------
So the cet USE flag shouldn't have been turned on during the build so you shouldn't have hit this. Did you modify the environment by any chance?
Comment 4 Denis Lisov 2024-11-07 14:47:24 UTC
> So the cet USE flag shouldn't have been turned on during the build so you shouldn't have hit this. Did you modify the environment by any chance?

I haven't modified it since first installing this cross-toolchain in January 2024. IIUC, the `cet` USE mask was introduced in July. Sounds like I should have refreshed the crossdev-generated configs somehow, but that's something I was not aware of and I'm still not sure what's the proper way to do that.
Comment 5 Andrei Horodniceanu 2024-11-07 14:54:26 UTC
(In reply to Denis Lisov from comment #4)
> > So the cet USE flag shouldn't have been turned on during the build so you shouldn't have hit this. Did you modify the environment by any chance?
> 
> I haven't modified it since first installing this cross-toolchain in January
> 2024. IIUC, the `cet` USE mask was introduced in July. Sounds like I should
> have refreshed the crossdev-generated configs somehow, but that's something
> I was not aware of and I'm still not sure what's the proper way to do that.

Ah, ok, so you're not doing anything extreme. I'm not sure if crossdev generates the files every time it is run but, in your case, just put `cross-i586-unknown-linux-musl/gcc -cet` in package.use and re-emerge it.
Comment 6 Larry the Git Cow gentoo-dev 2024-11-10 17:23:59 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e08def09c01c484bcd0f1305e88165b4418f43b3

commit e08def09c01c484bcd0f1305e88165b4418f43b3
Author:     Andrei Horodniceanu <a.horodniceanu@proton.me>
AuthorDate: 2024-11-07 13:49:00 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-11-10 17:23:44 +0000

    toolchain.eclass: Check for gnu environment when enabling cet on x86
    
    Like we do for arm64 and amd64, diverge from the upstream check for
    linux and only enable it for gnu triples.
    
    Closes: https://bugs.gentoo.org/942951
    Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
    Closes: https://github.com/gentoo/gentoo/pull/39228
    Signed-off-by: Sam James <sam@gentoo.org>

 eclass/toolchain.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)