[PATCH] drivers: fix symbol exports when map is omitted

Tyler Retzlaff roretzla at linux.microsoft.com
Fri Dec 2 01:11:13 CET 2022


On Tue, Nov 29, 2022 at 06:23:21PM +0000, Ferruh Yigit wrote:
> On 11/29/2022 2:00 PM, David Marchand wrote:
> > ld exports any global symbol by default if no version script is passed.
> > As a consequence, the incriminated change let any public symbol leak
> > out of the driver shared libraries.
> > 
> 
> Not tested on Windows, but for Linux:

just for awareness the default is the opposite on windows symbols are
private by default and have to be explicitly made public.

also, for gcc we could go to the extreme and pass -fvisibility=hidden
and fix out any other symbols that are missed.

if you're really going wild you may consider introducing a macro that
can be expanded to __attribute__((visibility("default"))) combined with
-fvisibility=hidden (as opposed to version.map) the main benefit being
there's only a single source of truth about whether or not the symbol is
public, you don't have to look in 2 places.
(anyway, probably not a popular idea...)

ty


More information about the stable mailing list