This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add ld.gold option "--dynamic-list-only"


> Have you looked at the --exclude-libs option?

Yes.
The problem is solve-able with exclude-libs, but I had to create
pretty long list of excluded libraries which also need to be
maintained.

> If --exclude-libs isn't sufficient, I would prefer to see something like --default-visibility={internal|hidden|protected|default}

"default-visibility" switch doesn't solve the problem. Libraries that
are linked use "__attribute__((visibility( default )))" even for
static builds and this way appear in export list of final shared
library and currently there is no way to override this.
Or do you mean "default-visibility" is the way to specify visibility
(set default) for "__attribute__((visibility( default )))"? I think in
this case it should look like
"--default-visibility={internal|hidden|protected|dynamic}" to avoid
confusion about "default/default". So, in this case I will be able to
specify "--default-visibility=hidden" and override what is necessary
with dynamic list, right?

Thanks,
   Slava

On Tue, Mar 11, 2014 at 1:12 PM, Cary Coutant <ccoutant@google.com> wrote:
>>   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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]