Right now undefined symbols in DRI drivers will still allow the
build to succeed.

As a result, people modifying drivers they cannot test risk creating
unloadable drivers with no easy way of automatically avoiding it.

For instance, the modifications to nv50 for context transfers caused
such an issue recently.

The fix is to build DRI drivers with -Wl,--no-undefined -lGL which
will cause make to fail in such cases.

Note that this introduces a dependency from the DRI drivers on libGL.so.1.
However, the driver loader calls dlopen on libGL.so.1 with
RTLD_GLOBAL | RTLD_NOW before loading any DRI driver, so the added
dependency shouldn't cause changes in runtime behavior.

Please double-check the correctness of this assumption before pushing.

All classic DRI drivers as well as all the Gallium drivers with configure
options compiled successfully with this change.

Thanks to Xavier Chantry <chantry.xav...@gmail.com> for helping with this.
---
 src/gallium/winsys/drm/Makefile.template |    4 ++--
 src/mesa/drivers/dri/Makefile.template   |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/winsys/drm/Makefile.template 
b/src/gallium/winsys/drm/Makefile.template
index f4cc0de..326cd59 100644
--- a/src/gallium/winsys/drm/Makefile.template
+++ b/src/gallium/winsys/drm/Makefile.template
@@ -66,9 +66,9 @@ default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
 $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) Makefile \
                $(TOP)/src/mesa/drivers/dri/Makefile.template
        $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-               $(OBJECTS) $(PIPE_DRIVERS) \
+               -Wl,--no-undefined $(OBJECTS) $(PIPE_DRIVERS) \
                 -Wl,--start-group $(MESA_MODULES) -Wl,--end-group \
-                 $(DRI_LIB_DEPS) $(DRIVER_EXTRAS)
+                 $(DRI_LIB_DEPS) $(DRIVER_EXTRAS) -L$(TOP)/lib -lGL
 
 $(TOP)/$(LIB_DIR)/gallium:
        mkdir -p $@
diff --git a/src/mesa/drivers/dri/Makefile.template 
b/src/mesa/drivers/dri/Makefile.template
index a0c25d2..dcffa70 100644
--- a/src/mesa/drivers/dri/Makefile.template
+++ b/src/mesa/drivers/dri/Makefile.template
@@ -53,7 +53,7 @@ lib: symlinks subdirs depend
 $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) Makefile \
                $(TOP)/src/mesa/drivers/dri/Makefile.template
        $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-               $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(DRI_LIB_DEPS)
+               -Wl,--no-undefined $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) 
$(DRI_LIB_DEPS) -L$(TOP)/lib -lGL
 
 
 $(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
-- 
1.6.3.3


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to