Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Jan 2020 02:13:24 +0000 (UTC)
From:      Matthias Andree <mandree@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r524662 - in head/sysutils/e2fsprogs: . files
Message-ID:  <202001310213.00V2DOlR030203@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mandree
Date: Fri Jan 31 02:13:24 2020
New Revision: 524662
URL: https://svnweb.freebsd.org/changeset/ports/524662

Log:
  Try to fix powerpc build, add LIBUNWIND option.
  
  We've had a USES+=compiler:c11 on powerpc64,
  see <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231570>;
  extend and use it on all powerpc* in an attempt to fix PR 242798.
  
  If that doesn't help, add a LIBUNWIND option that makes e2fsck's
  signal catcher use libunwind instead of libexecinfo - FreeBSD's
  stack unwinder doesn't currently work from signal handlers (#243746),
  libunwind does and is supposed to work on powerpc and powerpc64,
  among others.
  
  PR:		242798
  Reported by:	canardo909@gmx.com

Added:
  head/sysutils/e2fsprogs/files/extrapatch-e2fsck_sigcatcher.c   (contents, props changed)
Modified:
  head/sysutils/e2fsprogs/Makefile

Modified: head/sysutils/e2fsprogs/Makefile
==============================================================================
--- head/sysutils/e2fsprogs/Makefile	Thu Jan 30 23:07:43 2020	(r524661)
+++ head/sysutils/e2fsprogs/Makefile	Fri Jan 31 02:13:24 2020	(r524662)
@@ -3,7 +3,7 @@
 
 PORTNAME=	e2fsprogs
 PORTVERSION=	1.45.5
-PORTREVISION?=	1
+PORTREVISION?=	2
 CATEGORIES?=	sysutils
 MASTER_SITES=	KERNEL_ORG/linux/kernel/people/tytso/${PORTNAME}/v${PORTVERSION}
 
@@ -51,7 +51,7 @@ MAKE_ENV+=	CHECK_CMD=@true
 .if !defined(MASTERDIR)
 INSTALL_TARGET=		install install-libs
 
-OPTIONS_DEFINE=		DOCS NLS FUSEFS PARALLELTESTS SLOWTESTS BASHTESTS
+OPTIONS_DEFINE=		DOCS NLS FUSEFS PARALLELTESTS SLOWTESTS BASHTESTS LIBUNWIND
 OPTIONS_EXCLUDE+=	EXAMPLES
 OPTIONS_SUB=		yes
 
@@ -66,6 +66,7 @@ ALLTESTS_DESC=	Run most self-tests (needs more RAM/dis
 PARALLELTESTS_DESC=	Parallelize self-tests (needs more disk space)
 SLOWTESTS_DESC=	Enable slow tests that are skipped by default
 BASHTESTS_DESC=	Enable tests that require the GNU bash shell
+LIBUNWIND_DESC=	Backtrace with libunwind (do set WITH_DEBUG=yes!)
 
 FUSEFS_CONFIGURE_ENABLE=	fuse2fs
 
@@ -77,6 +78,11 @@ LIB_DEPENDS+=	libblkid.so:misc/e2fsprogs-libblkid
 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_LDFLAGS+=	-rdynamic
+LIBUNWIND_EXTRA_PATCHES=${FILESDIR}/extrapatch-e2fsck_sigcatcher.c
+
 PORTDOCS=	NOTICE README RELEASE-NOTES SUBMITTING-PATCHES
 .endif
 
@@ -94,9 +100,10 @@ MAKE_ARGS+=	V=1
 
 .include <bsd.port.options.mk>
 
-. if ${ARCH} == powerpc64
-# Fix powerpc64 SIGSEGV,
-# see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231570
+. if ! empty(ARCH:Mpowerpc*)
+# Fix powerpc64/powerpc SIGSEGV,
+# see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=231570 (ppc64)
+# see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242798 (ppc32 - untested)
 USES+=		compiler:c11
 . endif
 
@@ -231,6 +238,10 @@ _check_target=check
 _check_timeout=180
 .endif
 
+.if ${PORT_OPTIONS:MLIBUNWIND}
+_staticlibs+=${LOCALBASE}/lib/libunwind.a /usr/lib/liblzma.a
+.endif
+
 post-build:
 # Relink e2fsck statically - We need to make sure that tools for the root file
 # system are statically linked against anything that is outside the root fs,
@@ -239,7 +250,7 @@ post-build:
 	cd ${WRKSRC}/e2fsck && ${RM} -f e2fsck \
 		&& ${MAKE_CMD} e2fsck V=1 \
 		LIBS="../lib/libsupport.a ../lib/libext2fs.a ../lib/libcom_err.a \
-		/usr/lib/libexecinfo.a /usr/lib/libelf.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
 # Regression check: avoid a port (not upstream!) regression from 1.40.5,

Added: head/sysutils/e2fsprogs/files/extrapatch-e2fsck_sigcatcher.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/e2fsprogs/files/extrapatch-e2fsck_sigcatcher.c	Fri Jan 31 02:13:24 2020	(r524662)
@@ -0,0 +1,19 @@
+--- e2fsck/sigcatcher.c.orig	2020-01-06 23:10:17 UTC
++++ e2fsck/sigcatcher.c
+@@ -17,6 +17,7 @@
+ #ifdef HAVE_EXECINFO_H
+ #include <execinfo.h>
+ #endif
++#include <libunwind.h>
+ 
+ #include "e2fsck.h"
+ 
+@@ -376,7 +377,7 @@ static void die_signal_handler(int signum, siginfo_t *
+ 	       void *stack_syms[32];
+ 	       int frames;
+ 
+-	       frames = backtrace(stack_syms, 32);
++	       frames = unw_backtrace(stack_syms, 32);
+ 	       backtrace_symbols_fd(stack_syms, frames, 2);
+        }
+ #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001310213.00V2DOlR030203>