Bk6.6Ch6.9 glibc `__stack_chk_guard' work around.

Chris Staub chris at beaker67.com
Wed Mar 31 18:08:28 PDT 2010


On 03/31/2010 04:33 PM, Bruce Dubbs wrote:
> Szabolcs Gyalókay wrote:
>>
>> gcc res_hconf.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline
>> -Wwrite-strings -fmerge-all-constants -g -Wstrict-prototypes
>
>> -DIS_IN_nscd=1 -D_FORTIFY_SOURCE=2
>> -fpie
>> -fstack-protector
>> -DNOT_IN_libc=1
>
>> -o /sources/glibc-build/nscd/res_hconf.o -MD -MP -MF
>> /sources/glibc-build/nscd/res_hconf.o.dt -MT
>
> Removing non-relevant stuff and reformatting a bit, my reference build has:
>
> gcc res_hconf.c -c -std=gnu99 -fgnu89-inline -O2 -Wall -Winline
> -Wwrite-strings -fmerge-all-constants -g -Wno-strict-prototypes
>
> -Wno-write-strings
>
> -Wstrict-prototypes
>
> -fexceptions
>
> -I../include -D_LIBC_REENTRANT -include ../include/libc-symbols.h
> -Dgethostbyname=res_gethostbyname -Dgethostbyname2=res_gethostbyname2
> -Dgethostbyaddr=res_gethostbyaddr -Dgetnetbyname=res_getnetbyname
> -Dgetnetbyaddr=res_getnetbyaddr -o
> /sources/glibc-build/resolv/res_hconf.o -MD -MP -MF
> /sources/glibc-build/resolv/res_hconf.o.dt -MT
> /sources/glibc-build/resolv/res_hconf.o
>
> It would seem that your Makefile is significantly different from mine.
> That would indicate to me that there is something wrong with your
> Chapter 5 build as once you get into chroot, the builds really should be
> the same.
>
>     -- Bruce

OK, I just double-checked with current LFS dev, and I've got...

configure
...
checking for -fno-toplevel-reorder -fno-section-anchors... yes
checking for -fstack-protector... yes
checking for -fgnu89-inline... yes
...

And of course Glibc builds just fine without complaining about libssp.

Also, it seems you're confusing 2 different parts of the build. I've got 
res_hconf.c being compiled twice - once in the "resolv" dir and once in 
"nscd". Note that the previous user's paste is from the "nscd" dir and 
yours is from "resolv", which explains the differences. As for me, in 
the "resolv" dir...

...
gcc res_hconf.c -c -std=gnu99 -fgnu89-inline -O2 -O3 -Wall -Winline 
-Wwrite-strings -fmerge-all-constants -g -march=i486 -mtune=native -pipe 
-Wno-strict-prototypes -Wno-write-strings -Wstrict-prototypes 
-mpreferred-stack-boundary=2  -fPIC -fexceptions   -I../include 
-I/home/root/build/glibc-build/resolv -I/home/root/build/glibc-build 
-I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i68
6 -I../sysdeps/unix/sysv/linux/i386/i686 
-I../nptl/sysdeps/unix/sysv/linux/i386
-I../sysdeps/unix/sysv/linux/i386 -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../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv 
-I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix 
-I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu 
-I../nptl/sysdeps/i386/i686 -I../sysdeps/i386/i686 
-I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu 
-I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 
-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.  -D_LIBC_REENTRANT -include 
../include/libc-symbols.h  -DPIC -DSHARED 
-Dgethostbyname=res_gethostbyname -Dgethostbyname2=res_gethostbyname2 
-Dgethostbyaddr=res_gethostbyaddr -Dgetnetbyname=res_getnetbyname 
-Dgetnetbyaddr=res_getnetbyaddr -o /
home/root/build/glibc-build/resolv/res_hconf.os -MD -MP -MF 
/home/root/build/glibc-build/resolv/res_hconf.os.dt -MT 
/home/root/build/glibc-build/resolv/res_hconf.os
...

And in "nscd"...

...
gcc res_hconf.c -c -std=gnu99 -fgnu89-inline -O2 -O3 -Wall -Winline 
-Wwrite-strings -fmerge-all-constants -g -march=i486 -mtune=native -pipe 
-Wstrict-prototypes -mpreferred-stack-boundary=2  -DIS_IN_nscd=1 
-D_FORTIFY_SOURCE=2 -fpie -fstack-protector   -I../include 
-I/home/root/build/glibc-build/nscd -I/home/root/build/glibc-build 
-I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i686 
-I../sysdeps/unix/sysv/linux/i386/i686 
-I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 
-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../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv 
-I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix 
-I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686/fpu 
-I../nptl/sysdeps/i386/i686 -I../sysdeps/i386/i686 
-I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu 
-I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 
-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.  -D_LIBC_REENTRANT -include ../include/libc-symbols.h 
-DNOT_IN_libc=1    -o /home/root/build/glibc-build/nscd/res_hconf.o -MD 
-MP -MF /home/root/build/glibc-build/nscd/res_hconf.o.dt -MT 
/home/root/build/glibc-build/nscd/res_hconf.o
...



More information about the lfs-support mailing list