# Question on Binutils



## noloader (Sep 13, 2011)

Hi All,

I've got a GNU makefile executed with gmake, and I'm having problems with a linker switch.

According to the Binutils change logs (grab a copy of the latest binutils at http://ftp.gnu.org/gnu/binutils/):


> ld/ChangeLog-0203, --exclude-libs first appeared (Smith's 05/2002 comments).
> ld/ChangeLog-2004, --exclude-libs was tuned (and the PE target was removed) (Jacobowitz's 10/2004 comments).



Based on the dates, I believe Binutils 2.12 (and above) should support --exclude-libs.

FreeBSD 8.2 ships with version 2.15:

```
$ ld --version
GNU ld version 2.15 [FreeBSD] 2004-05-23
Copyright 2002 Free Software Foundation, Inc.
```

However, when it comes time to perform final linking of a shared object (DSO), the link fails because ld does not understand --exclude-libs.

Any ideas?

Jeff


----------



## noloader (Sep 13, 2011)

Forgot to mention.... Here's why '--exclude-libs,ALL' useful. In the library below, we don't export *any* Crypto++ symbols, yet 7200 have crept into the export table:


```
[jeffrey@germain]$ $ uname -a
FreeBSD germain.home.pvt 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Fri Feb 18 02:24:46 UTC 2011
     [email]root@almeida.cse.buffalo.edu[/email]:/usr/obj/usr/src/sys/GENERIC  i386
[jeffrey@germain]$ nm -D --extern-only --defined-only lib/libesapi-c++.so | grep -i cryptopp | wc -l
    7208
```


```
$ uname -a
Linux studio 2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:07:13 UTC
2011 x86_64 GNU/Linux
jeffrey@studio$ nm -D --extern-only --defined-only lib/libesapi-c++.so | grep -i cryptopp | wc -l
2
```


----------



## noloader (Sep 14, 2011)

Ian Lance Taylor (from the Binutils mailing list) kindly provided the information. Though the dates appear correct, my leap to Binutils 2.15 was wrong.

--exclude-libs became available for ELF in Binutils 2.16. See "Question on ld and --exclude-libs", http://sourceware.org/ml/binutils/2011-09/msg00064.html.


----------

