[PATCH] Add ld.gold option "--dynamic-list-only"
Cary Coutant
ccoutant@google.com
Tue Mar 11 17:12:00 GMT 2014
> 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
More information about the Binutils
mailing list