Hi,
I need to maintain for my day job some code that must work on an old 32bit platform running a kernel not supported anymore by glibc.
I’m trying to cross compile to musl32 and check if it works with the following command:
nix-build channel:nixos-unstable -A pkgsCross.musl32.zlib
however it seems some problem exists with the __stack_chk_fail_local
since the following error:
hidden symbol `__stack_chk_fail_local' isn't defined
can be found in the build logs of some notable package: nix
(via aws-checksums
), zlib
and probably others.
Can someone point me in the right direction to solve this problem?
Thanks
I’m still finding a solution and the nixpkgs documentation suggests the use of the hardeningDisable
flag, however I’m not sure how to use it from nix-build
.
I noticed this a while back too! You can try this commit on Nixpkgs:
committed 03:31PM - 28 Mar 19 UTC
but it is very weird that stackprotector isn’t working! Some searching comes up with:
committed 11:54AM - 04 Nov 14 UTC
this installs
libssp_nonshared.a
libssp.a
libssp.so*
into lib/.
the latter ones… are probably unwanted, since musl already supplies the
regular libssp functionality. they will be removed in another commit.
libssp_nonshared.a is required for binaries compiled with
-fPIE -fstack-protector-all on some architectures, most notably i386,
where GOT lookup of functions requires multiple steps (instructions).
so, as an optimization, in order not to bloat the function prologue/epilogue
of every single stack-protected function unnecessarily,
it was decided to simply emit a jump to a local wrapper function which then
calls the real __stack_chk_fail function via GOT.
that's the reason the function has to be statically linked in and resides
in a separate library.
see ssp-local.c in gcc tree for the functions' code.
this is the first step in getting #274 solved.
Thanks, your comment has been really useful.
I’ll open a pull request to discuss the small changes required to build nix.