[PATCH 4/4: v2] Enable no-undefined symbols mode in Solaris builds if -z parent is in ld
Alan Coopersmith
alan.coopersmith at oracle.com
Thu Jun 21 17:52:57 PDT 2012
The Solaris linker recently added a -z parent flag for easier checking
of symbol definitions in plugins against the program that loads them.
If that's present, this enables it, along with -z defs to error on
undefined symbols to alert us if any modules call symbols that won't
be found at runtime.
This builds upon, and requires, the recent Cygwin work to build Xorg.
It moves a couple more modules to be after the Xorg binary in the build
order so that they can find the binary to check against, much as the
Cygwin changes did (these would be modules built on Solaris but not
Cygwin).
v2: This version only sets the flags for the xorg-server build itself,
and does not yet export them in xorg-server.pc to the drivers, since
most of the drivers are not ready to build with -no-undefined yet.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
configure.ac | 20 ++++++++++++++++++++
hw/xfree86/Makefile.am | 6 +++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7047d97..157e487 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1500,6 +1500,26 @@ case "$host_os" in
XORG_DRIVER_LIBS="-lXorg.exe -L\${moduledir} -lshadow -lfb -no-undefined"
CYGWIN=yes
;;
+ solaris*)
+ # We use AC_LINK_IFELSE to generate a temporary program conftest$EXEEXT
+ # that we can link against for testing if the system linker is new
+ # enough to support -z parent=<program> for verifying loadable modules
+ # are only calling functions defined in either the loading program or
+ # the libraries they're linked with.
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([int main(int argc, char **argv) { return 0; }])],
+ [mv conftest$EXEEXT conftest.parent
+ XORG_CHECK_LINKER_FLAGS([-Wl,-z,parent=conftest.parent -G],
+ [LD_NO_UNDEFINED_FLAG="-Wl,-z,defs -Wl,-z,parent=\$(top_builddir)/hw/xfree86/Xorg"
+# Not set yet, since this gets exported in xorg-server.pc to all the drivers,
+# and they're not all fixed to build correctly with it yet.
+# XORG_DRIVER_LIBS="-Wl,-z,defs -Wl,-z,parent=${bindir}/Xorg"
+ ],[],
+ [AC_LANG_SOURCE([extern int main(int argc, char **argv);
+ int call_main(void) { return main(0, NULL); }])])
+ rm -f conftest.parent
+ ])
+ ;;
esac
AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
AC_SUBST([LD_NO_UNDEFINED_FLAG])
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index e50cb88..4d5d576 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -26,9 +26,9 @@ INT10_SUBDIR = int10
endif
SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \
- ramdac $(VBE_SUBDIR) $(VGAHW_SUBDIR) $(XAA_SUBDIR) \
- loader modes . i2c dixmods fbdevhw shadowfb exa \
- $(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) doc man
+ ramdac $(VGAHW_SUBDIR) loader modes . $(VBE_SUBDIR) \
+ $(XAA_SUBDIR) $(DRI_SUBDIR) $(DRI2_SUBDIR) i2c dixmods \
+ fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man
DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
parser ramdac shadowfb vbe vgahw xaa \
--
1.7.9.2
More information about the xorg-devel
mailing list