[PATCH 3/4] Fix dtrace hook special object generation

Peter Hutterer peter.hutterer at who-t.net
Sun Jun 17 20:40:18 PDT 2012


With --disable-xorg, We also disabled a bunch of tests because of their
perceived reliance on a DDX. The cause was libtool missing some object files
that never ended up in libxservertest.la. Only the xfree86 test has a true
dependency on XORG.

DIX_LIB was pointing to dix.O (instead of libdix.la) when
DTRACE_SPECIAL_OBJECTS was defined. libdix.la should be part of XSERVER_LIBS
but dix.O is not a recognised libtool object, so it got skipped for
libxservertest.a. Only in the XORG case would we add DIX_LIB and OS_LIB
manually, thus forcing linkage with the dtrace-generated objects.

Fix this by packaging up the dtrace-generated files as part of
libdix.la/libos.la.

Hilarity included to auto-create the source file (so automake will trigger
the hook) and calling libtool --mode=compile so it'll recognise the
dtrace-generated object files and package, suggestions welcome.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac         |   10 +++-------
 dix/Makefile.am      |   15 +++++++--------
 os/Makefile.am       |   14 ++++++++------
 test/Makefile.am     |    7 -------
 test/xi2/Makefile.am |    4 ----
 5 files changed, 18 insertions(+), 32 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9cf2821..d2b1540 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1314,13 +1314,9 @@ AC_DEFINE(XSYNC, 1, [Support XSync extension])
 AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
 AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
 
-if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
-  DIX_LIB='$(top_builddir)/dix/dix.O'
-  OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS)'
-else
-  DIX_LIB='$(top_builddir)/dix/libdix.la'
-  OS_LIB='$(top_builddir)/os/libos.la'
-fi
+DIX_LIB='$(top_builddir)/dix/libdix.la'
+OS_LIB='$(top_builddir)/os/libos.la'
+
 AC_SUBST([DIX_LIB])
 AC_SUBST([OS_LIB])
 
diff --git a/dix/Makefile.am b/dix/Makefile.am
index b7358aa..6a1e0c3 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -60,14 +60,13 @@ endif
 
 if SPECIAL_DTRACE_OBJECTS
 # Generate dtrace object code for probes in libdix
-dtrace-dix.o: $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS)
-	$(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
+BUILT_SOURCES = dix-probes.dtrace
+dix-probes.dtrace: $(srcdir)/Xserver.d
+	touch $@
 
-noinst_PROGRAMS = dix.O
-
-dix_O_SOURCES =
-dix.O: dtrace-dix.o $(am_libdix_la_OBJECTS)
-	$(AM_V_GEN)ld -r -o $@ $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
+.dtrace.lo: $(top_srcdir)/dix/Xserver.d
+	$(AM_V_GEN)$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS)--mode=compile $(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d
+libdix_la_SOURCES += dix-probes.dtrace
 endif
 
-CLEANFILES = Xserver-dtrace.h
+CLEANFILES = Xserver-dtrace.h dix-probes.dtrace
diff --git a/os/Makefile.am b/os/Makefile.am
index 8891485..3cad763 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -38,12 +38,14 @@ EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)
 
 if SPECIAL_DTRACE_OBJECTS
 # Generate dtrace object code for probes in libos & libdix
-dtrace.o: $(top_srcdir)/dix/Xserver.d $(am_libos_la_OBJECTS)
-	$(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o ../dix/.libs/*.o
+BUILT_SOURCES = probes.dtrace
+probes.dtrace: $(top_srcdir)/dix/Xserver.d
+	touch $@
 
-noinst_PROGRAMS = os.O
+.dtrace.lo: $(top_srcdir)/dix/Xserver.d
+	$(AM_V_GEN)$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d
 
-os_O_SOURCES =
-os.O: dtrace.o $(am_libos_la_OBJECTS)
-	$(AM_V_GEN)ld -r -o $@ dtrace.o .libs/*.o
+libos_la_SOURCES += probes.dtrace
+
+CLEANFILES = probes.dtrace
 endif
diff --git a/test/Makefile.am b/test/Makefile.am
index 76e651c..0b93c1c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -21,13 +21,6 @@ INCLUDES += -I$(top_srcdir)/hw/xfree86/parser \
 	-I$(top_srcdir)/hw/xfree86/ramdac
 endif
 TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
-
-if XORG
-if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
-endif
-
 xkb_LDADD=$(TEST_LDADD)
 input_LDADD=$(TEST_LDADD)
 xtest_LDADD=$(TEST_LDADD)
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index 9de7abf..0ad8b10 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -21,10 +21,6 @@ INCLUDES = @XORG_INCS@
 TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLX_SYS_LIBS)
 COMMON_SOURCES=protocol-common.h protocol-common.c
 
-if SPECIAL_DTRACE_OBJECTS
-TEST_LDADD += $(OS_LIB) $(DIX_LIB)
-endif
-
 protocol_xiqueryversion_LDADD=$(TEST_LDADD)
 protocol_xiquerydevice_LDADD=$(TEST_LDADD)
 protocol_xiselectevents_LDADD=$(TEST_LDADD)
-- 
1.7.10.2



More information about the xorg-devel mailing list