strange binary status when linked with shared binary in 11.4-R
Jin Guojun[VFF]
jguojun at gmail.com
Tue Oct 13 00:31:04 UTC 2020
In 11.4-Release, the binary linked with shared library (.so) is MUCH
bigger then expected,
and ldd shows the binary linked with shared binary is not really
dynamically linked.
This has not been seen in 10.x-Release and earlier.
Does anyone know if the dynamic link flag has been changed in CLang 10?
-Jin
$ CC -v
FreeBSD clang version 10.0.0 (git at github.com:llvm/llvm-project.git
llvmorg-10.0.0-0-gd32170dbd5b)
Target: x86_64-unknown-freebsd11.4
Move libccs.a to libccs.ax to demo that this is not a mistake:
-rw-r--r-- 1 jin 100 435688 Sep 7 14:59 /usr/local/lib/libccs.ax
lrwxr-xr-x 1 jin 100 13 Sep 7 15:00 /usr/local/lib/libccs.so@
-> libccs.so.2.3
-rw-r--r-- 1 jin 100 339648 Sep 7 15:00 /usr/local/lib/libccs.so.2.3
# static linker fails due to no static library
$ cc -I$HOME/include stol.c -o stol -L/usr/local/lib -Xlinker -Bstatic
-lccs -lm
/usr/bin/ld: cannot find -lccs
cc: error: linker command failed with exit code 1 (use -v to see invocation)
# now we know binary is linked to a shared library, but the binary is
big and no dynamic link sign (ldd)
$ cc -I$HOME/include stol.c -o stol -L/usr/local/lib -Xlinker -Bdynamic
-lccs -lm
$ ll stol
-rwxr-xr-x 1 jin wheel 229130 Oct 12 16:49 stol*
$ ldd stol
stol:
libm.so.5 => /lib/libm.so.5 (0x800854000)
libc.so.7 => /lib/libc.so.7 (0x800a84000)
# move .ax back to .a and try static link
$ cc -I$HOME/include stol.c -o stol -L/usr/local/lib -Xlinker -Bstatic
-lccs -lm
$ ll stol
-rwxr-xr-x 1 jin wheel 13855 Oct 12 16:56 stol*
$ ldd stol
stol:
libm.so.5 => /lib/libm.so.5 (0x800824000)
libc.so.7 => /lib/libc.so.7 (0x800a54000)
More information about the freebsd-questions
mailing list