How to use --exclude-libs?

Jeffrey Walton noloader@gmail.com
Fri Aug 12 13:13:00 GMT 2011


Hi All,

A DSO uses Crypto++. Crypto++ has a number of exported symbols, which
are showing up in the DSO.

nm -g -D --defined-only libesapi-c++.so | grep -i cryptopp | wc -l
5560

According to ld(2), we can use --exclude-libs. I've tried adding the
flag before and after the library includes; and used variations on the
name: cryptopp, libcryptopp, libcryptopp.so. And I have not been able
to get --exclude-libs to work, even with ALL.

Another related question: why is nm displaying the crypto++ stuff in
the first place? I used - visibility=hidden (and export select classes
and functions), and don't claim to export Crypto++ stuff. I'm confused
why --export-only and --defined-only is not being honored.

Jeff

$ make test #cryptopp listed before included libs
g++ -g3 -ggdb -O2 -Dprivate=public -Dprotected=public
-DSAFEINT_DISALLOW_UNSIGNED_NEGATION=1 -pipe -fsigned-char
-Woverloaded-virtual -fvisibility=hidden -Wall -Wextra
-Wno-type-limits -Wno-unused -std=c++0x -D_REENTRANT -o
lib/libesapi-c++.so <Object Files> -L/usr/local/lib -L/usr/lib -L./lib
--exclude-libs cryptopp -shared -lpthread -lcryptopp
g++: cryptopp: No such file or directory

$ make test #cryptopp listed after included libs
g++ -g3 -ggdb -O2 -Dprivate=public -Dprotected=public
-DSAFEINT_DISALLOW_UNSIGNED_NEGATION=1 -pipe -fsigned-char
-Woverloaded-virtual -fvisibility=hidden -Wall -Wextra
-Wno-type-limits -Wno-unused -std=c++0x -D_REENTRANT -o
lib/libesapi-c++.so <Object Files> -L/usr/local/lib -L/usr/lib -L./lib
-shared -lpthread -lcryptopp --exclude-libs cryptopp
g++: cryptopp: No such file or directory



More information about the Gcc-help mailing list