Patchwork [2/2] build: fix gcc linker library argument placement

login
register
mail settings
Submitter David Disseldorp
Date June 25, 2013, 5:11 p.m.
Message ID <1372180305-24852-2-git-send-email-ddiss@suse.de>
Download mbox | patch
Permalink /patch/254252/
State Accepted
Headers show

Comments

David Disseldorp - June 25, 2013, 5:11 p.m.
The build currently fails on gcc 4.7.3 based openSUSE systems due to the
placement of library arguments while linking, and the use of the
--as-needed binutils feature.

As described by http://www.gentoo.org/proj/en/qa/asneeded.xml:
For symbols missing in a given file (either an object file, a static
archive or a library), the linker checks only in the files coming after
it.
Without --as-needed, files are linked together without considering
ordering. But with the flag, the libraries that aren't used for
resolving symbols are discarded and thus not linked.

Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 src/fedfsc/Makefile.am     | 10 +++++-----
 src/fedfsd/Makefile.am     | 10 +++++-----
 src/mount/Makefile.am      |  8 ++++----
 src/nfsref/Makefile.am     | 10 +++++-----
 src/nsdbc/Makefile.am      | 10 +++++-----
 src/nsdbparams/Makefile.am | 10 +++++-----
 6 files changed, 29 insertions(+), 29 deletions(-)

Patch

diff --git a/src/fedfsc/Makefile.am b/src/fedfsc/Makefile.am
index a12cf19..716472e 100644
--- a/src/fedfsc/Makefile.am
+++ b/src/fedfsc/Makefile.am
@@ -30,13 +30,13 @@  sbin_PROGRAMS		= fedfs-null \
 			  fedfs-lookup-junction \
 			  fedfs-create-replication fedfs-delete-replication \
 			  fedfs-lookup-replication
-LDADD			= $(LIBTIRPC) $(LIBLDAP) $(LIBLBER) $(LIBXML2) \
-			  $(LIBSQLITE3) $(LIBIDN) $(LIBUUID) \
-			  $(LIBCRYPTO) $(LIBSSL) \
-			  $(top_builddir)/src/libadmin/libadmin.la \
+LDADD			= $(top_builddir)/src/libadmin/libadmin.la \
 			  $(top_builddir)/src/libjunction/libjunction.la \
 			  $(top_builddir)/src/libnsdb/libnsdb.la \
-			  $(top_builddir)/src/libxlog/libxlog.la
+			  $(top_builddir)/src/libxlog/libxlog.la \
+			  $(LIBTIRPC) $(LIBLDAP) $(LIBLBER) $(LIBXML2) \
+			  $(LIBSQLITE3) $(LIBIDN) $(LIBUUID) \
+			  $(LIBCRYPTO) $(LIBSSL)
 
 CLEANFILES		= cscope.in.out cscope.out cscope.po.out *~
 DISTCLEANFILES		= Makefile.in
diff --git a/src/fedfsd/Makefile.am b/src/fedfsd/Makefile.am
index 0705a3b..f3b3ca6 100644
--- a/src/fedfsd/Makefile.am
+++ b/src/fedfsd/Makefile.am
@@ -27,13 +27,13 @@  noinst_HEADERS		= fedfsd.h
 RPCPREFIX		= rpc.
 sbin_PROGRAMS		= fedfsd
 fedfsd_SOURCES		= listen.c main.c privilege.c svc.c
-fedfsd_LDADD		= $(LIBTIRPC) $(LIBLDAP) $(LIBLBER) $(LIBXML2) \
-			  $(LIBSQLITE3) $(LIBIDN) $(LIBUUID) $(LIBCAP) \
-			  $(LIBURIPARSER) $(LIBCRYPTO) $(LIBSSL) \
-			  $(top_builddir)/src/libadmin/libadmin.la \
+fedfsd_LDADD		= $(top_builddir)/src/libadmin/libadmin.la \
 			  $(top_builddir)/src/libnsdb/libnsdb.la \
 			  $(top_builddir)/src/libjunction/libjunction.la \
-			  $(top_builddir)/src/libxlog/libxlog.la
+			  $(top_builddir)/src/libxlog/libxlog.la \
+			  $(LIBTIRPC) $(LIBLDAP) $(LIBLBER) $(LIBXML2) \
+			  $(LIBSQLITE3) $(LIBIDN) $(LIBUUID) $(LIBCAP) \
+			  $(LIBURIPARSER) $(LIBCRYPTO) $(LIBSSL)
 
 CLEANFILES		= cscope.in.out cscope.out cscope.po.out *~
 DISTCLEANFILES		= Makefile.in
diff --git a/src/mount/Makefile.am b/src/mount/Makefile.am
index 7b00b4a..e09c06d 100644
--- a/src/mount/Makefile.am
+++ b/src/mount/Makefile.am
@@ -27,12 +27,12 @@  noinst_HEADERS		= nls.h
 root_sbin_PROGRAMS	= mount.fedfs
 sbin_PROGRAMS		= fedfs-map-nfs4
 fedfs_map_nfs4_SOURCES	= fedfs-map-nfs4.c
-fedfs_map_nfs4_LDADD	= $(LIBRESOLV) \
-			  $(top_builddir)/src/libsi/libsi.la
+fedfs_map_nfs4_LDADD	= $(top_builddir)/src/libsi/libsi.la \
+			  $(LIBRESOLV)
 mount_fedfs_SOURCES	= main.c
 # mount.fedfs must never link against libraries in /usr
-mount_fedfs_LDADD	= $(LIBRESOLV) \
-			  $(top_builddir)/src/libsi/libsi.la
+mount_fedfs_LDADD	= $(top_builddir)/src/libsi/libsi.la \
+			  $(LIBRESOLV)
 
 CLEANFILES		= cscope.in.out cscope.out cscope.po.out *~
 DISTCLEANFILES		= Makefile.in
diff --git a/src/nfsref/Makefile.am b/src/nfsref/Makefile.am
index 411ad15..995768d 100644
--- a/src/nfsref/Makefile.am
+++ b/src/nfsref/Makefile.am
@@ -26,12 +26,12 @@ 
 noinst_HEADERS		= nfsref.h
 sbin_PROGRAMS		= nfsref
 nfsref_SOURCES		= add.c lookup.c nfsref.c remove.c
-LDADD			= $(LIBLDAP) $(LIBLBER) $(LIBXML2) \
-			  $(LIBSQLITE3) $(LIBIDN) $(LIBUUID) \
-			  $(LIBURIPARSER) $(LIBCRYPTO) $(LIBSSL) \
-			  $(top_builddir)/src/libnsdb/libnsdb.la \
+LDADD			= $(top_builddir)/src/libnsdb/libnsdb.la \
 			  $(top_builddir)/src/libxlog/libxlog.la \
-			  $(top_builddir)/src/libjunction/libjunction.la
+			  $(top_builddir)/src/libjunction/libjunction.la \
+			  $(LIBLDAP) $(LIBLBER) $(LIBXML2) \
+			  $(LIBSQLITE3) $(LIBIDN) $(LIBUUID) \
+			  $(LIBURIPARSER) $(LIBCRYPTO) $(LIBSSL)
 
 CLEANFILES		= cscope.in.out cscope.out cscope.po.out *~
 DISTCLEANFILES		= Makefile.in
diff --git a/src/nsdbc/Makefile.am b/src/nsdbc/Makefile.am
index b5fd5a9..f8499b5 100644
--- a/src/nsdbc/Makefile.am
+++ b/src/nsdbc/Makefile.am
@@ -28,12 +28,12 @@  sbin_PROGRAMS		= nsdb-annotate nsdb-describe nsdb-list \
 			  nsdb-delete-nsdb nsdb-simple-nce \
 			  nsdb-create-fsn nsdb-delete-fsn nsdb-resolve-fsn \
 			  nsdb-create-fsl nsdb-delete-fsl nsdb-update-fsl
-LDADD			= $(LIBLDAP) $(LIBLBER) $(LIBXML2) \
-			  $(LIBSQLITE3) $(LIBIDN) $(LIBUUID) \
-			  $(LIBURIPARSER) $(LIBCRYPTO) $(LIBSSL) \
-			  $(top_builddir)/src/libnsdb/libnsdb.la \
+LDADD			= $(top_builddir)/src/libnsdb/libnsdb.la \
 			  $(top_builddir)/src/libxlog/libxlog.la \
-			  $(top_builddir)/src/libjunction/libjunction.la
+			  $(top_builddir)/src/libjunction/libjunction.la \
+			  $(LIBLDAP) $(LIBLBER) $(LIBXML2) \
+			  $(LIBSQLITE3) $(LIBIDN) $(LIBUUID) \
+			  $(LIBURIPARSER) $(LIBCRYPTO) $(LIBSSL)
 
 CLEANFILES		= cscope.in.out cscope.out cscope.po.out *~
 DISTCLEANFILES		= Makefile.in
diff --git a/src/nsdbparams/Makefile.am b/src/nsdbparams/Makefile.am
index 14c8be3..73c7348 100644
--- a/src/nsdbparams/Makefile.am
+++ b/src/nsdbparams/Makefile.am
@@ -26,12 +26,12 @@ 
 noinst_HEADERS		= nsdbparams.h
 sbin_PROGRAMS		= nsdbparams
 nsdbparams_SOURCES	= delete.c list.c main.c show.c update.c
-LDADD			= $(LIBLDAP) $(LIBLBER) $(LIBXML2) \
-			  $(LIBSQLITE3) $(LIBIDN) $(LIBUUID) $(LIBCAP) \
-			  $(LIBURIPARSER) $(LIBCRYPTO) $(LIBSSL) \
-			  $(top_builddir)/src/libnsdb/libnsdb.la \
+LDADD			= $(top_builddir)/src/libnsdb/libnsdb.la \
 			  $(top_builddir)/src/libjunction/libjunction.la \
-			  $(top_builddir)/src/libxlog/libxlog.la
+			  $(top_builddir)/src/libxlog/libxlog.la \
+			  $(LIBLDAP) $(LIBLBER) $(LIBXML2) \
+			  $(LIBSQLITE3) $(LIBIDN) $(LIBUUID) $(LIBCAP) \
+			  $(LIBURIPARSER) $(LIBCRYPTO) $(LIBSSL)
 
 CLEANFILES		= cscope.in.out cscope.out cscope.po.out *~
 DISTCLEANFILES		= Makefile.in