tools: link executables with libtinfo explicitly
PATCH 1/1 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!
--- 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(-)
config/Tools.mk.in +1 -0
@@ -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@
tools/configure +46 -0
58 lines not on this page · raw message
tools/configure.ac +4 -0
@@ -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"], [
tools/misc/Makefile +1 -1
@@ -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)
tools/xenstat/xentop/Makefile +1 -1
@@ -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
Signature · 1 line
1.7.10.4
Quoted 17 lines · Daniel Kiper
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!
Quoted 4 lines
Signed-off-by Daniel Kiper <[email protected]>--- config/Tools.mk.in | 1 + tools/configure | 46 +++++++++++++++++++++++++++++++++++++++++
Since your autoconf version might be different from the one used by committers, it might be better you don't include the changes to configure in your patch and add a line to prompt committer to rerun autogen.sh.
Quoted 16 lines
tools/configure.ac | 4 ++++ tools/misc/Makefile | 2 +- tools/xenstat/xentop/Makefile | 2 +- 5 files changed, 53 insertions(+), 2 deletions(-)config/Tools.mk.in +1
-0@@ -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@
[...]
tools/configure.ac i[[3456]]86|x86_64) · line 322
Quoted 12 lines
tools/configure.ac +2
-0@@ -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])
"define_key"?
tools/configure.ac i[[3456]]86|x86_64) · line 325
Quoted 3 lines
tools/configure.ac +2
-0+]) +AC_SUBST(TINFO_LIBS)
This doesn't look right. Tinfo is needed by libxenstat. It should not depend on presence of curses library.
Wei.
Quoted 23 lines · Wei Liu
Quoted 17 lines · Daniel Kiper
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!
Quoted 4 lines
Signed-off-by Daniel Kiper <[email protected]>--- config/Tools.mk.in | 1 + tools/configure | 46 +++++++++++++++++++++++++++++++++++++++++
Quoted 4 lines
Since your autoconf version might be different from the one used by committers, it might be better you don't include the changes to configure in your patch and add a line to prompt committer to rerun
autogen.sh.
OK.
Quoted 19 lines
Quoted 16 lines
tools/configure.ac | 4 ++++ tools/misc/Makefile | 2 +- tools/xenstat/xentop/Makefile | 2 +- 5 files changed, 53 insertions(+), 2 deletions(-)config/Tools.mk.in +1
-0@@ -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@[...]
Quoted 2 lines
Quoted 12 lines
tools/configure.ac i[[3456]]86|x86_64) · line 322
Quoted 10 lines
tools/configure.ac +2
-0@@ -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])"
define_key"?
Why not? It is used by gtraceview. If you wish we could test for halfdelay() which is used by xentop.
Quoted 6 lines
tools/configure.ac i[[3456]]86|x86_64) · line 325
Quoted 3 lines
tools/configure.ac +2
-0+]) +AC_SUBST(TINFO_LIBS)This doesn't look right. Tinfo is needed by libxenstat. It should not depend on presence of curses library.
libtinfo is a part of ncurses.
Daniel
On Mon, Jun 01, 2015 at 03:26:58PM +0200, Daniel Kiper wrote:
[...]
Quoted 31 lines
Quoted 18 lines
Quoted 15 lines
tools/misc/Makefile | 2 +- tools/xenstat/xentop/Makefile | 2 +- 5 files changed, 53 insertions(+), 2 deletions(-)config/Tools.mk.in +1
-0@@ -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@[...]
Quoted 2 lines
Quoted 12 lines
tools/configure.ac i[[3456]]86|x86_64) · line 322
Quoted 10 lines
tools/configure.ac +2
-0@@ -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])"
define_key"?
Quoted 3 lines
Why not? It is used by gtraceview. If you wish we could test for
halfdelay()which is used by xentop.
Oh, I misread, sorry. Testing for define_key is fine.
Quoted 9 lines
Quoted 6 lines
tools/configure.ac i[[3456]]86|x86_64) · line 325
Quoted 3 lines
tools/configure.ac +2
-0+]) +AC_SUBST(TINFO_LIBS)This doesn't look right. Tinfo is needed by libxenstat. It should not depend on presence of curses library.
libtinfo is a part of ncurses.
Well, not part of in the sense of packaging. Just that ncurses depends on it. But I get your idea.
Wei.
Quoted 1 line
Daniel