=sys-devel/binutils-2.39 fails to build with -D_FORTIFY_SOURCE=2 and Clang. Upon googling, this looks very well related: #807766 https://bugs.gentoo.org/807766 Reproducible: Always Steps to Reproduce: 1. Force following CFLAGS with Clang: i.e.: COMMON_FLAGS="-O2 -fPIC -fstack-protector-strong -fstack-clash-protection -fomit-frame-pointer -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" 2. Attempt to merge =sys-devel/binutils-2.39 3. Wait a few moments Actual Results: /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/mmaptrace.c:331:14: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/mmaptrace.c:1286:18: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' 1 warning and 2 errors generated. /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/envmgmt.c:187:15: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/envmgmt.c:207:15: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/envmgmt.c:467:16: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/envmgmt.c:518:19: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/envmgmt.c:535:15: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/envmgmt.c:601:16: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/envmgmt.c:747:14: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/envmgmt.c:795:14: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/envmgmt.c:822:15: error: no member named '__fprintf_chk' in 'struct CollectorUtilFuncs' CALL_UTIL (fprintf)(stderr, "__collector_clearenv(): ERROR: %s\n", dlerror ()); 1 warning and 9 errors generated. /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/iolib.c:229:15: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/iolib.c:264:19: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/iolib.c:614:23: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/iolib.c:643:25: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' 2 warnings and 4 errors generated. /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/linetrace.c:550:14: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/linetrace.c:768:18: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/linetrace.c:774:18: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/linetrace.c:828:15: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/linetrace.c:864:13: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' strerror_r (errno, errmsg, sizeof (errmsg)); /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/linetrace.c:870:15: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' strerror_r (errno, errmsg, sizeof (errmsg)); /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/linetrace.c:987:18: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' /var/tmp/portage/sys-devel/binutils-2.39/work/binutils-2.39/gprofng/libcollector/linetrace.c:990:16: error: no member named '__builtin___snprintf_chk' in 'struct CollectorUtilFuncs' 4 warnings and 8 errors generated. Expected Results: Successful merge of =sys-devel/binutils-2.39 Forcing CFLAGS like this may not be supported by Gentoo but some people are extra cautious in terms of security. Sharing here because =net-libs/libnftnl-1.2.0 was fixed. Most standard Gentoo users may not encounter this bug as GCC is the compiler of choice for most, and the majority do not play with -D_FORTIFY_SOURCE
Created attachment 799825 [details] build.log
Created attachment 799827 [details] emerge --info
For the record, very interested in bugs involving F_S & clang, even if it's not top of my list to address personally. They're not invalid at all.
This problem is fixed in Binutils 2.40 and even works with -D_FORTIFY_SOURCE=3 with Clang
(In reply to Alec Ari from comment #4) > This problem is fixed in Binutils 2.40 and even works with > -D_FORTIFY_SOURCE=3 with Clang Thanks for the update!