This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libc_cv_ssp=no required to bootstrap a cross compiler


On Wed, Sep 5, 2012 at 11:25 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Wed, 5 Sep 2012, Christer Solskogen wrote:
>
>> With the GCC-soon-to-be 4.8 (alias gcc-trunk) and the master branch of glibc
>> I'm able to create a cross compiler without to many hacks.
>>
>> binutils->static gcc->glibc->gcc works. Almost.
>> glibc bails out with n function `getanswer':
>> gethnamaddr.c:(.text+0x8b8): undefined reference to `__stack_chk_guard' - but
>
> Linking what program or shared library?
>

make[2]: Entering directory `/storage/home/solskogen/src/lib/libc/resolv'
sparc-centix-linux-gnu-gcc   -shared -static-libgcc -Wl,-O1
-Wl,-z,defs -Wl,-dynamic-linker=/lib/ld-linux.so.2
-B/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/csu/
-Wl,--version-script=/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/libresolv.map
-Wl,-soname=libresolv.so.2 -Wl,-z,combreloc -Wl,-z,relro
-Wl,--hash-style=both
-L/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu
-L/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/math
-L/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/elf
-L/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/dlfcn
-L/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/nss
-L/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/nis
-L/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/rt
-L/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/resolv
-L/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/crypt
-L/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/nptl
-Wl,-rpath-link=/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu:/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/math:/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/elf:/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/dlfcn:/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/nss:/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/nis:/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/rt:/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/resolv:/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/crypt:/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/nptl
-o /home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/resolv/libresolv.so
-T /home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/shlib.lds
/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/csu/abi-note.o
-Wl,--whole-archive
/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/resolv/libresolv_pic.a
-Wl,--no-whole-archive
/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/elf/interp.os
/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/libc.so
/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/libc_nonshared.a
-Wl,--as-needed
/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/elf/ld.so
-Wl,--no-as-needed
/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/resolv/libresolv_pic.a(gethnamaddr.os):
In function `getanswer':
/storage/home/solskogen/src/lib/libc/resolv/gethnamaddr.c:180:
undefined reference to `__stack_chk_guard'
/storage/home/solskogen/src/lib/libc/resolv/gethnamaddr.c:180:
undefined reference to `__stack_chk_guard'
/storage/home/solskogen/src/lib/libc/resolv/gethnamaddr.c:180:
undefined reference to `__stack_chk_guard'
/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/resolv/libresolv_pic.a(gethnamaddr.os):
In function `__GI_res_gethostbyname2':
/storage/home/solskogen/src/lib/libc/resolv/gethnamaddr.c:510:
undefined reference to `__stack_chk_guard'
/storage/home/solskogen/src/lib/libc/resolv/gethnamaddr.c:510:
undefined reference to `__stack_chk_guard'
/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/resolv/libresolv_pic.a(gethnamaddr.os):/storage/home/solskogen/src/lib/libc/resolv/gethnamaddr.c:510:
more undefined references to `__stack_chk_guard' follow
collect2: error: ld returned 1 exit status
make[2]: *** [/home/solskogen/obj/_build/libc.sparc-centix-linux-gnu/resolv/libresolv.so]
Error 1
make[2]: Leaving directory `/storage/home/solskogen/src/lib/libc/resolv'
make[1]: *** [resolv/others] Error 2
make[1]: Leaving directory `/storage/home/solskogen/src/lib/libc'
make: *** [all] Error 2


>> with a hidden configure option ( libc_cv_ssp=no ) I am able to build it. I've
>> tried with sparc,powerpc, i686 and x86_64 targets.
>>
>> But is this a problem? The 'libc_cv_ssp=no' part I mean?
>
> Please debug where this symbol would come from in a non-bootstrap build
> (i.e. a build using the final GCC) and why it's not available in a
> bootstrap build.  You should not need any special settings such as
> libc_cv_ssp=no; bootstrap builds should produce identical configure test
> results (except for tests relating to the C++ compiler, which are only
> relevant for running the glibc testsuite) and libc binaries to
> non-bootstrap builds.  This definitely works for ARM at least; ARM was
> where I developed and tested the patches to get the binaries identical.
>

What kind of target did you use? arm-blabla-gnueabi-linux?

> It's possible that actually you need gcc_cv_libc_provides_ssp=yes when
> configuring the initial GCC, so that it knows it will be used with
> new-enough glibc.  (It would be a good idea to add a --with-glibc-version
> configure option to GCC, that overrides all configure tests based on
> versions extracted from system headers so that the results can be correct
> for the initial bootstrap compiler that is configured without headers
> available.)
>

Will try with gcc_cv_libc_provides_ssp=yes. Since it will default to
no if no glibc headers are present.


-- 
chs,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]