[PATCH xserver] Move dtrace out of os,dix
Mihail Konev
k.mvc at ya.ru
Fri Feb 10 02:26:09 UTC 2017
Put the dtrace objects into a separate lib.
This avoids needing to "ld -r" the os.O, which was changing linker's
behaviour to be more forgiving for "./configure --with-dtrace" build,
or when /usr/bin/dtrace is present.
Specifically, it was making symbols from os.O and dix.O
(i.e. os/ and dix/) visible from everywhere on the linker command
line, not just from the preceding libraries.
This was making with-dtrace-being-present build-testing unreliable,
e.g. see the commit 3f8c2f94483bf0b96e129c97ef4950170a3f05b4.
Moreover, the os.O was requiring conflicting workarounds that the
libos.a did not, at least, 3ef16dfb9830bd6b41ae428f4f213ae0c35c1056
broke the "./configure --enable-dmx --with-dtrace=no" build.
Xnest,Xdmx,Xwayland ignore the common XSERVER_[SYS_]LIBS;
add the lib to their makefiles directly, the quick-and-dirty way.
For KDrive, do this in configure, not in every makefile.
Tests seemed to work the visibility around by appending libos.la;
do it unconditionally.
For Xdmx, also revert the now-errorneous 3ef16dfb ("dmx: fix linking").
Fixes: 49a26681 ("Add DTrace probe points")
Fixes: 3ef16dfb ("dmx: fix linking")
Reported-by: Byeong-ryeol Kim <brofkims at gmail.com>
Signed-off-by: Mihail Konev <k.mvc at ya.ru>
---
Makes the both previous "linking into" and "configure reordering" patches unnecessary.
Editing makefiles was chosen over configure.ac for faster regeneration
and better diff readability.
Build-tested on top of 058809c43ec578a407cf40d4c3e54a42503e3562,
with "./configure --enable-dmx" on Ubuntu 17.04 daily without the systemtap/dtrace.
Also, not on Ubuntu, and with /usr/bin/dtrace from systemtap,
as "./configure --enable-{dmx,kdrive,ephyr,xfake,xfbdev}",
with and without "--with-dtrace=no".
Makefile.am | 1 +
configure.ac | 22 +++++++++++++---------
dix/Makefile.am | 12 ------------
dtrace/Makefile.am | 33 +++++++++++++++++++++++++++++++++
hw/dmx/Makefile.am | 4 ++--
hw/xnest/Makefile.am | 1 +
hw/xwayland/Makefile.am | 1 +
os/Makefile.am | 12 ------------
test/Makefile.am | 7 ++-----
9 files changed, 53 insertions(+), 40 deletions(-)
create mode 100644 dtrace/Makefile.am
diff --git a/Makefile.am b/Makefile.am
index f0fa2d839f7e..bb796759f228 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,6 +61,7 @@ SUBDIRS = \
exa \
$(GLAMOR_DIR) \
config \
+ dtrace \
hw \
test
diff --git a/configure.ac b/configure.ac
index 4dcf8b5c27a0..efe38883125b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1579,15 +1579,18 @@ AC_DEFINE(XSYNC, 1, [Support XSync extension])
AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
+DIX_LIB='$(top_builddir)/dix/libdix.la'
+OS_LIB='$(top_builddir)/os/libos.la'
+
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) $(LIBUNWIND_LIBS)'
-else
- DIX_LIB='$(top_builddir)/dix/libdix.la'
- OS_LIB='$(top_builddir)/os/libos.la'
+ DTRACE_LIB='$(top_builddir)/dtrace/libdtrace.a'
+ DTRACE_SYS_LIBS='$(SHA1_LIBS) $(DLOPEN_LIBS) $(LIBUNWIND_LIBS)'
fi
+
AC_SUBST([DIX_LIB])
AC_SUBST([OS_LIB])
+AC_SUBST([DTRACE_LIB])
+AC_SUBST([DTRACE_SYS_LIBS])
MAIN_LIB='$(top_builddir)/dix/libmain.la'
AC_SUBST([MAIN_LIB])
@@ -1754,8 +1757,8 @@ AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$LIBUNWIND" = xyes])
# require.
#
XSERVER_CFLAGS="${XSERVER_CFLAGS} ${XSERVERCFLAGS_CFLAGS}"
-XSERVER_LIBS="$DIX_LIB $MI_LIB $OS_LIB"
-XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}"
+XSERVER_LIBS="$DIX_LIB $MI_LIB $OS_LIB $DTRACE_LIB"
+XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${DTRACE_SYS_LIBS}"
AC_SUBST([XSERVER_LIBS])
AC_SUBST([XSERVER_SYS_LIBS])
@@ -2447,13 +2450,13 @@ if test "$KDRIVE" = yes; then
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
- KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
+ KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB $DTRACE_LIB"
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.la'
KDRIVE_MAIN_LIB="$MAIN_LIB"
KDRIVE_LOCAL_LIBS="$DIX_LIB $KDRIVE_LIB"
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
- KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS"
+ KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS $DTRACE_SYS_LIBS"
AC_SUBST([XEPHYR_LIBS])
AC_SUBST([XEPHYR_INCS])
@@ -2556,6 +2559,7 @@ glx/Makefile
include/Makefile
composite/Makefile
damageext/Makefile
+dtrace/Makefile
dbe/Makefile
dix/Makefile
doc/Makefile
diff --git a/dix/Makefile.am b/dix/Makefile.am
index a4171d7e1f12..476bd35bd566 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -59,16 +59,4 @@ Xserver-dtrace.h: $(srcdir)/Xserver.d
endif
-if SPECIAL_DTRACE_OBJECTS
-# Generate dtrace object code for probes in libdix
-dtrace-dix.o: $(top_srcdir)/dix/Xserver.d libdix.la
- $(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
-
-noinst_PROGRAMS = dix.O
-
-dix_O_SOURCES =
-dix.O: dtrace-dix.o libdix.la
- $(AM_V_GEN)ld -r -o $@ $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
-endif
-
CLEANFILES = Xserver-dtrace.h
diff --git a/dtrace/Makefile.am b/dtrace/Makefile.am
new file mode 100644
index 000000000000..ba790f77f55f
--- /dev/null
+++ b/dtrace/Makefile.am
@@ -0,0 +1,33 @@
+# Generate dtrace object code for probes in libos & libdix
+# Must be built only after them.
+# Note that libos & libdix do depend on symbols from this one.
+
+DTRACE_OBJS = \
+ os-dtrace.o \
+ dix-dtrace.o
+
+CLEANFILES = $(DTRACE_OBJS)
+
+if SPECIAL_DTRACE_OBJECTS
+
+noinst_PROGRAMS = libdtrace.a
+
+libdtrace.a: $(DTRACE_OBJS)
+ $(AM_V_CCLD) $(AR) cru $@ $(DTRACE_OBJS)
+
+os-dtrace.o: $(top_srcdir)/dix/Xserver.d $(top_builddir)/os/libos.la
+ $(AM_V_GEN)$(DTRACE) -G -C \
+ -I$(top_srcdir)/dix/ -I$(top_builddir)/dix/ \
+ -I$(top_srcdir)/os/ -I$(top_builddir)/os/ \
+ -o $@ \
+ -s $(top_srcdir)/dix/Xserver.d \
+ $(top_builddir)/os/.libs/*.o
+
+dix-dtrace.o: $(top_srcdir)/dix/Xserver.d $(top_builddir)/dix/libdix.la
+ $(AM_V_GEN)$(DTRACE) -G -C \
+ -I$(top_srcdir)/dix/ -I$(top_builddir)/dix/ \
+ -o $@ \
+ -s $(top_srcdir)/dix/Xserver.d \
+ $(top_builddir)/dix/.libs/*.o
+
+endif SPECIAL_DTRACE_OBJECTS
diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index 38d6ac409e76..9160f4801613 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -75,13 +75,13 @@ Xdmx_SOURCES = dmx.c \
XDMX_LIBS = \
$(GLX_LIBS) \
@XDMX_LIBS@ \
+ $(DTRACE_LIB) \
input/libdmxinput.a \
config/libdmxconfig.a
Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
Xdmx_DEPENDENCIES= $(XDMX_LIBS)
-Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS) \
- $(top_builddir)/render/librender.la
+Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS) $(DTRACE_SYS_LIBS)
relink:
$(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT)
diff --git a/hw/xnest/Makefile.am b/hw/xnest/Makefile.am
index eb550c0f7d67..6ee12e63c75a 100644
--- a/hw/xnest/Makefile.am
+++ b/hw/xnest/Makefile.am
@@ -45,6 +45,7 @@ SRCS = Args.c \
XNEST_LIBS = \
@XNEST_LIBS@ \
+ $(DTRACE_LIB) \
$(top_builddir)/Xext/libXextdpmsstubs.la \
$(top_builddir)/Xi/libXistubs.la
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index a3c9fce48226..15b1242338ae 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -25,6 +25,7 @@ Xwayland_SOURCES = \
Xwayland_LDADD = \
$(glamor_lib) \
$(XWAYLAND_LIBS) \
+ $(DTRACE_LIB) \
$(XWAYLAND_SYS_LIBS) \
$(top_builddir)/Xext/libXvidmode.la \
$(XSERVER_SYS_LIBS)
diff --git a/os/Makefile.am b/os/Makefile.am
index c6e78cb99fd5..ed660bff45f2 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -55,15 +55,3 @@ libos_la_SOURCES += $(BUSFAULT_SRCS)
endif
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 libos.la
- $(AM_V_GEN)$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o ../dix/.libs/*.o
-
-noinst_PROGRAMS = os.O
-
-os_O_SOURCES =
-os.O: dtrace.o libos.la
- $(AM_V_GEN)ld -r -o $@ dtrace.o .libs/*.o
-endif
diff --git a/test/Makefile.am b/test/Makefile.am
index e7fe587bb858..fb61d614bf10 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -140,11 +140,8 @@ tests_LDADD += \
$(top_builddir)/hw/xfree86/i2c/libi2c.la \
$(top_builddir)/hw/xfree86/dixmods/libxorgxkb.la \
$(top_builddir)/Xext/libXvidmode.la \
- @XORG_LIBS@
-
-if !SPECIAL_DTRACE_OBJECTS
-tests_LDADD += $(top_builddir)/os/libos.la
-endif
+ $(XORG_LIBS) \
+ $(top_builddir)/os/libos.la
BUILT_SOURCES = sdksyms.c
CLEANFILES += sdksyms.c
--
2.9.2
More information about the xorg-devel
mailing list