]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Put ELF_OTHER_LIBS in the right place for the linker
authorTheodore Ts'o <tytso@mit.edu>
Sat, 4 Aug 2012 20:56:55 +0000 (16:56 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 6 Aug 2012 16:30:49 +0000 (12:30 -0400)
Commit a7c17431b9 attempted to fix a problem where the system
libraries might get used instead of local libraries for things like
-lcom_err.  It tried to accomplish this by moving $(ELF_OTHER_LIBS) to
before $(LDFLAGS).

Unfortunately, this was the wrong fix; $(ELF_OTHER_LIBS) *MUST* be
after the object files, or the linker might not pull in the necessary
library and not include it into the DT_NEEDED section of the shared
library.  The proper fix is to add a -L$(LIB) before $(LDFLAGS), and
then remove the -L option from all of the ELF_OTHER_LIBS definitions
in the library Makefiles.

Addresses-Sourceforge-Bug: #3554345

Cc: Olivier Blin <olivier.blin@softathome.com>
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/Makefile.elf-lib
lib/Makefile.solaris-lib
lib/blkid/Makefile.in
lib/ext2fs/Makefile.in
lib/quota/Makefile.in
lib/ss/Makefile.in

index c66281c8044d9ea62758201df35a5245bfa1eed2..78479d31a5bdde44abee9fd249272d50165993cd 100644 (file)
@@ -24,8 +24,9 @@ image:                $(ELF_LIB)
 
 $(ELF_LIB): $(OBJS)
        $(E) "  GEN_ELF_SOLIB $(ELF_LIB)"
-       $(Q) (cd elfshared; $(CC) --shared -o $(ELF_LIB) $(ELF_OTHER_LIBS) \
-               $(LDFLAGS) -Wl,-soname,$(ELF_SONAME) $(OBJS))
+       $(Q) (cd elfshared; $(CC) --shared -o $(ELF_LIB) \
+               -L$(top_builddir)/../lib $(LDFLAGS) \
+               -Wl,-soname,$(ELF_SONAME) $(OBJS) $(ELF_OTHER_LIBS))
        $(Q) $(MV) elfshared/$(ELF_LIB) .
        $(Q) $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME)
        $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) \
index 66f2b4c883454774bc6390a7ff9e7bc5d3fac397..5990be8a49db05733e0cf0c2fad101c951cec4ff 100644 (file)
@@ -24,8 +24,9 @@ image:                $(ELF_LIB)
 
 $(ELF_LIB): $(OBJS)
        $(E) "  GEN_ELF_SOLIB $(ELF_LIB)"
-       $(Q) (cd elfshared; $(CC) --shared -o $(ELF_LIB) $(ELF_OTHER_LIBS) \
-               $(LDFLAGS) -Wl,-h,$(ELF_SONAME) $(OBJS))
+       $(Q) (cd elfshared; $(CC) --shared -o $(ELF_LIB) \
+               -L$(top_builddir)/../lib $(LDFLAGS) \
+               -Wl,-h,$(ELF_SONAME) $(OBJS) $(ELF_OTHER_LIBS))
        $(Q) $(MV) elfshared/$(ELF_LIB) .
        $(Q) $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).so ../$(ELF_SONAME)
        $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) \
index f23a1376bde3f50f9f1c37467f845c9c098e3a20..0ec8564c9816061f3836c402dce3c60c0afcd565 100644 (file)
@@ -36,7 +36,7 @@ ELF_SO_VERSION = 1
 ELF_IMAGE = libblkid
 ELF_MYDIR = blkid
 ELF_INSTALL_DIR = $(root_libdir)
-ELF_OTHER_LIBS = -L../.. -luuid
+ELF_OTHER_LIBS = -luuid
 
 BSDLIB_VERSION = 2.0
 BSDLIB_IMAGE = libblkid
index 0d9ac2194f4789c524ebbda9c5145f31ecccb969..fc196fb7a4ac39d0af1d5d172db40f5aa70cc669 100644 (file)
@@ -180,7 +180,7 @@ ELF_SO_VERSION = 2
 ELF_IMAGE = libext2fs
 ELF_MYDIR = ext2fs
 ELF_INSTALL_DIR = $(root_libdir)
-ELF_OTHER_LIBS = -L../.. -lcom_err
+ELF_OTHER_LIBS = -lcom_err
 
 BSDLIB_VERSION = 2.1
 BSDLIB_IMAGE = libext2fs
index 2851eac7dd9747e96aa27c45f518b70d813bb95b..720befd98417813e63607393fc4cb030b06ef379 100644 (file)
@@ -31,7 +31,7 @@ LIBDIR= quota
 #ELF_IMAGE = libquota
 #ELF_MYDIR = quota
 #ELF_INSTALL_DIR = $(root_libdir)
-#ELF_OTHER_LIBS = -L../.. -lext2fs
+#ELF_OTHER_LIBS = -lext2fs
 
 #BSDLIB_VERSION = 1.0
 #BSDLIB_IMAGE = libquota
index 19413cc21df0e756d128a220e9364a7e7a95834b..c396f2deb8d9f73c441bb93e5d9c27bd606880c9 100644 (file)
@@ -20,7 +20,7 @@ ELF_SO_VERSION = 2
 ELF_IMAGE = libss
 ELF_MYDIR = ss
 ELF_INSTALL_DIR = $(root_libdir)
-ELF_OTHER_LIBS = -L../.. -lcom_err $(DLOPEN_LIB)
+ELF_OTHER_LIBS = -lcom_err $(DLOPEN_LIB)
 
 BSDLIB_VERSION = 1.0
 BSDLIB_IMAGE = libss