[PATCH] D65893: [llvm-objcopy] Allow the visibility of the start, end and size symbols created by --binary to be specified with --binary-symbol-visibility

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 07:05:18 PDT 2019


MaskRay added a comment.

In D65893#1622790 <https://reviews.llvm.org/D65893#1622790>, @chrisjackson wrote:

> In D65893#1620711 <https://reviews.llvm.org/D65893#1620711>, @MaskRay wrote:
>
> > Quote gABI:
> >
> > > Second, if any reference to or definition of a name is a symbol with a non-default visibility attribute, the visibility attribute must be propagated to the resolving symbol in the linked object. If different visibility attributes are specified for distinct references to or definitions of a symbol, the most constraining visibility attribute must be propagated to the resolving symbol in the linked object. The attributes, ordered from least to most constraining, are: STV_PROTECTED, STV_HIDDEN and STV_INTERNAL.
> >
> > You can achieve the same with: `__attribute__((visibility("hidden"))) extern char _binary_a_start[];` So I'm not sure why another option is needed (I think my another concern is that the option name `--binary-symbol-visibility` can make people puzzled if they add/delete/change symbols). See D55682 <https://reviews.llvm.org/D55682>.
>
>
> Three symbols per embedding in an object results in bloated output.


I don't understand this point. How can the visibility change de-bloat the output?

> Preventing this with many attribute statements seems like a clumsy approach.

I don't understand this, either. Your are going to reference `_binary_a_start`, (`_binary_a_end` or `_binary_a_size`) - two undefined symbols. Restrict the undefined symbol with a visibility attribute, then the linked exe/dso will change the symbol bindings accordingly. What's the problem?

> With regards to the confusing option, we can just decide on a better name.

We can do that once we decide this option is useful.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65893/new/

https://reviews.llvm.org/D65893





More information about the llvm-commits mailing list