public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How to use --exclude-libs?
@ 2011-08-12 13:13 Jeffrey Walton
  2011-08-12 13:52 ` Jonathan Wakely
  2011-08-12 13:59 ` Jonathan Wakely
  0 siblings, 2 replies; 6+ messages in thread
From: Jeffrey Walton @ 2011-08-12 13:13 UTC (permalink / raw)
  To: GCC Users List

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use --exclude-libs?
  2011-08-12 13:13 How to use --exclude-libs? Jeffrey Walton
@ 2011-08-12 13:52 ` Jonathan Wakely
  2011-08-12 13:54   ` Jeffrey Walton
  2011-08-12 13:59 ` Jonathan Wakely
  1 sibling, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2011-08-12 13:52 UTC (permalink / raw)
  To: noloader; +Cc: GCC Users List

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use --exclude-libs?
  2011-08-12 13:52 ` Jonathan Wakely
@ 2011-08-12 13:54   ` Jeffrey Walton
  2011-08-12 14:11     ` Jonathan Wakely
  0 siblings, 1 reply; 6+ messages in thread
From: Jeffrey Walton @ 2011-08-12 13:54 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: GCC Users List

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.

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use --exclude-libs?
  2011-08-12 13:13 How to use --exclude-libs? Jeffrey Walton
  2011-08-12 13:52 ` Jonathan Wakely
@ 2011-08-12 13:59 ` Jonathan Wakely
  1 sibling, 0 replies; 6+ messages in thread
From: Jonathan Wakely @ 2011-08-12 13:59 UTC (permalink / raw)
  To: noloader; +Cc: GCC Users List

On 12 August 2011 14:13, Jeffrey Walton wrote:
>
> 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.

As for this bit, I would guess those are weak symbols for inline
functions and/or templates defined in crytopp headers, which get
compiled into libesapi-c++.so, but that's just a guess.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use --exclude-libs?
  2011-08-12 13:54   ` Jeffrey Walton
@ 2011-08-12 14:11     ` Jonathan Wakely
  2011-08-12 14:12       ` Jeffrey Walton
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2011-08-12 14:11 UTC (permalink / raw)
  To: noloader; +Cc: GCC Users List

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use --exclude-libs?
  2011-08-12 14:11     ` Jonathan Wakely
@ 2011-08-12 14:12       ` Jeffrey Walton
  0 siblings, 0 replies; 6+ messages in thread
From: Jeffrey Walton @ 2011-08-12 14:12 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: GCC Users List

On Fri, Aug 12, 2011 at 10:10 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> 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
When I saw your `-Wl`, the light bulbs lit up.

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-08-12 14:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-12 13:13 How to use --exclude-libs? Jeffrey Walton
2011-08-12 13:52 ` Jonathan Wakely
2011-08-12 13:54   ` Jeffrey Walton
2011-08-12 14:11     ` Jonathan Wakely
2011-08-12 14:12       ` Jeffrey Walton
2011-08-12 13:59 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).