|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] tools: link executables with libtinfo explicitly
commit b248d32f4fce6f5ea1d59228cc435b80c3b50351
Author: Daniel Kiper <daniel.kiper@xxxxxxxxxx>
AuthorDate: Tue Jun 2 15:33:26 2015 +0200
Commit: Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Wed Jun 3 11:12:03 2015 +0100
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!
Signed-off-by: Daniel Kiper <daniel.kiper@xxxxxxxxxx>
Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
config/Tools.mk.in | 1 +
tools/configure | 46 +++++++++++++++++++++++++++++++++++++++++
tools/configure.ac | 4 +++
tools/misc/Makefile | 2 +-
tools/xenstat/xentop/Makefile | 2 +-
5 files changed, 53 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 b/tools/configure
index 4c2928d..896d892 100755
--- a/tools/configure
+++ b/tools/configure
@@ -651,6 +651,7 @@ glib_CFLAGS
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
+TINFO_LIBS
CURSES_LIBS
PY_NOOPT_CFLAGS
EGREP
@@ -7678,6 +7679,51 @@ $as_echo "#define INCLUDE_CURSES_H <curses.h>"
>>confdefs.h
fi
+if test "$ncurses" = "y"; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for define_key in -ltinfo"
>&5
+$as_echo_n "checking for define_key in -ltinfo... " >&6; }
+if ${ac_cv_lib_tinfo_define_key+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltinfo $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char define_key ();
+int
+main ()
+{
+return define_key ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_tinfo_define_key=yes
+else
+ ac_cv_lib_tinfo_define_key=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_define_key"
>&5
+$as_echo "$ac_cv_lib_tinfo_define_key" >&6; }
+if test "x$ac_cv_lib_tinfo_define_key" = xyes; then :
+ TINFO_LIBS=-ltinfo
+fi
+
+
+fi
+
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
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |