Glibc 2.12 issue
michael.hope at linaro.org
Tue Aug 31 00:23:24 BST 2010
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
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
* 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.
for how Debian does this.
Hope that helps,
On Fri, Aug 27, 2010 at 9:06 PM, <Alexander.Kanevskiy at 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:
> 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.
More information about the linaro-toolchain