* [PATCH v2] tools: link executables with libtinfo explicitly
@ 2015-06-02 13:33 Daniel Kiper
  2015-06-02 16:58 ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kiper @ 2015-06-02 13:33 UTC (permalink / raw)
  To: xen-devel; +Cc: wei.liu2, ian.jackson, ian.campbell, stefano.stabellini
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@oracle.com>
---
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
^ permalink raw reply related	[flat|nested] 4+ messages in thread* Re: [PATCH v2] tools: link executables with libtinfo explicitly
  2015-06-02 13:33 [PATCH v2] tools: link executables with libtinfo explicitly Daniel Kiper
@ 2015-06-02 16:58 ` Wei Liu
  2015-06-03 10:35   ` Ian Campbell
  0 siblings, 1 reply; 4+ messages in thread
From: Wei Liu @ 2015-06-02 16:58 UTC (permalink / raw)
  To: Daniel Kiper
  Cc: xen-devel, wei.liu2, ian.jackson, ian.campbell,
	stefano.stabellini
On Tue, Jun 02, 2015 at 03:33:26PM +0200, Daniel Kiper wrote:
> 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@oracle.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [PATCH v2] tools: link executables with libtinfo explicitly
  2015-06-02 16:58 ` Wei Liu
@ 2015-06-03 10:35   ` Ian Campbell
  2015-06-03 11:08     ` Daniel Kiper
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2015-06-03 10:35 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel, Daniel Kiper, ian.jackson, stefano.stabellini
On Tue, 2015-06-02 at 17:58 +0100, Wei Liu wrote:
> On Tue, Jun 02, 2015 at 03:33:26PM +0200, Daniel Kiper wrote:
> > 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.
For future reference "relevant executables" would be better as a list of
the actual affected programs...
> > 
> > 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@oracle.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>
Applied, running autoconf.
Ian.
^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: [PATCH v2] tools: link executables with libtinfo explicitly
  2015-06-03 10:35   ` Ian Campbell
@ 2015-06-03 11:08     ` Daniel Kiper
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Kiper @ 2015-06-03 11:08 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel, Wei Liu, ian.jackson, stefano.stabellini
On Wed, Jun 03, 2015 at 11:35:50AM +0100, Ian Campbell wrote:
> On Tue, 2015-06-02 at 17:58 +0100, Wei Liu wrote:
> > On Tue, Jun 02, 2015 at 03:33:26PM +0200, Daniel Kiper wrote:
> > > 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.
>
> For future reference "relevant executables" would be better as a list of
> the actual affected programs...
Wilco.
> > > 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@oracle.com>
> >
> > Acked-by: Wei Liu <wei.liu2@citrix.com>
>
> Applied, running autoconf.
Thanks!
Daniel
^ permalink raw reply	[flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-03 11:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 13:33 [PATCH v2] tools: link executables with libtinfo explicitly Daniel Kiper
2015-06-02 16:58 ` Wei Liu
2015-06-03 10:35   ` Ian Campbell
2015-06-03 11:08     ` Daniel Kiper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).