How to use --exclude-libs?

Jonathan Wakely jwakely.gcc@gmail.com
Fri Aug 12 14:11:00 GMT 2011


On 12 August 2011 14:54, Jeffrey Walton <noloader@gmail.com> wrote:
> On Fri, Aug 12, 2011 at 9:52 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> On 12 August 2011 14:13, Jeffrey Walton wrote:
>>> 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.
>>
>> I think --exclude-libs only applies to archive libraries, i.e. static libs.
>>
>> But as it's an ld option you should a) probably ask on a binutils list
>> and b) use -Wl,--exclude-libs,libfoobar.a if you're passing it to gcc
> Thanks Jonathan. My apologies about the ld question.


I'm a bit surprised you didn't see

g++: error: unrecognized command line option '--exclude-libs'

or (for earlier releases)

cc1plus: error: unrecognized command line option "-fexclude-libs"

as well as the "No such file or directory" error, indicating g++
doesn't understand --exclude-libs



More information about the Gcc-help mailing list