Re: [PATCH v4] libmnl: Drop the EXPORT_SYMBOL() tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 30, 2015 at 2:07 AM, Mike Frysinger <vapier@xxxxxxxxxx> wrote:
> Neutron Soutmun wrote:
>> * libmnl using an export map (-Wl,--version-script=),
>>  hence, no need to explicitly use the EXPORT_SYMBOL() tags.
>
> this isn't entirely accurate.  the use of hidden visibility allows for
> optimizations (e.g. bypassing the PLT).  export maps merely control the
> final visibility of the symbols at link time ... gcc is forced to assume
> every function call otherwise is still globally visible (exported).
>
> it doesn't make a big difference in the libmnl case as there aren't any
> real internal-only symbols, but in larger libraries, this sort of change
> increases code size and runtime overhead.
>
> this is why libraries take a different approach: set default visibility
> to hidden and then update the header with a macro like EXPORT.  there is
> only one file to declare the prototypes and the visibility markings are
> right there.  no need for EXPORT_SYMBOL() lines.  the export map is only
> really for toolchains that lack visibility support.

Thanks to point to this, it really make sense.

> something as simple as the patch below
> -mike

The initial problem for my proposed patch is the incompatible of
symbols visibility in gcc and clang
which libmnl is failed to build from source in clang and it's the one
of another approaches that pass the build in both gcc and clang.

I'll test your patch with clang and back to you ASAP.

Best regards,
Neutron Soutmun
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux