LFS-6.6, Stage2, glibc, nscd.c:442

Bruce Dubbs bruce.dubbs at gmail.com
Mon Jun 7 16:20:16 PDT 2010


linux fan wrote:
> # Hack to solve glibc __stack_chk_guard cross compile ( < 2.4 :)
> # this schpeel in LFS-6.6 ch5 gcc-pass1 and ch5 gcc-pass2 after unpack:
> glibc=$(ls  /lib/libc-*.so)
> read j1 v[0] v[1] v[2] j2 <<< ${glibc//[-.]/ }
> if (( v[0] < 2 )) || (( v[1] < 4 )) && [ -f gcc/configure ]; then
>   # kick it
>   sed -i -e '/# Test for stack protector support in target C library/ {
>       a\
> gcc_cv_libc_provides_ssp=yes
>     } ' gcc/configure
> fi
> 
> # Result: nscd with stack-smashing protector + no error in ch6 glibc
> # Notes:
> # If should probably have (( v[0] < 3 )) && (( v[1] < 4 )),
> # but could do the sed unconditionally for target LFS-6.6.
> # Don't know if needed in ch5 gcc-pass1 and/or ch5 gcc-pass2.
> # Testing on host lfs-6.2/linux-2.6.22.18,
> # "Everything is proceeding as I have foreseen it."

That's an interesting hack.  Looking at gcc/configure, it seems that the 
following would do the same thing.

After configure:

#ifdef TARGET_LIBC_PROVIDES_SSP
#undef TARGET_LIBC_PROVIDES_SSP
#endif

#define TARGET_LIBC_PROVIDES_SSP 1

It looks like there are three places where this is defined in gcc-4.5: 
gcc/auto-host.h, prev-gcc/auto-host.h, stage1-gcc/auto-host.h

Or just an unconditional sed changing
'/* #undef TARGET_LIBC_PROVIDES_SSP */' to
'#define TARGET_LIBC_PROVIDES_SSP 1' in the above files.

I'm not 100% sure all three files there in all cases.  I've been hacking 
gcc in other places.

   -- Bruce



More information about the lfs-support mailing list