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@oracle.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
Daniel Kiper authored and Ian Campbell committed 2015-06-03 11:12:03 +01:00
1 parent c81d06f209
commit b248d32f4f
5 files changed
+53 -2

No files matched your search

+1
View File
@@ -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@
+46
View File
@@ -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
+4
View File
@@ -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"], [
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.