Bug 10375

Summary: glibc can be built only if -U_FORTIFY_SOURCE is added to CFLAGS
Product: glibc Reporter: booleandomain
Component: buildAssignee: Carlos O'Donell <carlos>
Status: RESOLVED FIXED    
Severity: normal CC: carlos, dick, glibc-bugs, jrnieder, jyasskin, roland, sapiensantiquus, toolchain, zorry
Priority: P2 Flags: fweimer: security-
Version: 2.10   
Target Milestone: 2.16   
See Also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46596
Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu
Build: x86_64-pc-linux-gnu Last reconfirmed: 2012-02-29 00:00:00

Description booleandomain 2009-07-07 19:16:55 UTC
I cannot compile glibc-2.10.1 with gcc-4.3.3. Make fails with the following
error message:

x86_64-pc-linux-gnu-gcc ../sysdeps/unix/sysv/linux/syslog.c -c -std=gnu99
-fgnu89-inline -O2 -Wall -Winline
-Wl,--dynamic-linker,/tools/lib64/ld-linux-x86-64.so.2 -Wwrite-strings
-fmerge-all-constants -march=core2 -Wstrict-prototypes   -fexceptions  
-I../include -I/home/booleandomain/tmp/lfs/sources/glibc-build/misc
-I/home/booleandomain/tmp/lfs/sources/glibc-build -I../sysdeps/x86_64/elf
-I../nptl/sysdeps/unix/sysv/linux/x86_64 -I../sysdeps/unix/sysv/linux/x86_64
-I../sysdeps/unix/sysv/linux/wordsize-64 -I../nptl/sysdeps/unix/sysv/linux
-I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux
-I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman
-I../sysdeps/unix/inet -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv
-I../sysdeps/unix/x86_64 -I../nptl/sysdeps/unix -I../sysdeps/unix
-I../sysdeps/posix -I../sysdeps/x86_64/fpu -I../nptl/sysdeps/x86_64
-I../sysdeps/x86_64 -I../sysdeps/wordsize-64 -I../sysdeps/ieee754/ldbl-96
-I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754
-I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I.
-nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include -isystem
/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/include-fixed -isystem /tools/include
-D_LIBC_REENTRANT -include ../include/libc-symbols.h       -o
/home/booleandomain/tmp/lfs/sources/glibc-build/misc/syslog.o -MD -MP -MF
/home/booleandomain/tmp/lfs/sources/glibc-build/misc/syslog.o.dt -MT
/home/booleandomain/tmp/lfs/sources/glibc-build/misc/syslog.o 
../misc/syslog.c: In function '__vsyslog_chk':
../misc/syslog.c:123: sorry, unimplemented: inlining failed in call to 'syslog':
function body not available
../misc/syslog.c:155: sorry, unimplemented: called from here
make[2]: *** [/home/booleandomain/tmp/lfs/sources/glibc-build/misc/syslog.o] Error 1
make[2]: Leaving directory `/home/booleandomain/tmp/lfs/sources/glibc-2.10.1/misc'
make[1]: *** [misc/subdir_lib] Error 2
make[1]: Leaving directory `/home/booleandomain/tmp/lfs/sources/glibc-2.10.1'
make: *** [all] Error 2

Glibc was configured as follows: --prefix=/tools --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --with-headers=/tools/include --enable-kernel=2.6.30

The only way I know to fix this is to add -U_FORTIFY_SOURCE to the CFLAGS.
Comment 1 Ulrich Drepper 2009-07-17 06:00:40 UTC

*** This bug has been marked as a duplicate of 333 ***
Comment 2 Jeffrey Yasskin 2012-02-29 09:50:15 UTC
This looks like http://gcc.gnu.org/PR46596.
Comment 3 Carlos O'Donell 2012-02-29 13:58:10 UTC
I can confirm this. My build scripts all have -U_FORTIFY_SOURCE in CFLAGS. I'll have a look at fixing this.
Comment 4 Carlos O'Donell 2012-02-29 13:59:58 UTC
*** Bug 11180 has been marked as a duplicate of this bug. ***
Comment 5 Andrew Johnson 2012-04-24 20:17:59 UTC
Confirmed here as well.
Comment 6 Roland McGrath 2012-05-07 21:42:01 UTC
Note compilers (like Debian/Ubuntu) that predefine _FORTIFY_SOURCE also implicitly set -fstack-protector, which I think is also a problem for building libc.
Comment 7 Jonathan Nieder 2012-05-14 04:55:35 UTC
(In reply to comment #6)
> Note compilers (like Debian/Ubuntu) that predefine _FORTIFY_SOURCE also
> implicitly set -fstack-protector, which I think is also a problem for building
> libc.

To avoid confusion: Debian gcc does not predefine _FORTIFY_SOURCE or
implicitly set -fstack-protector.  Ubuntu gcc does, though.
Comment 8 Roland McGrath 2012-05-16 23:24:35 UTC
Fixed in trunk.
Comment 9 Jackie Rosen 2014-02-16 19:22:43 UTC Comment hidden (spam)