diff options
author | Matthias Andree <mandree@FreeBSD.org> | 2020-02-03 00:34:15 +0000 |
---|---|---|
committer | Matthias Andree <mandree@FreeBSD.org> | 2020-02-03 00:34:15 +0000 |
commit | 0346c473f7a3a3fbff70ab193f918b9482de4578 (patch) | |
tree | d70d7236806b4a488080ac5e82ea35723c4d7256 /sysutils | |
parent | 16346633699159dc0f78fc4c13080c4923183543 (diff) |
Be more careful about what and how we link.
Only link what we need (--as-needed) to get unnecessary dependencies
out of the executables.
Be sure to properly link libc dynamically and the rest statically,
especially libgcc (-static-libgcc, should fix powerpc* builds => [1])
After two years, drop the "for now" LLD_UNSAFE=yes (r457508 by emaste@).
As e2fsprogs dlopen()s libmagic these days, our LIBMAGIC override is
useless. Instead patch libmagic.so.1 -> libmagic.so (12.1 calls it
libmagic.so.4; patch to lib/support/plausible.c).
Refresh files/patch-misc__Makefile.in
PR: 242798 [1]
Notes
Notes:
svn path=/head/; revision=525006
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/e2fsprogs/Makefile | 15 | ||||
-rw-r--r-- | sysutils/e2fsprogs/files/patch-lib_support_plausible.c | 11 | ||||
-rw-r--r-- | sysutils/e2fsprogs/files/patch-misc__Makefile.in | 6 |
3 files changed, 22 insertions, 10 deletions
diff --git a/sysutils/e2fsprogs/Makefile b/sysutils/e2fsprogs/Makefile index 5b28107adadb..6f85bc76fa02 100644 --- a/sysutils/e2fsprogs/Makefile +++ b/sysutils/e2fsprogs/Makefile @@ -3,7 +3,7 @@ PORTNAME= e2fsprogs PORTVERSION= 1.45.5 -PORTREVISION?= 2 +PORTREVISION?= 3 CATEGORIES?= sysutils MASTER_SITES= KERNEL_ORG/linux/kernel/people/tytso/${PORTNAME}/v${PORTVERSION} @@ -28,7 +28,6 @@ USE_CSTD= gnu99 USE_LDCONFIG= ${PREFIX}/lib/e2fsprogs .endif GNU_CONFIGURE= yes -LLD_UNSAFE= yes # while we use the system blkid, we need to --enable-libblkid # so that the tools get built: @@ -43,7 +42,7 @@ CONFIGURE_ARGS?=--disable-fsck \ --with-root-prefix='${PREFIX}' \ --without-included-gettext \ LDFLAGS='${LDFLAGS} -L${LOCALBASE}/lib -Wl,--rpath -Wl,${LOCALBASE}/lib/e2fsprogs' -CONFIGURE_ENV?= LIBS='${LIBS} -lexecinfo -lelf' +CONFIGURE_ENV?= LIBS='-Wl,--as-needed ${LIBS} -lexecinfo -lelf' CPPFLAGS+= -I${WRKSRC}/lib -I${LOCALBASE}/include # -D_EXT2_USE_C_VERSIONS MAKE_ARGS+= pkgconfigdir='${PREFIX}/libdata/pkgconfig' MAKE_ENV+= CHECK_CMD=@true @@ -79,7 +78,7 @@ LIB_DEPENDS+= libss.so:devel/e2fsprogs-libss LIB_DEPENDS+= libuuid.so:misc/e2fsprogs-libuuid LIBUNWIND_LIB_DEPENDS= libunwind.so:devel/libunwind -LIBUNWIND_LIBS+= -lunwind +LIBUNWIND_LIBS+= -L${LOCALBASE}/lib -lunwind LIBUNWIND_LDFLAGS+= -rdynamic LIBUNWIND_EXTRA_PATCHES=${FILESDIR}/extrapatch-e2fsck_sigcatcher.c @@ -247,12 +246,14 @@ post-build: # system are statically linked against anything that is outside the root fs, # else we're in trouble if e2fsck is needed for boot: # (we don't use e2fsck.static, since we can link libc.so dynamically) +# NOTE: we need to link libgcc statically, it might be under /usr/local! +# => do not add a -Bdynamic - but instead list the dynamic libraries +# before the -Bstatic cd ${WRKSRC}/e2fsck && ${RM} -f e2fsck \ && ${MAKE_CMD} e2fsck V=1 \ - LIBS="../lib/libsupport.a ../lib/libext2fs.a ../lib/libcom_err.a \ + LIBS="-static-libgcc -lc -Bstatic ../lib/libsupport.a ../lib/libext2fs.a ../lib/libcom_err.a \ ${_staticlibs} /usr/lib/libexecinfo.a /usr/lib/libelf.a \ - ${LOCALBASE}/lib/libblkid.a ${LOCALBASE}/lib/libuuid.a ${libintl} ../lib/libe2p.a" \ - LIBMAGIC=/usr/lib/libmagic.a\ -lz + ${LOCALBASE}/lib/libblkid.a ${LOCALBASE}/lib/libuuid.a ${libintl} ../lib/libe2p.a " # Regression check: avoid a port (not upstream!) regression from 1.40.5, # check that e2fsck isn't dynalinked against anything but libc.so: @${ECHO_CMD} -n "===> checking that e2fsck depends on no shared objects outside /lib: " diff --git a/sysutils/e2fsprogs/files/patch-lib_support_plausible.c b/sysutils/e2fsprogs/files/patch-lib_support_plausible.c new file mode 100644 index 000000000000..3d23b30e9c8f --- /dev/null +++ b/sysutils/e2fsprogs/files/patch-lib_support_plausible.c @@ -0,0 +1,11 @@ +--- lib/support/plausible.c.orig 2020-01-06 23:10:17 UTC ++++ lib/support/plausible.c +@@ -62,7 +62,7 @@ static void *magic_handle; + static int magic_library_available(void) + { + if (!magic_handle) { +- magic_handle = dlopen("libmagic.so.1", RTLD_NOW); ++ magic_handle = dlopen("libmagic.so", RTLD_NOW); + if (!magic_handle) + return 0; + diff --git a/sysutils/e2fsprogs/files/patch-misc__Makefile.in b/sysutils/e2fsprogs/files/patch-misc__Makefile.in index b16f591e4923..29c990ccd84a 100644 --- a/sysutils/e2fsprogs/files/patch-misc__Makefile.in +++ b/sysutils/e2fsprogs/files/patch-misc__Makefile.in @@ -1,4 +1,4 @@ ---- misc/Makefile.in.orig 2019-07-15 01:03:14 UTC +--- misc/Makefile.in.orig 2020-01-06 23:10:17 UTC +++ misc/Makefile.in @@ -34,17 +34,17 @@ INSTALL = @INSTALL@ @@ -23,7 +23,7 @@ UMANPAGES+= @FUSE_CMT@ fuse2fs.1 LPROGS= @E2INITRD_PROG@ -@@ -146,14 +146,14 @@ profiled: +@@ -147,14 +147,14 @@ profiled: mke2fs.conf: $(srcdir)/mke2fs.conf.in if test -f $(srcdir)/mke2fs.conf.custom.in ; then \ @@ -41,7 +41,7 @@ > default_profile.c findsuper: findsuper.o $(E) " LD $@" -@@ -600,34 +600,9 @@ install: all $(SMANPAGES) $(UMANPAGES) installdirs +@@ -605,34 +605,9 @@ install: all $(SMANPAGES) $(UMANPAGES) installdirs (cd $(DESTDIR)$(man5dir); \ $(LN) $(LINK_INSTALL_FLAGS) ext4.5 $$i.5); \ done |