[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2] tools: link executables with libtinfo explicitly



binutils 2.22 changed ld default from --copy-dt-needed-entries
to -no-copy-dt-needed-entries. This revealed that some objects
are linked implicitly with libtinfo and newer ld fails to build
relevant executables.

Below is short explanation why we should not do that...

http://fedoraproject.org/wiki/UnderstandingDSOLinkChange says:

The default behaviour for ld (my note: before version 2.22) allows
users to 'indirectly' link to required objects/libraries through
intermediate objects/libraries. While this is convenient, it can
also be dangerous because it makes your program's dependencies tied
to the dependencies of other objects. If those objects ever change
their linkages, they can break your program without any changes
to your own code!

Please run autoconf in tools directory.

Signed-off-by: Daniel Kiper <daniel.kiper@xxxxxxxxxx>
---
v2 - suggestions/fixes:
   - do not include tools/configure changes in this patch
     (suggested by Wei Liu).
---
 config/Tools.mk.in            |    1 +
 tools/configure.ac            |    4 ++++
 tools/misc/Makefile           |    2 +-
 tools/xenstat/xentop/Makefile |    2 +-
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index d67352e..aef9ed6 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -77,5 +77,6 @@ CONFIG_LIBICONV     := @libiconv@
 CONFIG_GCRYPT       := @libgcrypt@
 EXTFS_LIBS          := @EXTFS_LIBS@
 CURSES_LIBS         := @CURSES_LIBS@
+TINFO_LIBS          := @TINFO_LIBS@
 
 FILE_OFFSET_BITS    := @FILE_OFFSET_BITS@
diff --git a/tools/configure.ac b/tools/configure.ac
index 9bf6450..1a06ddf 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -318,6 +318,10 @@ i[[3456]]86|x86_64)
 esac
  AX_CHECK_UUID
  AX_CHECK_CURSES
+AS_IF([test "$ncurses" = "y"], [
+AC_CHECK_LIB([tinfo], [define_key], [TINFO_LIBS=-ltinfo])
+])
+AC_SUBST(TINFO_LIBS)
 
 dnl The following are only required when upstream QEMU is built
 AS_IF([test "x$qemu_xen" = "xy"], [
diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 3817317..82c361f 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -100,7 +100,7 @@ xen-lowmemd: xen-lowmemd.o
        $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenstore) 
$(APPEND_LDFLAGS)
 
 gtraceview: gtraceview.o
-       $(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) $(APPEND_LDFLAGS)
+       $(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) $(TINFO_LIBS) $(APPEND_LDFLAGS)
 
 xencov: xencov.o
        $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
diff --git a/tools/xenstat/xentop/Makefile b/tools/xenstat/xentop/Makefile
index 2652c9d..97950b9 100644
--- a/tools/xenstat/xentop/Makefile
+++ b/tools/xenstat/xentop/Makefile
@@ -19,7 +19,7 @@ all install xentop:
 else
 
 CFLAGS += -DGCC_PRINTF -Werror $(CFLAGS_libxenstat)
-LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(SOCKET_LIBS) -lm -lyajl
+LDLIBS += $(LDLIBS_libxenstat) $(CURSES_LIBS) $(TINFO_LIBS) $(SOCKET_LIBS) -lm 
-lyajl
 CFLAGS += -DHOST_$(XEN_OS)
 
 # Include configure output (config.h) to headers search path
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.