From 31fc19399e597e3391f19f1392ab120f1de0d5f2 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Thu, 26 Sep 2013 13:42:41 -0400 Subject: Generate libraries with correct DT_NEEDED entries Libraries that depend on other libraries should list them in ELF's DT_NEEDED field so that programs linking to them do not need to specify those libraries unless they depend on them as well. This is not the case in the current code and the consequence is that anything that needs a library must know its dependencies. This is fragile and caused GRUB2's configure script to break when a dependency was added on libblkid in libzfs. This resolves that problem by using LIBADD/LDADD to specify libraries in Makefile.am instead of LDFLAGS. This ensures that proper DT_NEEDED entries are generated and prevents GRUB2's configure script from breaking in the presence of a libblkid dependency. This also removes unneeded dependencies from various files. Signed-off-by: Richard Yao Signed-off-by: Brian Behlendorf Issue #1751 --- lib/libzfs/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libzfs') diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index 14abd7ab3..75f1775a2 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -27,4 +27,5 @@ libzfs_la_LIBADD = \ $(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libzpool/libzpool.la -libzfs_la_LDFLAGS = -lm -ldl -version-info 1:1:0 $(LIBSELINUX) +libzfs_la_LIBADD += -lm -ldl $(LIBBLKID) +libzfs_la_LDFLAGS = -version-info 1:1:0 -- cgit v1.2.3