libEGL was incorrectly exporting *all* symbols, public and private.
This patch adds -fvisibility=hidden to libEGL's linker flags to ensure
that only symbols annotated with __attribute__((visibility("default")))
get exported.

Sanity-checked on X11/EGL with Piglit, and on Wayland by running weston-gears.

CC: "9.2" <mesa-sta...@lists.freedesktop.org>
CC: Ian Romanick <i...@freedesktop.org>
CC: Kristian Høgsberg <k...@bitplanet.net>
Signed-off-by: Chad Versace <chad.vers...@linux.intel.com>
---

In my build of EGL, this patch made private the following previously public
libEGL symbols.  I build libEGL with --with-egl-platforms=x11,wayland,drm and
without gallium. 

T _eglAddAtExitCall
T _eglAppendArray
T _eglBuiltInDriverDRI2
T _eglBuiltInDriverGLX
D _eglBuiltInDrivers
T _eglCheckDisplayHandle
T _eglChooseConfig
T _eglChooseModeMESA
T _eglCreateArray
T _eglDestroyCurrentThread
T _eglEraseArray
T _eglFindArray
T _eglFindDisplay
T _eglFiniDisplay
T _eglFlattenArray
T _eglGetConfigAttrib
T _eglGetConfigs
T _eglGetDriverProc
T _eglGetModeAttribMESA
T _eglGetModesMESA
T _eglGetNativePlatform
T _eglGetScreensMESA
T _eglGetSyncAttribKHR
D _eglGlobal
T _eglInitResource
T _eglIsCurrentThreadDummy
T _eglLinkResource
T _eglLookupConfig
T _eglLookupMode
T _eglLookupScreen
T _eglMatchDriver
T _eglQueryContext
T _eglQueryModeStringMESA
T _eglQueryScreenMESA
T _eglQueryScreenModeMESA
T _eglQueryScreenSurfaceMESA
T _eglQueryString
T _eglQuerySurface
T _eglScreenPositionMESA
T _eglSurfaceAttrib
T _eglSwapInterval
T _eglUnlinkResource
T _eglUnloadDrivers
T _eglstrdup
T dri2_add_config
T dri2_create_image_khr
T dri2_create_screen
T dri2_get_device_name_for_fd
T dri2_get_driver_for_fd
T dri2_initialize_drm
T dri2_initialize_wayland
T dri2_initialize_x11
T dri2_load_driver
T dri2_load_driver_swrast
T dri2_lookup_egl_image
T dri2_setup_screen
D dri2_to_egl_attribute_map
D image_lookup_extension
D use_invalidate
T wayland_buffer_is_drm
T wayland_drm_buffer_get_buffer
T wayland_drm_buffer_get_format
T wayland_drm_init
T wayland_drm_uninit

 src/egl/drivers/dri2/Makefile.am        | 1 +
 src/egl/drivers/glx/Makefile.am         | 1 +
 src/egl/main/Makefile.am                | 1 +
 src/egl/wayland/wayland-drm/Makefile.am | 1 +
 src/egl/wayland/wayland-egl/Makefile.am | 1 +
 5 files changed, 5 insertions(+)

diff --git a/src/egl/drivers/dri2/Makefile.am b/src/egl/drivers/dri2/Makefile.am
index 45f7dfa..823ef5e 100644
--- a/src/egl/drivers/dri2/Makefile.am
+++ b/src/egl/drivers/dri2/Makefile.am
@@ -28,6 +28,7 @@ AM_CFLAGS = \
        -I$(top_srcdir)/src/egl/wayland/wayland-drm \
        -I$(top_builddir)/src/egl/wayland/wayland-drm \
        $(DEFINES) \
+       $(VISIBILITY_CFLAGS) \
        $(LIBDRM_CFLAGS) \
        $(LIBUDEV_CFLAGS) \
        $(LIBKMS_CFLAGS) \
diff --git a/src/egl/drivers/glx/Makefile.am b/src/egl/drivers/glx/Makefile.am
index 6bf67ea..6db95b4 100644
--- a/src/egl/drivers/glx/Makefile.am
+++ b/src/egl/drivers/glx/Makefile.am
@@ -22,6 +22,7 @@
 AM_CFLAGS = \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src/egl/main \
+       $(VISIBILITY_CFLAGS) \
        $(X11_CFLAGS) \
        $(DEFINES)
 
diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
index 1cfdce2..2e43860 100644
--- a/src/egl/main/Makefile.am
+++ b/src/egl/main/Makefile.am
@@ -27,6 +27,7 @@ AM_CFLAGS = \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src/gbm/main \
        $(DEFINES) \
+       $(VISIBILITY_CFLAGS) \
        $(EGL_CFLAGS) \
        -D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
        -D_EGL_DRIVER_SEARCH_DIR=\"$(EGL_DRIVER_INSTALL_DIR)\" \
diff --git a/src/egl/wayland/wayland-drm/Makefile.am 
b/src/egl/wayland/wayland-drm/Makefile.am
index 4b2aeb3..08ee497 100644
--- a/src/egl/wayland/wayland-drm/Makefile.am
+++ b/src/egl/wayland/wayland-drm/Makefile.am
@@ -1,6 +1,7 @@
 AM_CFLAGS = -I$(top_srcdir)/src/egl/main \
            -I$(top_srcdir)/include \
            $(DEFINES) \
+           $(VISIBILITY_CFLAGS) \
            $(WAYLAND_CFLAGS) 
 
 noinst_LTLIBRARIES = libwayland-drm.la
diff --git a/src/egl/wayland/wayland-egl/Makefile.am 
b/src/egl/wayland/wayland-egl/Makefile.am
index 7d20a1a..138c170 100644
--- a/src/egl/wayland/wayland-egl/Makefile.am
+++ b/src/egl/wayland/wayland-egl/Makefile.am
@@ -2,6 +2,7 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = wayland-egl.pc
 
 AM_CFLAGS = $(DEFINES) \
+           $(VISIBILITY_CFLAGS) \
            $(WAYLAND_CFLAGS)
 
 lib_LTLIBRARIES = libwayland-egl.la
-- 
1.8.3.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to