This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Add ld.gold option "--dynamic-list-only"
- From: Cary Coutant <ccoutant at google dot com>
- To: Vyacheslav Ostapenko <ostap73 at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Tue, 11 Mar 2014 10:12:06 -0700
- Subject: Re: [PATCH] Add ld.gold option "--dynamic-list-only"
- Authentication-results: sourceware.org; auth=none
- References: <CAJgOwdkGnSh3ywit_NEQdW3NxVf_q=rTqFa0gUbeMFz6ZXvQiA at mail dot gmail dot com>
> I'd like to propose additional option for ld linker that will limit
> dynamic symbol exports to the specified by dynamic list file. All
> other symbols will not be exported.
> This will allow fine grained control of exports for big projects
> (chromium) which link statically several 3rd party libraries and do
> not want export symbols from those 3rd party libraries.
>
> Attached patch implements this option for the gold linker.
>
> Can this be added to trunk?
> I'm also planning to implement this option for the bfd linker.
Have you looked at the --exclude-libs option? I think it will do what
you need -- it basically changes all symbols in the named libraries
with DEFAULT visibility to HIDDEN visibility, which will prevent them
from being exported unless explicitly mentioned in --dynamic-list.
If --exclude-libs isn't sufficient, I would prefer to see something
like --default-visibility={internal|hidden|protected|default}, which
would set the visibility for all symbols that have default visibility
in the input files. Then, --default-visibility=hidden would have the
same effect as your proposed option, but (in my opinion) would be
cleaner and more like the compiler's -fvisibility option.
-cary