Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Oct 2020 23:53:02 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r553656 - in head/lang/luajit: . files
Message-ID:  <202010292353.09TNr2Dh038515@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Thu Oct 29 23:53:01 2020
New Revision: 553656
URL: https://svnweb.freebsd.org/changeset/ports/553656

Log:
  lang/luajit: switch to LLVM10 from ports for 12.1/amd64
  
  12.1 shipped with LLVM 8.0.1 which links libluajit with a bogus (improperly
  aligned) TLS segment offset. Notably, this breaks under 12.2 rtld and causes
  a SIGBUS when an error is raised.
  
  Since the issue is technically a broken binary, the attached patch pins
  12.1/amd64 builds of luajit to devel/llvm10 so that they can be rebuilt with
  a linker that will handle this properly and stop breaking luajit-dependant
  applications on 12.2 while the packages are still built on 12.1. This will
  naturally fall away when portmgr goes to axe conditionals solely for FreeBSD
  12.1 after it goes EOL.
  
  The src/Makefile patch has been dropped in this version in favor of just
  supplying the variables it was unsetting via Make arguments as a minor
  cleanup.
  
  PR:		250707, 250726
  Reported by:	many
  Investigation by:	Andrew Gierth <andrew tao11 riddles org uk>
  Confirmation from:	kib
  Approved by:	osa (maintainer)
  MFH:		2020Q4 (blanket: runtime fix)

Deleted:
  head/lang/luajit/files/patch-src_Makefile
Modified:
  head/lang/luajit/Makefile

Modified: head/lang/luajit/Makefile
==============================================================================
--- head/lang/luajit/Makefile	Thu Oct 29 23:49:30 2020	(r553655)
+++ head/lang/luajit/Makefile	Thu Oct 29 23:53:01 2020	(r553656)
@@ -3,7 +3,7 @@
 
 PORTNAME=	luajit
 DISTVERSION=	2.0.5
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	lang
 MASTER_SITES=	https://luajit.org/download/
 DISTNAME=	LuaJIT-${DISTVERSION}
@@ -23,7 +23,7 @@ CONFLICTS_INSTALL=	luajit-openresty
 WRKSRC=		${WRKDIR}/LuaJIT-${DISTVERSION}
 USES=		gmake
 USE_LDCONFIG=	yes
-MAKE_ARGS=	CC=${CC}
+MAKE_ARGS=	CC=${CC} CCOPT= CCOPT_x86=
 
 PLIST_SUB+=	VERSION=${DISTVERSION}
 
@@ -31,6 +31,19 @@ PLIST_SUB+=	VERSION=${DISTVERSION}
 
 .if ${ARCH:Mpowerpc*} || ${ARCH:Mmips*} || ${ARCH:Msparc*}
 USE_GCC=yes
+.elif ${ARCH} == amd64
+# FreeBSD 12.1 shipped LLVM 8.0.1, which links libluajit with a TLS phdr that
+# requests a 16-byte alignment but an offset that's 8 mod 16.  This results in
+# hilarity when an error is raised, as luajit raises an exception (stored in a
+# static TLS variable) via libunwind.  libunwind assumes proper alignment of
+# the exception and uses a movaps instruction, which throws a SIGBUS when it
+# encounters this misaligned TLS data.  While the linker problem doesn't seem
+# to be specific to amd64, the effect on luajit does seem to be.
+.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1201000 && ${OSVERSION} < 1202000
+LLVM_MINIMUM=	10
+BUILD_DEPENDS+=	llvm${LLVM_MINIMUM}>=10.0:devel/llvm${LLVM_MINIMUM}
+CC=		clang10
+.endif
 .endif
 
 post-install:



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