Hi Alexander.  I've looked into the problem and the linker error is
caused by a mix of stack protector options between libgcc and the C
library.

GCC includes a feature called the stack smashing protector which
detects writing past the end of a stack based object.  It's quite nice
as it gives decent protection against buffer overruns which are the
most common type of security vulnerability.

The implementation is straight forward: when compiled with
-fstack-protector, any function with a stack-based character array
will have extra stack checking code inserted into the prologue and
epilogue.  The prologue allocates a canary value at the top of stack
and fills it in with the value of '__stack_chk_guard' provided by
libssp.  The epilogue checks this value and calls `__stack_chk_fail`
if it has been changed.  The stack protector can interfere with some
code and isn't applicable in others.

The problem here is caused by a stack up of things:
 * glibc knows about -fstack-protector and turns it on and off for
different functions and libraries
 * gcc knows about -fstack-protector and includes libssp if required
 * glibc knows about libgcc and statically links against it to ensure
availability
 * Meego seems to turn on -fstack-protector by default (as does Ubuntu)

This results in the libgcc function '_gcc_Unwind_Backtrace' being
built with the stack protector and the glibc library 'libanl' without.
 At static link time GCC sees that the stack protector is off and
skips linking against libssp, causing the missing symbol error.

The solution is to add -fno-stack-protector to the libgcc build
options and rebuild the compiler.  I've heard (but can't track down
the link) that the ARM libgcc unwind functions must be built this way
in any case.

See
 
http://svn.debian.org/wsvn/gcccvs/branches/sid/gcc-4.5/debian/patches/gcc-default-ssp.diff
for how Debian does this.

Hope that helps,

-- Michael

On Fri, Aug 27, 2010 at 9:06 PM,  <alexander.kanevs...@nokia.com> wrote:
> Hi Michael.
>
> I've created for you account in MeeGo OBS (build system that we use in MeeGo
> is OpenSuSE build system)
>
> login: michaelh
> password: wog-feg-da
> Web client url: https://build.meego.com
> API url: https://api.meego.com
>
> The build log that had problem with glibc 2.12 + gcc 4.5 you can find here:
>
> https://build.meego.com/package/live_build_log?arch=armv7el&package=glibc&pr
> oject=home%3Akad%3Abranches%3ATrunk%3ATesting&repository=standard
>
> Might be you have some idea what went wrong, as our toolchain people were
> not able to find why combination of latest gcc plus glibc 2.11.x works, but
> not gcc 4.5 + glibc 2.12.0 :(
>
> This log is from my home project inside OBS, where stuff is already a bit
> outdated. I'll ask Jan-Simon from Linux Fundation to point to right place
> where latest builds are present, so you can experiment with them.
>
> --
> Best regards, Alexander Kanevskiy.
>
>
>

_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-toolchain

Reply via email to