With FORTIFY glibc alters the behaviour of asprintf, and this has changed in glibc-2.8 in a way leading to asprintf not being declared properly. This results with for example things like libiberty (and things shipping with it, i.e. gcc-4.2.4, gcc-4.3.1, binutils-2.18, gdb-6.8) which should declare asprintf on its own if not already declared does not compile (since asprintf being declared two times). AVE_DECL_ASPRINTF is computed with _GNU_SOURCE unset, libiberty/floatformat.c sets _GNU_SOURCE and uses libiberty.h, so asprintf is redeclared (/usr/include/stdio.h + libiberty.h) Reproducible: Always Steps to Reproduce: 1.install hardened gcc 4 toolchain from git git://github.com/Xake/toolchain-overlay.git 2.emerge glibc 2.8 3.emerge binutils-1.18 Actual Results: sys-devel/binutils-2.18-r3 with gcc 4.2.4 and glibc 2.8-p20080602 In file included from /var/tmp/portage/sys-devel/binutils-2.18-r3/work/binutils-2.18/libiberty/floatformat.c:40: /var/tmp/portage/sys-devel/binutils-2.18-r3/work/binutils-2.18/libiberty/../include/libiberty.h:589: error: expected declaration specifiers or '...' before numeric constant /var/tmp/portage/sys-devel/binutils-2.18-r3/work/binutils-2.18/libiberty/../include/libiberty.h:589: error: conflicting types for 'asprintf_chk' /usr/include/bits/stdio2.h:135: error: previous declaration of 'asprintf_chk' was here make[2]: *** [floatformat.o] Error 1 make[2]: *** Waiting for unfinished jobs.... gcc and gdb have the same bug. Expected Results: emerge buinutils okey irc log fron #gcc at irc.oftc.net <Zorry> iant_work, ping * ryanarn har avslutat (Read error: Connection reset by peer) <iant_work> Zorry: pong <andreast> DannyB: fyi, 36766 works on tuples <Zorry> iant_work, the ifndef asprintf patch is working on two system now :) <iant_work> good * apinski (pinskia@216.68.190.3) gick in i #gcc <Zorry> iant_work, upstream later ? <iant_work> Zorry: the comment needs to go on the preceding line, needs to look like other comments, and should be shorter <Zorry> okey <iant_work> thanks <Zorry> iant_work, np <apinski> hi <Zorry> iant_work, https://hardened.gentooexperimental.org/secure/attachment/ticket/33/libiberty.h-asprintf-glibc-2.8.patch <iant_work> Just write /* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */ <iant_work> put the comment before the #ifndef * ryanarn (~ryanarn@68-117-77-37.dhcp.roch.mn.charter.com) gick in i #gcc <iant_work> that patch is approved <iant_work> thanks <DannyB> that's what she said <DannyB> richi: i had tracked down the gfortran issue on darwin and geoff keating confirmed my diagnosis <Zorry> iant_work, okey :) thanx gcc version 4.2.4 (Gentoo Hardened 4.2.4-r1 p1.0, builtin ssp,fortify, pie-9.0.11) Portage 2.1.4.4 (hardened/linux/amd64/2008.0, gcc-4.2.4, glibc-2.8_p20080602-r0, 2.6.25-gentoo-r6 x86_64) ================================================================= System uname: 2.6.25-gentoo-r6 x86_64 Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz Timestamp of tree: Wed, 23 Jul 2008 09:45:03 +0000 app-shells/bash: 3.2_p33 dev-lang/python: 2.4.4-r13, 2.5.2-r5 dev-python/pycrypto: 2.0.1-r6 sys-apps/baselayout: 1.12.11.1 sys-apps/sandbox: 1.2.18.1-r2 sys-devel/autoconf: 2.61-r2 sys-devel/automake: 1.10.1 sys-devel/binutils: 2.18-r3 sys-devel/gcc-config: 1.4.0-r4 sys-devel/libtool: 1.5.26 virtual/os-headers: 2.6.23-r3 ABI="amd64" ACCEPT_KEYWORDS="amd64"
Created attachment 161379 [details, diff] Fix for glibc 2.8 and asprintf in libiberty.h It will fix the error: previous declaration of 'asprintf_chk' was here in >gcc-4.2 and >gdb-6.8 to
more info https://hardened.gentooexperimental.org/secure/ticket/33 http://forums.gentoo.org/viewtopic-t-668885-postdays-0-postorder-asc-start-300.html
Thanks for the patch
sys-devel/binutils-2.18.50.0.8 fix the problem on binutils but it don't have any keywords. Can some one add ~x86 ~amd64 ~ppc ~ppc64 ? GCC 4.3 and GDB 6.8 still need the patch.
Fixed in piepatch 10.1.2 for gcc-4.3-2
binutils-2.19 and gcc-4.3.2 are fixed. does gdb-6.8-r1 need the patch still ?
(In reply to comment #6) > binutils-2.19 and gcc-4.3.2 are fixed. does gdb-6.8-r1 need the patch still ? > If you put the fortify spec in gcc.c cpp_unique_options then gcc, binutils and gdb don't need the asprintf patch.
vapier, which version of binutils needs to go stable for Glibc 2.8?
there is no glibc issue here