[Mesa-dev] [PATCH 23/24] automake: add -Wl, --no-undefined to all libraries

Emil Velikov emil.l.velikov at gmail.com
Thu Mar 27 14:00:38 PDT 2014


... apart from the dri drivers.
With this final change we can build mesa without fear that
the resulting libraries will have unresolved symbols.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/egl/main/Makefile.am                    | 6 +++++-
 src/egl/wayland/wayland-egl/Makefile.am     | 3 ++-
 src/gallium/Automake.inc                    | 9 ++++++---
 src/gallium/targets/gbm/Makefile.am         | 6 +++++-
 src/gallium/targets/libgl-xlib/Makefile.am  | 5 ++++-
 src/gallium/targets/opencl/Makefile.am      | 4 +++-
 src/gallium/targets/osmesa/Makefile.am      | 7 ++++++-
 src/gallium/targets/pipe-loader/Makefile.am | 1 +
 src/gallium/targets/xa/Makefile.am          | 3 ++-
 src/gbm/Makefile.am                         | 4 +++-
 src/glx/Makefile.am                         | 4 +++-
 src/mapi/es1api/Makefile.am                 | 5 ++++-
 src/mapi/es2api/Makefile.am                 | 5 ++++-
 src/mapi/shared-glapi/Makefile.am           | 4 +++-
 src/mapi/vgapi/Makefile.am                  | 5 ++++-
 src/mesa/drivers/osmesa/Makefile.am         | 7 ++++++-
 src/mesa/drivers/x11/Makefile.am            | 3 ++-
 17 files changed, 63 insertions(+), 18 deletions(-)

diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
index 46e890a..57c9ccd 100644
--- a/src/egl/main/Makefile.am
+++ b/src/egl/main/Makefile.am
@@ -73,7 +73,11 @@ libEGL_la_SOURCES = \
 
 libEGL_la_LIBADD = \
 	$(EGL_LIB_DEPS)
-libEGL_la_LDFLAGS = -Wl,-Bsymbolic -version-number 1:0 -no-undefined
+libEGL_la_LDFLAGS = \
+	-no-undefined \
+	-version-number 1:0 \
+	-Wl,-Bsymbolic \
+	-Wl,--no-undefined
 
 if HAVE_EGL_PLATFORM_X11
 AM_CFLAGS += -DHAVE_X11_PLATFORM
diff --git a/src/egl/wayland/wayland-egl/Makefile.am b/src/egl/wayland/wayland-egl/Makefile.am
index b8d1634..3c2673a 100644
--- a/src/egl/wayland/wayland-egl/Makefile.am
+++ b/src/egl/wayland/wayland-egl/Makefile.am
@@ -10,7 +10,8 @@ noinst_HEADERS = wayland-egl-priv.h
 libwayland_egl_la_SOURCES = wayland-egl.c
 libwayland_egl_la_LDFLAGS = \
 	-no-undefined \
-	-version-info 1
+	-version-info 1 \
+	-Wl,--no-undefined
 
 TESTS = wayland-egl-symbols-check
 
diff --git a/src/gallium/Automake.inc b/src/gallium/Automake.inc
index f36d93d..1151f91 100644
--- a/src/gallium/Automake.inc
+++ b/src/gallium/Automake.inc
@@ -64,20 +64,23 @@ GALLIUM_VDPAU_LINKER_FLAGS = \
 	-module \
 	-no-undefined \
 	-version-number $(VDPAU_MAJOR):$(VDPAU_MINOR) \
-	-export-symbols-regex $(VDPAU_EXPORTS)
+	-export-symbols-regex $(VDPAU_EXPORTS) \
+	-Wl,--no-undefined
 
 GALLIUM_XVMC_LINKER_FLAGS = \
 	-shared \
 	-module \
 	-no-undefined \
 	-version-number $(XVMC_MAJOR):$(XVMC_MINOR) \
-	-export-symbols-regex '^XvMC'
+	-export-symbols-regex '^XvMC' \
+	-Wl,--no-undefined
 
 GALLIUM_OMX_LINKER_FLAGS = \
 	-shared \
 	-module \
 	-no-undefined \
-	-export-symbols-regex $(EXPORTS)
+	-export-symbols-regex $(EXPORTS) \
+	-Wl,--no-undefined
 
 GALLIUM_VDPAU_LIB_DEPS = \
 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
diff --git a/src/gallium/targets/gbm/Makefile.am b/src/gallium/targets/gbm/Makefile.am
index bad581d..c109ddb 100644
--- a/src/gallium/targets/gbm/Makefile.am
+++ b/src/gallium/targets/gbm/Makefile.am
@@ -66,7 +66,11 @@ gbm_gallium_drm_la_LIBADD += \
 	$(LIBDRM_LIBS)
 endif
 
-gbm_gallium_drm_la_LDFLAGS = -no-undefined -avoid-version -module
+gbm_gallium_drm_la_LDFLAGS = \
+	-module \
+	-no-undefined \
+	-avoid-version \
+	-Wl,--no-undefined
 
 if HAVE_MESA_LLVM
 gbm_gallium_drm_la_LIBADD += $(LLVM_LIBS)
diff --git a/src/gallium/targets/libgl-xlib/Makefile.am b/src/gallium/targets/libgl-xlib/Makefile.am
index cc382db..d7aec7b 100644
--- a/src/gallium/targets/libgl-xlib/Makefile.am
+++ b/src/gallium/targets/libgl-xlib/Makefile.am
@@ -44,7 +44,10 @@ lib_LTLIBRARIES = libGL.la
 
 nodist_EXTRA_libGL_la_SOURCES = dummy.cpp
 libGL_la_SOURCES = xlib.c
-libGL_la_LDFLAGS = -version-number $(GL_MAJOR):$(GL_MINOR):$(GL_TINY) -no-undefined
+libGL_la_LDFLAGS = \
+	-no-undefined \
+	-version-number $(GL_MAJOR):$(GL_MINOR):$(GL_TINY) \
+	-Wl,--no-undefined
 
 libGL_la_LIBADD = \
 	$(top_builddir)/src/gallium/state_trackers/glx/xlib/libxlib.la \
diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am
index eb25a5e..b401d10 100644
--- a/src/gallium/targets/opencl/Makefile.am
+++ b/src/gallium/targets/opencl/Makefile.am
@@ -5,7 +5,9 @@ lib_LTLIBRARIES = lib at OPENCL_LIBNAME@.la
 lib at OPENCL_LIBNAME@_la_LDFLAGS = \
 	$(LLVM_LDFLAGS) \
 	-no-undefined \
-	-version-number 1:0
+	-version-number 1:0 \
+	-Wl,--no-undefined
+
 
 lib at OPENCL_LIBNAME@_la_LIBADD = \
 	$(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader_client.la \
diff --git a/src/gallium/targets/osmesa/Makefile.am b/src/gallium/targets/osmesa/Makefile.am
index 2b133c4..651fc5d 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -39,7 +39,12 @@ lib_LTLIBRARIES = lib at OSMESA_LIB@.la
 nodist_EXTRA_lib at OSMESA_LIB@_la_SOURCES = dummy.cpp
 lib at OSMESA_LIB@_la_SOURCES = target.c
 
-lib at OSMESA_LIB@_la_LDFLAGS = -module -version-number @OSMESA_VERSION@ -no-undefined
+lib at OSMESA_LIB@_la_LDFLAGS = \
+	-module \
+	-no-undefined \
+	-version-number @OSMESA_VERSION@ \
+	-Wl,--no-undefined
+
 
 if HAVE_SHARED_GLAPI
 SHARED_GLAPI_LIB = $(top_builddir)/src/mapi/shared-glapi/libglapi.la
diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am
index 6e78a75..00823fe 100644
--- a/src/gallium/targets/pipe-loader/Makefile.am
+++ b/src/gallium/targets/pipe-loader/Makefile.am
@@ -49,6 +49,7 @@ AM_LDFLAGS = \
 	-module \
 	-no-undefined \
 	-avoid-version \
+	-Wl,--no-undefined \
 	-Wl,--version-script=$(top_srcdir)/src/gallium/targets/pipe-loader/pipe.link
 
 if HAVE_MESA_LLVM
diff --git a/src/gallium/targets/xa/Makefile.am b/src/gallium/targets/xa/Makefile.am
index ed87b9f..214c51d 100644
--- a/src/gallium/targets/xa/Makefile.am
+++ b/src/gallium/targets/xa/Makefile.am
@@ -66,7 +66,8 @@ endif
 
 libxatracker_la_LDFLAGS = \
 	-no-undefined \
-	-version-number $(XA_MAJOR):$(XA_MINOR):$(XA_TINY)
+	-version-number $(XA_MAJOR):$(XA_MINOR):$(XA_TINY) \
+	-Wl,--no-undefined
 
 if HAVE_MESA_LLVM
 libxatracker_la_LIBADD += $(LLVM_LIBS)
diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
index d197163..c71a974 100644
--- a/src/gbm/Makefile.am
+++ b/src/gbm/Makefile.am
@@ -21,7 +21,9 @@ libgbm_la_SOURCES = \
 	main/backend.c
 libgbm_la_LDFLAGS = \
 	-no-undefined \
-	-version-info 1:0
+	-version-info 1:0 \
+	-Wl,--no-undefined
+
 libgbm_la_LIBADD = \
 	$(top_builddir)/src/loader/libloader.la \
 	$(DLOPEN_LIBS)
diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index eb20240..0c99c07 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -109,8 +109,10 @@ GL_LIBS = \
 	$(GL_LIB_DEPS)
 
 GL_LDFLAGS = \
+	-no-undefined \
+	-version-number 1:2 \
 	-Wl,-Bsymbolic \
-	-version-number 1:2 -no-undefined
+	-Wl,--no-undefined
 
 lib at GL_LIB@_la_SOURCES =
 lib at GL_LIB@_la_LIBADD = $(GL_LIBS)
diff --git a/src/mapi/es1api/Makefile.am b/src/mapi/es1api/Makefile.am
index b61f9cb..b958118 100644
--- a/src/mapi/es1api/Makefile.am
+++ b/src/mapi/es1api/Makefile.am
@@ -44,7 +44,10 @@ lib_LTLIBRARIES = libGLESv1_CM.la
 
 libGLESv1_CM_la_SOURCES = ../entry.c glapi_mapi_tmp.h
 libGLESv1_CM_la_LIBADD = $(GLESv1_CM_LIB_DEPS)
-libGLESv1_CM_la_LDFLAGS = -version-number 1:1 -no-undefined
+libGLESv1_CM_la_LDFLAGS = \
+	-no-undefined \
+	-version-number 1:1 \
+	-Wl,--no-undefined
 
 if HAVE_SHARED_GLAPI
 libGLESv1_CM_la_LIBADD += ../shared-glapi/libglapi.la
diff --git a/src/mapi/es2api/Makefile.am b/src/mapi/es2api/Makefile.am
index a944493..1fb6d7c 100644
--- a/src/mapi/es2api/Makefile.am
+++ b/src/mapi/es2api/Makefile.am
@@ -48,7 +48,10 @@ lib_LTLIBRARIES = libGLESv2.la
 
 libGLESv2_la_SOURCES = ../entry.c glapi_mapi_tmp.h
 libGLESv2_la_LIBADD = $(GLESv2_LIB_DEPS)
-libGLESv2_la_LDFLAGS = -version-number 2 -no-undefined
+libGLESv2_la_LDFLAGS = \
+	-no-undefined \
+	-version-number 2 \
+	-Wl,--no-undefined
 
 if HAVE_SHARED_GLAPI
 libGLESv2_la_LIBADD += ../shared-glapi/libglapi.la
diff --git a/src/mapi/shared-glapi/Makefile.am b/src/mapi/shared-glapi/Makefile.am
index 8d8b4dd..7e1068f 100644
--- a/src/mapi/shared-glapi/Makefile.am
+++ b/src/mapi/shared-glapi/Makefile.am
@@ -9,7 +9,9 @@ include $(top_srcdir)/src/mapi/Makefile.sources
 lib_LTLIBRARIES = libglapi.la
 libglapi_la_SOURCES = $(MAPI_GLAPI_FILES)
 libglapi_la_LIBADD = $(PTHREAD_LIBS) $(SELINUX_LIBS)
-libglapi_la_LDFLAGS = -no-undefined
+libglapi_la_LDFLAGS = \
+	-no-undefined \
+	-Wl,--no-undefined
 
 include $(GLAPI)/gen/glapi_gen.mk
 glapi_mapi_tmp.h : $(GLAPI)/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
diff --git a/src/mapi/vgapi/Makefile.am b/src/mapi/vgapi/Makefile.am
index 197f19f..f85addc 100644
--- a/src/mapi/vgapi/Makefile.am
+++ b/src/mapi/vgapi/Makefile.am
@@ -44,7 +44,10 @@ TOP=$(top_srcdir)
 include ../Makefile.sources
 libOpenVG_la_SOURCES = $(MAPI_FILES) vgapi_tmp.h
 libOpenVG_la_LIBADD = $(VG_LIB_DEPS)
-libOpenVG_la_LDFLAGS = -version-number 1 -no-undefined
+libOpenVG_la_LDFLAGS = \
+	-no-undefined \
+	-version-number 1 \
+	-Wl,--no-undefined
 
 vgapi_tmp.h: $(srcdir)/vgapi.csv $(top_srcdir)/src/mapi/mapi_abi.py
 	$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(top_srcdir)/src/mapi/mapi_abi.py \
diff --git a/src/mesa/drivers/osmesa/Makefile.am b/src/mesa/drivers/osmesa/Makefile.am
index bc1244f..cfab702 100644
--- a/src/mesa/drivers/osmesa/Makefile.am
+++ b/src/mesa/drivers/osmesa/Makefile.am
@@ -35,7 +35,12 @@ lib_LTLIBRARIES = lib at OSMESA_LIB@.la
 nodist_EXTRA_lib at OSMESA_LIB@_la_SOURCES = dummy.cpp
 lib at OSMESA_LIB@_la_SOURCES = osmesa.c
 
-lib at OSMESA_LIB@_la_LDFLAGS = -module -version-number @OSMESA_VERSION@ -no-undefined
+lib at OSMESA_LIB@_la_LDFLAGS = \
+	-module \
+	-no-undefined \
+	-version-number @OSMESA_VERSION@ \
+	-Wl,--no-undefined
+
 
 if HAVE_SHARED_GLAPI
 SHARED_GLAPI_LIB = $(top_builddir)/src/mapi/shared-glapi/libglapi.la
diff --git a/src/mesa/drivers/x11/Makefile.am b/src/mesa/drivers/x11/Makefile.am
index 27343d1..4c63d59 100644
--- a/src/mesa/drivers/x11/Makefile.am
+++ b/src/mesa/drivers/x11/Makefile.am
@@ -62,7 +62,8 @@ lib at GL_LIB@_la_LIBADD = \
 	$(GL_LIB_DEPS)
 
 lib at GL_LIB@_la_LDFLAGS = \
+	-no-undefined \
 	-version-number $(GL_MAJOR):$(GL_MINOR):$(GL_PATCH) \
-	-no-undefined
+	-Wl,--no-undefined
 
 include $(top_srcdir)/install-lib-links.mk
-- 
1.9.1



More information about the mesa-dev mailing list