[Mesa-dev] [PATCH] gallium/dri-targets: hide all symbols except for __driDriverExtensions
Chia-I Wu
olvaffe at gmail.com
Wed Aug 14 22:38:51 PDT 2013
On Thu, Aug 15, 2013 at 1:26 PM, Chia-I Wu <olvaffe at gmail.com> wrote:
> On Sat, Aug 10, 2013 at 2:56 AM, Marek Olšák <maraeo at gmail.com> wrote:
>> Most importantly, this hides all LLVM symbols. They shouldn't clash
>> with a different LLVM version used by apps (at least in theory).
>>
>> $ nm -g --defined-only radeonsi_dri.so
>> 01148f30 D __driDriverExtensions
> I am not familiar with issues regarding LLVM symbols so I am fine with
> the change if this is what needs to be done (except maybe use
> -export-symbols-regex __driDriverExtensions to avoid the version
> script?)
>
> But I ran the nm command on ilo_dri.so, and almost all of the exported
> symbols are from libdricommon or st/dri. I think those two components
> need VISIBILITY_CFLAGS in their AM_CFLAGS and __driDriverExtensions
> needs to be marked as PUBLIC. This way other gallium targets can
> benefit.
There is no other gallium target that uses st/dri :)
Anyway, in addition to controlling exported symbols using symbol
files, I still like to see VISIBILITY_CFLAGS be added to st/dri and
the dri targets, which directly list source files from libdrmcommon in
their SOURCES. Besides, it seems __driConfigOptions and
__dri2ConfigOptions are also marked PUBLIC. Do they need to be
exported?
>> We could do something similar for the other targets.
>> ---
>> src/gallium/targets/dri-freedreno/Makefile.am | 5 ++++-
>> src/gallium/targets/dri-i915/Makefile.am | 5 ++++-
>> src/gallium/targets/dri-ilo/Makefile.am | 5 ++++-
>> src/gallium/targets/dri-nouveau/Makefile.am | 5 ++++-
>> src/gallium/targets/dri-r300/Makefile.am | 5 ++++-
>> src/gallium/targets/dri-r600/Makefile.am | 5 ++++-
>> src/gallium/targets/dri-radeonsi/Makefile.am | 5 ++++-
>> src/gallium/targets/dri-swrast/Makefile.am | 5 ++++-
>> src/gallium/targets/dri-vmwgfx/Makefile.am | 5 ++++-
>> src/gallium/targets/dri.version | 5 +++++
>> 10 files changed, 41 insertions(+), 9 deletions(-)
>> create mode 100644 src/gallium/targets/dri.version
>>
>> diff --git a/src/gallium/targets/dri-freedreno/Makefile.am b/src/gallium/targets/dri-freedreno/Makefile.am
>> index cfa1f37..79aa3db 100644
>> --- a/src/gallium/targets/dri-freedreno/Makefile.am
>> +++ b/src/gallium/targets/dri-freedreno/Makefile.am
>> @@ -46,7 +46,10 @@ kgsl_dri_la_SOURCES = \
>> $(top_srcdir)/src/mesa/drivers/dri/common/dri_util.c \
>> $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
>>
>> -kgsl_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
>> +kgsl_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
>> + -Wl,--version-script=../dri.version
>> +
>> +kgsl_dri_la_DEPENDENCIES = ../dri.version
>>
>> kgsl_dri_la_LIBADD = \
>> $(top_builddir)/src/mesa/libmesagallium.la \
>> diff --git a/src/gallium/targets/dri-i915/Makefile.am b/src/gallium/targets/dri-i915/Makefile.am
>> index ce6be78..f13a10b 100644
>> --- a/src/gallium/targets/dri-i915/Makefile.am
>> +++ b/src/gallium/targets/dri-i915/Makefile.am
>> @@ -46,7 +46,10 @@ i915_dri_la_SOURCES = \
>> $(top_srcdir)/src/mesa/drivers/dri/common/dri_util.c \
>> $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
>>
>> -i915_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
>> +i915_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
>> + -Wl,--version-script=../dri.version
>> +
>> +i915_dri_la_DEPENDENCIES = ../dri.version
>>
>> i915_dri_la_LIBADD = \
>> $(top_builddir)/src/mesa/libmesagallium.la \
>> diff --git a/src/gallium/targets/dri-ilo/Makefile.am b/src/gallium/targets/dri-ilo/Makefile.am
>> index 7761f33..9864e5c 100644
>> --- a/src/gallium/targets/dri-ilo/Makefile.am
>> +++ b/src/gallium/targets/dri-ilo/Makefile.am
>> @@ -47,7 +47,10 @@ ilo_dri_la_SOURCES = \
>>
>> # need -rpath to create a noinst shared library
>> ilo_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
>> - -rpath $(abs_builddir)
>> + -rpath $(abs_builddir) \
>> + -Wl,--version-script=../dri.version
>> +
>> +ilo_dri_la_DEPENDENCIES = ../dri.version
>>
>> ilo_dri_la_LIBADD = \
>> $(top_builddir)/src/mesa/libmesagallium.la \
>> diff --git a/src/gallium/targets/dri-nouveau/Makefile.am b/src/gallium/targets/dri-nouveau/Makefile.am
>> index 69ccf32..26ed682 100644
>> --- a/src/gallium/targets/dri-nouveau/Makefile.am
>> +++ b/src/gallium/targets/dri-nouveau/Makefile.am
>> @@ -45,7 +45,10 @@ nouveau_dri_la_SOURCES = \
>> $(top_srcdir)/src/mesa/drivers/dri/common/dri_util.c \
>> $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
>>
>> -nouveau_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
>> +nouveau_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
>> + -Wl,--version-script=../dri.version
>> +
>> +nouveau_dri_la_DEPENDENCIES = ../dri.version
>>
>> nouveau_dri_la_LIBADD = \
>> $(top_builddir)/src/mesa/libmesagallium.la \
>> diff --git a/src/gallium/targets/dri-r300/Makefile.am b/src/gallium/targets/dri-r300/Makefile.am
>> index 8c0215d..956e0b5 100644
>> --- a/src/gallium/targets/dri-r300/Makefile.am
>> +++ b/src/gallium/targets/dri-r300/Makefile.am
>> @@ -46,7 +46,10 @@ r300_dri_la_SOURCES = \
>> $(top_srcdir)/src/mesa/drivers/dri/common/dri_util.c \
>> $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
>>
>> -r300_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
>> +r300_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
>> + -Wl,--version-script=../dri.version
>> +
>> +r300_dri_la_DEPENDENCIES = ../dri.version
>>
>> r300_dri_la_LIBADD = \
>> $(top_builddir)/src/mesa/libmesagallium.la \
>> diff --git a/src/gallium/targets/dri-r600/Makefile.am b/src/gallium/targets/dri-r600/Makefile.am
>> index 2b3524b..d6804fe 100644
>> --- a/src/gallium/targets/dri-r600/Makefile.am
>> +++ b/src/gallium/targets/dri-r600/Makefile.am
>> @@ -45,7 +45,10 @@ r600_dri_la_SOURCES = \
>> $(top_srcdir)/src/mesa/drivers/dri/common/dri_util.c \
>> $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
>>
>> -r600_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
>> +r600_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
>> + -Wl,--version-script=../dri.version
>> +
>> +r600_dri_la_DEPENDENCIES = ../dri.version
>>
>> r600_dri_la_LIBADD = \
>> $(top_builddir)/src/mesa/libmesagallium.la \
>> diff --git a/src/gallium/targets/dri-radeonsi/Makefile.am b/src/gallium/targets/dri-radeonsi/Makefile.am
>> index f7d87a6..6f2e36c 100644
>> --- a/src/gallium/targets/dri-radeonsi/Makefile.am
>> +++ b/src/gallium/targets/dri-radeonsi/Makefile.am
>> @@ -46,7 +46,10 @@ radeonsi_dri_la_SOURCES = \
>> $(top_srcdir)/src/mesa/drivers/dri/common/dri_util.c \
>> $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
>>
>> -radeonsi_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
>> +radeonsi_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
>> + -Wl,--version-script=../dri.version
>> +
>> +radeonsi_dri_la_DEPENDENCIES = ../dri.version
>>
>> radeonsi_dri_la_LIBADD = \
>> $(top_builddir)/src/mesa/libmesagallium.la \
>> diff --git a/src/gallium/targets/dri-swrast/Makefile.am b/src/gallium/targets/dri-swrast/Makefile.am
>> index 1104379..698fff8 100644
>> --- a/src/gallium/targets/dri-swrast/Makefile.am
>> +++ b/src/gallium/targets/dri-swrast/Makefile.am
>> @@ -46,7 +46,10 @@ swrast_dri_la_SOURCES = \
>> $(top_srcdir)/src/mesa/drivers/dri/common/drisw_util.c \
>> $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
>>
>> -swrast_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
>> +swrast_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
>> + -Wl,--version-script=../dri.version
>> +
>> +swrast_dri_la_DEPENDENCIES = ../dri.version
>>
>> swrast_dri_la_LIBADD = \
>> $(top_builddir)/src/mesa/libmesagallium.la \
>> diff --git a/src/gallium/targets/dri-vmwgfx/Makefile.am b/src/gallium/targets/dri-vmwgfx/Makefile.am
>> index ca7df65..9b7b256 100644
>> --- a/src/gallium/targets/dri-vmwgfx/Makefile.am
>> +++ b/src/gallium/targets/dri-vmwgfx/Makefile.am
>> @@ -45,7 +45,10 @@ vmwgfx_dri_la_SOURCES = \
>> $(top_srcdir)/src/mesa/drivers/dri/common/dri_util.c \
>> $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
>>
>> -vmwgfx_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
>> +vmwgfx_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined \
>> + -Wl,--version-script=../dri.version
>> +
>> +vmwgfx_dri_la_DEPENDENCIES = ../dri.version
>>
>> vmwgfx_dri_la_LIBADD = \
>> $(top_builddir)/src/mesa/libmesagallium.la \
>> diff --git a/src/gallium/targets/dri.version b/src/gallium/targets/dri.version
>> new file mode 100644
>> index 0000000..d1038a2
>> --- /dev/null
>> +++ b/src/gallium/targets/dri.version
>> @@ -0,0 +1,5 @@
>> +{
>> + global:
>> + __driDriverExtensions;
>> + local: *;
>> +};
>> --
>> 1.8.1.2
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
>
> --
> olv at LunarG.com
--
olv at LunarG.com
More information about the mesa-dev
mailing list