From owner-svn-ports-all@freebsd.org Mon Feb 3 00:34:16 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C811123ECF0; Mon, 3 Feb 2020 00:34:16 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 489pjh4wk3z3MfN; Mon, 3 Feb 2020 00:34:16 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A43602056F; Mon, 3 Feb 2020 00:34:16 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0130YGms082153; Mon, 3 Feb 2020 00:34:16 GMT (envelope-from mandree@FreeBSD.org) Received: (from mandree@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0130YGLX082150; Mon, 3 Feb 2020 00:34:16 GMT (envelope-from mandree@FreeBSD.org) Message-Id: <202002030034.0130YGLX082150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mandree set sender to mandree@FreeBSD.org using -f From: Matthias Andree Date: Mon, 3 Feb 2020 00:34:16 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r525006 - in head/sysutils/e2fsprogs: . files X-SVN-Group: ports-head X-SVN-Commit-Author: mandree X-SVN-Commit-Paths: in head/sysutils/e2fsprogs: . files X-SVN-Commit-Revision: 525006 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Feb 2020 00:34:16 -0000 Author: mandree Date: Mon Feb 3 00:34:15 2020 New Revision: 525006 URL: https://svnweb.freebsd.org/changeset/ports/525006 Log: 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] Added: head/sysutils/e2fsprogs/files/patch-lib_support_plausible.c (contents, props changed) Modified: head/sysutils/e2fsprogs/Makefile head/sysutils/e2fsprogs/files/patch-misc__Makefile.in Modified: head/sysutils/e2fsprogs/Makefile ============================================================================== --- head/sysutils/e2fsprogs/Makefile Sun Feb 2 21:43:40 2020 (r525005) +++ head/sysutils/e2fsprogs/Makefile Mon Feb 3 00:34:15 2020 (r525006) @@ -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: " Added: head/sysutils/e2fsprogs/files/patch-lib_support_plausible.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/e2fsprogs/files/patch-lib_support_plausible.c Mon Feb 3 00:34:15 2020 (r525006) @@ -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; + Modified: head/sysutils/e2fsprogs/files/patch-misc__Makefile.in ============================================================================== --- head/sysutils/e2fsprogs/files/patch-misc__Makefile.in Sun Feb 2 21:43:40 2020 (r525005) +++ head/sysutils/e2fsprogs/files/patch-misc__Makefile.in Mon Feb 3 00:34:15 2020 (r525006) @@ -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