[PATCH v2 xserver] os,dix: apply libs relocation unconditionally

Mihail Konev k.mvc at ya.ru
Sun Apr 2 07:33:19 UTC 2017


When building with DTrace compiler enabled, "ld -r" is applied to the
entire os/ and dix/, making their symbols visible from everywhere on
linker command line.  This alters the build:
- 3f8c2f94483bf0b96e129c97ef4950170a3f05b4 was only necessary without dtrace.
- 3ef16dfb9830bd6b41ae428f4f213ae0c35c1056 fixed the with-dtrace, but broke
  the without-dtrace dmx build.

The purpose of "-r" is to satisfy linker on Solaris that needs DTrace
objects to be put into a Relocatable Object.

Use the flag for non-DTrace build too.

v2: Also change noinst_PROGRAMS -> all-local to prevent revealed automake warning:

  os/Makefile.am:70: warning: deprecated feature: target 'os.O' overrides 'os.O$(EXEEXT)'
  os/Makefile.am:70: change your target to read 'os.O$(EXEEXT)'
  /usr/share/automake-1.15/am/program.am: target 'os.O$(EXEEXT)' was defined here
  os/Makefile.am:2:   while processing program 'os.O'

    Rebase upon fde5cd78 ("tests: Fix guards for ld -wrap") to be safe (no change).
    Reword.

Fixes "./configure --enable-dmx --with-dtrace=no" build.

Reported-by: Byeong-ryeol Kim <brofkims at gmail.com>

Fixes: 3ef16dfb ("dmx: fix linking")
Fixes: 49a26681 ("Add DTrace probe points")
Signed-off-by: Mihail Konev <k.mvc at ya.ru>
---
 configure.ac    |  9 ++-------
 dix/Makefile.am | 11 ++++++-----
 os/Makefile.am  | 13 +++++++------
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3bc15a81a263..f583a4b2f7d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1577,13 +1577,8 @@ 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) $(LIBUNWIND_LIBS)'
-else
-  DIX_LIB='$(top_builddir)/dix/libdix.la'
-  OS_LIB='$(top_builddir)/os/libos.la'
-fi
+DIX_LIB='$(top_builddir)/dix/dix.O'
+OS_LIB='$(top_builddir)/os/os.O $(SHA1_LIBS) $(DLOPEN_LIBS) $(LIBUNWIND_LIBS)'
 AC_SUBST([DIX_LIB])
 AC_SUBST([OS_LIB])
 
diff --git a/dix/Makefile.am b/dix/Makefile.am
index a4171d7e1f12..2e6de79b9f7f 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -1,4 +1,5 @@
 noinst_LTLIBRARIES = libdix.la libmain.la
+all-local: dix.O
 
 AM_CPPFLAGS = -I$(top_srcdir)/include
 AM_CFLAGS = $(DIX_CFLAGS)
@@ -59,16 +60,16 @@ Xserver-dtrace.h: $(srcdir)/Xserver.d
 
 endif
 
+DTRACE_OBJS =
 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)
+DTRACE_OBJS += dtrace-dix.o
+endif
 
-noinst_PROGRAMS = dix.O
-
-dix_O_SOURCES =
-dix.O: dtrace-dix.o libdix.la
+# "ld -r" is required for Solaris
+dix.O: $(DTRACE_OBJS) libdix.la
 	$(AM_V_GEN)ld -r -o $@ $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
-endif
 
 CLEANFILES = Xserver-dtrace.h
diff --git a/os/Makefile.am b/os/Makefile.am
index c6e78cb99fd5..9e5c7d696016 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -1,4 +1,5 @@
 noinst_LTLIBRARIES = libos.la
+all-local: os.O
 
 AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS)
 
@@ -56,14 +57,14 @@ endif
 
 EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)
 
+DTRACE_OBJS =
 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
+DTRACE_OBJS += dtrace.o
 endif
+
+# "ld -r" is required for Solaris
+os.O: $(DTRACE_OBJS) libos.la
+	$(AM_V_GEN)ld -r -o $@ $(DTRACE_OBJS) .libs/*.o
-- 
2.9.2



More information about the xorg-devel mailing list