Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 865337 - =sys-devel/binutils-2.39 fails to build with -D_FORTIFY_SOURCE=2 and Clang
Summary: =sys-devel/binutils-2.39 fails to build with -D_FORTIFY_SOURCE=2 and Clang
Status: UNCONFIRMED
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:
Depends on:
Blocks: systemwide-clang
  Show dependency tree
 
Reported: 2022-08-15 23:53 UTC by Alec Ari
Modified: 2022-08-16 00:05 UTC (History)
1 user (show)

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


Attachments
build.log (binutils_build.log,676.31 KB, text/x-log)
2022-08-15 23:53 UTC, Alec Ari
Details
emerge --info (emerge_info.txt,6.93 KB, text/plain)
2022-08-15 23:53 UTC, Alec Ari
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Ari 2022-08-15 23:53:06 UTC
=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
Comment 1 Alec Ari 2022-08-15 23:53:36 UTC
Created attachment 799825 [details]
build.log
Comment 2 Alec Ari 2022-08-15 23:53:51 UTC
Created attachment 799827 [details]
emerge --info
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-08-16 00:05:05 UTC
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.