MFH: r553656

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)

Approved by:	ports-secteam (implicit, runtime fix)
This commit is contained in:
Kyle Evans 2020-10-29 23:53:36 +00:00
parent 9cf86f475a
commit 3db263b6ef
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2020Q4/; revision=553657
2 changed files with 15 additions and 31 deletions

View File

@ -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:

View File

@ -1,29 +0,0 @@
--- src/Makefile.orig 2017-05-03 11:08:48.482664000 -0400
+++ src/Makefile 2017-05-03 11:09:44.473112000 -0400
@@ -24,7 +24,7 @@
# removing the '#' in front of them. Make sure you force a full recompile
# with "make clean", followed by "make" if you change any options.
#
-DEFAULT_CC = gcc
+DEFAULT_CC = cc
#
# LuaJIT builds as a native 32 or 64 bit binary by default.
CC= $(DEFAULT_CC)
@@ -36,7 +36,7 @@
# to slow down the C part by not omitting it. Debugging, tracebacks and
# unwinding are not affected -- the assembler part has frame unwind
# information and GCC emits it where needed (x64) or with -g (see CCDEBUG).
-CCOPT= -O2 -fomit-frame-pointer
+#CCOPT= -O2 -fomit-frame-pointer
# Use this if you want to generate a smaller binary (but it's slower):
#CCOPT= -Os -fomit-frame-pointer
# Note: it's no longer recommended to use -O3 with GCC 4.x.
@@ -50,7 +50,7 @@
# x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute
# the binaries to a different machine you could also use: -march=native
#
-CCOPT_x86= -march=i686
+#CCOPT_x86= -march=i686
CCOPT_x64=
CCOPT_arm=
CCOPT_ppc=