[PATCH wayland v2 1/4] wayland-util: do not export the wl_map_* API

Emil Velikov emil.l.velikov at gmail.com
Wed Mar 15 10:53:35 UTC 2017


On 15 March 2017 at 10:25, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Tue, 14 Mar 2017 15:52:20 +0000
> Emil Velikov <emil.l.velikov at gmail.com> wrote:
>
>> On 14 March 2017 at 11:31, Pekka Paalanen <ppaalanen at gmail.com> wrote:
>> > On Tue, 21 Feb 2017 16:14:26 +0000
>> > Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> >
>> >> From: Emil Velikov <emil.velikov at collabora.com>
>> >>
>> >> Used only internally and explicitly marked as such with commit
>> >> cf04b0a18f2 ("Move private definitions and prototypes to new
>> >> zwayland-private.h")
>> >>
>> >> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
>> >> ---
>> >>  src/wayland-util.c | 18 +++++++++---------
>> >>  1 file changed, 9 insertions(+), 9 deletions(-)
>> >
>> > Hi,
>> >
>> > R-b me and pushed:
>> >    9b78be6..654dee8  master -> master
>> >
>> >
>> > Let's see if anyone screams and forces us to revert. These have not
>> > been in public headers even in 1.0 release.
>> >
>> Thanks and let's hope we don't have to revert it.
>>
>> > I verified with 'nm -g --defined-only' that this patch indeed does stop
>> > exporting the symbols.
>> >
>> I think you want `nm -CD --defined-only' here, since -g produces "no
>> symbols" even for libraries such as libGL.so.
>> Strictly speaking D is not needed, since it demangles any C++ symbols.
>
> Hmm, yes... still the output was completely what I was expecting.
>
> $ nm -g --defined-only $WLD/lib/libwayland-*.so > newsyms.txt
> $ nm -CD --defined-only $WLD/lib/libwayland-*.so > newsyms2.txt
>
> The results are identical. Why is that, and why is it not that with
> libGL.so?
>
> I feel like I'm missing some shared object basics here.
>
> If I am to trust and understand
> http://stackoverflow.com/questions/15345543/when-to-use-dynamic-option-in-nm
>
Thanks for the article. I'll read it up in a minute.

> it seems that I would actually want -g --defined-only because I'm
> interested only in symbols usable from outside. In addition I would
> want -D to look at the dynamic table which will be used by the runtime
> linker. So actually I'd want all those options?
>
> Which means I was actually comparing the static linking tables of a...
> shared object file... which doesn't make any sense?
>
Yes, that's one way to put it.

The way I remember it:
 - CD --defined-only -> all the exported symbols, even with the
implicit, platform specific ones.
 - g --defined-only -> the "extern" non-exported symbols - will
disappear as you strip the binary
Note: __attribute__ visibility controls which "extern" symbols are
exported and which are not.
 - gCD --defined-only -> all the exported symbols, w/o the implicit,
platform specific ones

> That leaves a fun question of what kind of symbol would be defined, in
> the dynamic table, but not exported. Perhaps a weak function with an
> implementation but allowed to be overridden by another provider
> exporting the same?
>
> Just for fun:
>
> $ diff -u <(nm -DC --defined-only /usr/lib/libGL.so.1.2.0 ) <( nm -gDC --defined-only /usr/lib/libGL.so.1.2.0 )
> --- /dev/fd/63  2017-03-15 12:19:45.931004715 +0200
> +++ /dev/fd/62  2017-03-15 12:19:45.931004715 +0200
> @@ -1,6 +1,3 @@
> -0000000000272a88 b __bss_start
> -0000000000272a88 d _edata
> -00000000002735a8 b _end
>  0000000000059054 T _fini
>  0000000000017dd8 T _init
>  0000000000052da0 T glAccum
>
>
> I'll try to remember to use 'nm -gDC --defined-only' in the future,
> correct?
>
Yes - with or w/o the "g".

-Emil


More information about the wayland-devel mailing list