Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 933772 - sys-devel/gcc-14.1.1_p20240518 - [icu-75.1] [llvm] cc1: error: -fcf-protection is not compatible with this target
Summary: sys-devel/gcc-14.1.1_p20240518 - [icu-75.1] [llvm] cc1: error: -fcf-protectio...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 934790 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-06-07 20:05 UTC by Toralf Förster
Modified: 2024-06-27 12:52 UTC (History)
3 users (show)

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


Attachments
emerge-info.txt (emerge-info.txt,19.33 KB, text/plain)
2024-06-07 20:05 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,10.55 KB, text/plain)
2024-06-07 20:05 UTC, Toralf Förster
Details
environment (environment,179.37 KB, text/plain)
2024-06-07 20:05 UTC, Toralf Förster
Details
etc.clang.tar.xz (etc.clang.tar.xz,1.20 KB, application/x-xz)
2024-06-07 20:05 UTC, Toralf Förster
Details
etc.portage.tar.xz (etc.portage.tar.xz,27.09 KB, application/x-xz)
2024-06-07 20:05 UTC, Toralf Förster
Details
gcc-build-logs.tar.xz (gcc-build-logs.tar.xz,152.69 KB, application/x-xz)
2024-06-07 20:05 UTC, Toralf Förster
Details
logs.tar.xz (logs.tar.xz,56.24 KB, application/x-xz)
2024-06-07 20:05 UTC, Toralf Förster
Details
qlist-info.txt (qlist-info.txt,40.71 KB, text/plain)
2024-06-07 20:05 UTC, Toralf Förster
Details
sys-devel:gcc-14.1.1_p20240518:20240607-185945.log.xz (sys-devel:gcc-14.1.1_p20240518:20240607-185945.log.xz,103.75 KB, application/x-xz)
2024-06-07 20:05 UTC, Toralf Förster
Details
temp.tar.xz (temp.tar.xz,42.61 KB, application/x-xz)
2024-06-07 20:05 UTC, Toralf Förster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2024-06-07 20:05:02 UTC
too long lines were shrinked:

make[3]: Leaving directory '/var/tmp/portage/sys-devel/gcc-14.1.1_p20240518/work/build/x86_64-pc-linux-gnu/libgcc'
make[5]: Entering directory '/var/tmp/portage/sys-devel/gcc-14.1.1_p20240518/work/build/x86_64-pc-linux-gnu/32/libgcc'
echo timestamp > libgcc_tm.stamp
make[5]: Leaving directory '/var/tmp/portage/sys-devel/gcc-14.1.1_p20240518/work/build/x86_64-pc-linux-gnu/32/libgcc'
make[5]: Entering directory '/var/tmp/portage/sys-devel/gcc-14.1.1_p20240518/work/build/x86_64-pc-linux-gnu/32/libgcc'
/var/tmp/portage/sys-devel/gcc-14.1.1_p20240518/work/build/./gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-14.1.1_p20240518/work/build/./gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include   -fno-che
cc1: error: '-fcf-protection' is not compatible with this target
make[5]: *** [/var/tmp/portage/sys-devel/gcc-14.1.1_p20240518/work/gcc-14-20240518/libgcc/shared-object.mk:36: avx_savms64_s.o] Error 1
make[5]: Leaving directory '/var/tmp/portage/sys-devel/gcc-14.1.1_p20240518/work/build/x86_64-pc-linux-gnu/32/libgcc'

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 23.0_llvm-20240607-115521

  UNMASKED:
  ~dev-libs/icu-75.1
  ~dev-libs/icu-layoutex-75.1

  The attached etc.portage.tar.xz has all details.
  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-13 *
clang/llvm (if any):
clang version 18.1.6+libcxx
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/18/bin
Configuration file: /etc/clang/x86_64-pc-linux-gnu-clang.cfg
/usr/lib/llvm/18
18.1.6+libcxx
Python 3.12.3
Available Ruby profiles:
  (none found)
php cli (if any):

  HEAD of ::gentoo
commit 53e6779fb42ba449740b8aae94de19960bbb1d5b
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Fri Jun 7 18:28:18 2024 +0000

    2024-06-07 18:28:17 UTC

emerge -qpvO sys-devel/gcc
[ebuild  NS   ] sys-devel/gcc-14.1.1_p20240518 [13.2.1_p20240210] USE="cet (cxx) debug* (default-stack-clash-protection) (default-znow) fortran (multilib) openmp (pie) sanitize ssp valgrind* -ada (-custom-cflags) -d -doc (-fixed-point) -go -graphite -hardened (-ieee-long-double) -jit (-libssp) -lto -modula2 -nls* -objc -objc++ -objc-gc (-pch) -pgo -rust% -systemtap -test -vanilla -vtv -zstd*"
Comment 1 Toralf Förster gentoo-dev 2024-06-07 20:05:02 UTC
Created attachment 895335 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2024-06-07 20:05:03 UTC
Created attachment 895336 [details]
emerge-history.txt
Comment 3 Toralf Förster gentoo-dev 2024-06-07 20:05:06 UTC
Created attachment 895337 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2024-06-07 20:05:06 UTC
Created attachment 895338 [details]
etc.clang.tar.xz
Comment 5 Toralf Förster gentoo-dev 2024-06-07 20:05:07 UTC
Created attachment 895339 [details]
etc.portage.tar.xz
Comment 6 Toralf Förster gentoo-dev 2024-06-07 20:05:09 UTC
Created attachment 895340 [details]
gcc-build-logs.tar.xz
Comment 7 Toralf Förster gentoo-dev 2024-06-07 20:05:10 UTC
Created attachment 895341 [details]
logs.tar.xz
Comment 8 Toralf Förster gentoo-dev 2024-06-07 20:05:11 UTC
Created attachment 895342 [details]
qlist-info.txt
Comment 9 Toralf Förster gentoo-dev 2024-06-07 20:05:12 UTC
Created attachment 895343 [details]
sys-devel:gcc-14.1.1_p20240518:20240607-185945.log.xz
Comment 10 Toralf Förster gentoo-dev 2024-06-07 20:05:13 UTC
Created attachment 895344 [details]
temp.tar.xz
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-24 01:16:38 UTC
*** Bug 934790 has been marked as a duplicate of this bug. ***
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-24 01:17:03 UTC
Happens when building with Clang.
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-24 01:32:35 UTC
Wasn't bug 928460 supposed to fix this?
Comment 14 zachariah.cabelly 2024-06-24 01:37:59 UTC
Well apparently, it didn't
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-24 01:43:44 UTC
(In reply to zachariah.cabelly from comment #14)
> Well apparently, it didn't

It wasn't really a question to you, more a note to whoever is going to work on it...
Comment 16 zachariah.cabelly 2024-06-24 01:49:44 UTC
(In reply to Sam James from comment #15)
> (In reply to zachariah.cabelly from comment #14)
> > Well apparently, it didn't
> 
> It wasn't really a question to you, more a note to whoever is going to work
> on it...

Ok, I was making a joke, but to each their own
Comment 17 zachariah.cabelly 2024-06-24 01:58:25 UTC
Forcing GCC on sys-devel/gcc in the meantime. That's the workaround I have.
Comment 18 Sv. Lockal 2024-06-27 12:22:29 UTC
Root cause: xgcc (bootstrapper) in 14.1.1 does not resolve `-march=native`, then in cc1 invocation there is no -march=..., due to `-m32` cc1 fallbacks to some ancient i386, which does not support stack-protection. This problem applies only to xgcc; final gcc-14 resolves `-march=native` fine.

The issue occurs only with `sys-devel/gcc[hardened]`.

Workaround in make.conf: replace `-march=native` with `-march=<whatever arch you use>`. Or remove `-march=native` (in that case xgcc adds `-march=x86-64` to cc1 which prevents fallback to i386).

Minimal reproducer:

  /var/tmp/portage/sys-devel/gcc-14.1.1_p20240622/work/build/gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-14.1.1_p20240622/work/build/gcc/  -march=native -m32 -fcf-protection test.c -### 2>&1 | grep cc1

  >>> .../cc1 ... test.c ... -m32 "-fcf-protection=full" ...
 

It worked fine in gcc-13.2.1:

  /var/tmp/portage/sys-devel/gcc-13.2.1_p20240210/work/build/gcc/xgcc -B/var/tmp/portage/sys-devel/gcc-13.2.1_p20240210/work/build/gcc/  -march=native -m32 -fcf-protection test.c  -### 2>&1 | grep cc1

  >>> .../cc1 ... test.c "-march=znver4" -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -msse4a -mno-fma4 -mno-xop -mfma -mavx512f -mbmi -mbmi2 -maes -mpclmul -mavx512vl -mavx512bw -mavx512dq -mavx512cd -mno-avx512er -mno-avx512pf -mavx512vbmi -mavx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mavx512vpopcntdq -mavx512vbmi2 ... -m32 "-fcf-protection=full" ...
Comment 19 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-27 12:52:11 UTC
(In reply to Sv. Lockal from comment #18)
> Root cause: xgcc (bootstrapper) in 14.1.1 does not resolve `-march=native`,
> then in cc1 invocation there is no -march=..., due to `-m32` cc1 fallbacks
> to some ancient i386, which does not support stack-protection. This problem
> applies only to xgcc; final gcc-14 resolves `-march=native` fine.
> 

Note that depending on the point in the process you're at, `xgcc` is sometimes just a wrapper around the original CC (e.g. clang).

But if it worked with GCC 13, that's obviously far more curious...