I am compiling files a.c
& b.c
with flag -fstack-protector-strong
which results to introduce new symbol __stack_chk_fail
in object files a.o, b.o
nm a.o | grep __stack_chk_fail
U __stack_chk_fail
nm b.o | grep __stack_chk_fail
U __stack_chk_fail
I am creating one static library libstat.a
using above object files :
ar rc libstat.a a.o b.o
Finally, I am trying to create dynamic library libtest.so
using above static library. The above symbol __stack_chk_fail
is defined in library libssp.so
which is in gcc tool chain path /home/test_usr/gcc-10.3.0/aarch64-unknown-linux-gnu/lib64
objdump -T /home/test_usr/gcc-10.3.0/aarch64-unknown-linux-gnu/lib64/libssp.so.0.0.0 | grep __stack_chk_fail
0000000000000ff0 g DF .text 0000000000000020 LIBSSP_1.0 __stack_chk_fail
Build command:-
bin/gcc -include ... -L /home/test_usr/gcc-10.3.0/aarch64-unknown-linux-gnu/lib64/ -lssp -o libtest.so libstat.a
i was expecting to have the symbol defined in my final library libtest.so
, But no luck.
nm libtest.so | grep __stack_chk_fail
U __stack_chk_fail@LIBSSP_1.0
Am i missing some thing here? Why this symbols is not getting defined though i try to link with -lssp
which has this symbol definition. Please help!