pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/lang/quickjs
Module Name: pkgsrc
Committed By: wiz
Date: Thu Aug 13 18:11:25 UTC 2026
Modified Files:
pkgsrc/lang/quickjs: DESCR Makefile distinfo
pkgsrc/lang/quickjs/patches: patch-Makefile patch-quickjs.c
Log Message:
quickjs: fix for NetBSD sparc
https://github.com/quickjs-ng/quickjs/issues/1663
>From vom513 on pkgsrc-users.
Bump PKGREVISION.
Shorten DESCR while here, regen patches.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 pkgsrc/lang/quickjs/DESCR
cvs rdiff -u -r1.21 -r1.22 pkgsrc/lang/quickjs/Makefile
cvs rdiff -u -r1.18 -r1.19 pkgsrc/lang/quickjs/distinfo
cvs rdiff -u -r1.10 -r1.11 pkgsrc/lang/quickjs/patches/patch-Makefile
cvs rdiff -u -r1.8 -r1.9 pkgsrc/lang/quickjs/patches/patch-quickjs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/lang/quickjs/DESCR
diff -u pkgsrc/lang/quickjs/DESCR:1.2 pkgsrc/lang/quickjs/DESCR:1.3
--- pkgsrc/lang/quickjs/DESCR:1.2 Mon Mar 21 23:00:33 2022
+++ pkgsrc/lang/quickjs/DESCR Thu Aug 13 18:11:24 2026
@@ -7,12 +7,8 @@ It optionally supports mathematical exte
overloading.
Main Features:
- * Small and easily embeddable: just a few C files, no external
- dependency, 190 KiB of x86 code for a simple hello world program.
- * Fast interpreter with very low startup time: runs the 56000
- tests of the ECMAScript Test Suite in about 100 seconds on a
- single core of a desktop PC. The complete life cycle of a runtime
- instance completes in less than 300 microseconds.
+ * Small and easily embeddable
+ * Fast interpreter with very low startup time
* Almost complete ES2020 support including modules, asynchronous
generators and full Annex B support (legacy web compatibility).
* Passes 100% of the ECMAScript Test Suite.
Index: pkgsrc/lang/quickjs/Makefile
diff -u pkgsrc/lang/quickjs/Makefile:1.21 pkgsrc/lang/quickjs/Makefile:1.22
--- pkgsrc/lang/quickjs/Makefile:1.21 Sun Jun 28 17:59:25 2026
+++ pkgsrc/lang/quickjs/Makefile Thu Aug 13 18:11:24 2026
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile,v 1.21 2026/06/28 17:59:25 osa Exp $
+# $NetBSD: Makefile,v 1.22 2026/08/13 18:11:24 wiz Exp $
NAME= quickjs
QJS_DATE= 2026-06-04
VERSION= ${QJS_DATE:S/-//g}
DISTNAME= ${NAME}-${QJS_DATE}
PKGNAME= ${NAME}-${VERSION}
+PKGREVISION= 1
CATEGORIES= lang
MASTER_SITES= https://bellard.org/quickjs/
EXTRACT_SUFX= .tar.xz
Index: pkgsrc/lang/quickjs/distinfo
diff -u pkgsrc/lang/quickjs/distinfo:1.18 pkgsrc/lang/quickjs/distinfo:1.19
--- pkgsrc/lang/quickjs/distinfo:1.18 Sun Jun 28 17:59:25 2026
+++ pkgsrc/lang/quickjs/distinfo Thu Aug 13 18:11:24 2026
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.18 2026/06/28 17:59:25 osa Exp $
+$NetBSD: distinfo,v 1.19 2026/08/13 18:11:24 wiz Exp $
BLAKE2s (quickjs-2026-06-04.tar.xz) = 0e8aa66c6da831831afec7f30dec09b3c3208dbf44d5bacacb24247f1bb66a8f
SHA512 (quickjs-2026-06-04.tar.xz) = e02722a82de0d2b7d6c95edc57daccecb5680b8d87f3580424a143a04df197c0df5bcd51d138c5e1e8b0d78b423acfa39169e8c0bfc1ace8387e13fc3bca22e2
Size (quickjs-2026-06-04.tar.xz) = 621500 bytes
-SHA1 (patch-Makefile) = 532db4aac6ba830361739443cf4a51db7401faae
+SHA1 (patch-Makefile) = 97a536c64fa9d96a4c517300e6637b530f33ef25
SHA1 (patch-qjs.c) = 6a8c089ab7ec884eab8a1b48e4a3757026cc8066
SHA1 (patch-qjsc.c) = bffd0222579f3996bc21116694343a7dd65d8f33
SHA1 (patch-quickjs-libc.c) = 39c2b553ef04b308e7c477590edd345b62acc528
-SHA1 (patch-quickjs.c) = fa0bcebee73e7c16c154b78073c5c220a274c27f
+SHA1 (patch-quickjs.c) = ee599099e8ab2d5f90b6252091b3a0a072604907
Index: pkgsrc/lang/quickjs/patches/patch-Makefile
diff -u pkgsrc/lang/quickjs/patches/patch-Makefile:1.10 pkgsrc/lang/quickjs/patches/patch-Makefile:1.11
--- pkgsrc/lang/quickjs/patches/patch-Makefile:1.10 Sat Mar 28 05:26:12 2026
+++ pkgsrc/lang/quickjs/patches/patch-Makefile Thu Aug 13 18:11:24 2026
@@ -1,8 +1,8 @@
-$NetBSD: patch-Makefile,v 1.10 2026/03/28 05:26:12 pho Exp $
+$NetBSD: patch-Makefile,v 1.11 2026/08/13 18:11:24 wiz Exp $
Portability patch for NetBSD.
---- Makefile.orig 2025-12-22 14:12:46.000000000 +0000
+--- Makefile.orig 2026-06-04 12:26:08.000000000 +0000
+++ Makefile
@@ -22,10 +22,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
@@ -21,14 +21,14 @@ Portability patch for NetBSD.
CONFIG_FREEBSD=y
endif
# Windows cross compilation from Linux
-@@ -81,6 +85,19 @@ CONFIG_CLANG=y
+@@ -83,7 +87,20 @@ endif
CONFIG_DEFAULT_AR=y
CONFIG_LTO=
endif
+ifdef CONFIG_NETBSD
+CONFIG_LTO=
+endif
-+
+
+ifndef CONFIG_NETBSD
+CONFIG_LDL=y
+endif
@@ -38,10 +38,11 @@ Portability patch for NetBSD.
+else
+SOEXT=.so
+endif
-
++
ifdef CONFIG_WIN32
ifdef CONFIG_M32
-@@ -211,14 +228,30 @@ PROGS=qjs$(EXE) qjsc$(EXE) run-test262$(
+ CROSS_PREFIX?=i686-w64-mingw32-
+@@ -217,15 +234,31 @@ QJSC=./host-qjsc
ifneq ($(CROSS_PREFIX),)
QJSC_CC=gcc
QJSC=./host-qjsc
@@ -54,8 +55,8 @@ Portability patch for NetBSD.
+QJSC_CMD=DYLD_LIBRARY_PATH=. $(QJSC)
+else
+QJSC_CMD=LD_LIBRARY_PATH=. $(QJSC)
-+endif
endif
++endif
PROGS+=libquickjs.a
+ifdef CONFIG_DARWIN
+PROGS+=libquickjs.dylib libquickjs.0.dylib
@@ -68,11 +69,12 @@ Portability patch for NetBSD.
+PROGS+=libquickjs.lto.dylib libquickjs.lto.0.dylib
+else
+PROGS+=libquickjs.lto.so libquickjs.lto.so.0
-+endif
endif
++endif
# examples
-@@ -247,23 +280,29 @@ QJS_LIB_OBJS=$(OBJDIR)/quickjs.o $(OBJDI
+ ifeq ($(CROSS_PREFIX),)
+@@ -253,23 +286,29 @@ QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/repl.o $(QJS_LIB_OB
QJS_OBJS=$(OBJDIR)/qjs.o $(OBJDIR)/repl.o $(QJS_LIB_OBJS)
@@ -105,7 +107,7 @@ Portability patch for NetBSD.
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
fuzz_eval: $(OBJDIR)/fuzz_eval.o $(OBJDIR)/fuzz_common.o libquickjs.fuzz.a
-@@ -289,6 +328,9 @@ QJSC_DEFINES:=-DCONFIG_CC=\"$(QJSC_CC)\"
+@@ -295,6 +334,9 @@ endif
ifdef CONFIG_LTO
QJSC_DEFINES+=-DCONFIG_LTO
endif
@@ -115,7 +117,7 @@ Portability patch for NetBSD.
QJSC_HOST_DEFINES:=-DCONFIG_CC=\"$(HOST_CC)\" -DCONFIG_PREFIX=\"$(PREFIX)\"
$(OBJDIR)/qjsc.o: CFLAGS+=$(QJSC_DEFINES)
-@@ -302,17 +344,33 @@ endif
+@@ -308,17 +350,33 @@ libquickjs$(LTOEXT).a: $(QJS_LIB_OBJS)
libquickjs$(LTOEXT).a: $(QJS_LIB_OBJS)
$(AR) rcs $@ $^
@@ -150,7 +152,7 @@ Portability patch for NetBSD.
ifneq ($(wildcard unicode/UnicodeData.txt),)
$(OBJDIR)/libunicode.o $(OBJDIR)/libunicode.nolto.o: libunicode-table.h
-@@ -372,10 +430,24 @@ install: all
+@@ -378,11 +436,25 @@ install: all
mkdir -p "$(DESTDIR)$(PREFIX)/bin"
$(STRIP) qjs$(EXE) qjsc$(EXE)
install -m755 qjs$(EXE) qjsc$(EXE) "$(DESTDIR)$(PREFIX)/bin"
@@ -174,11 +176,12 @@ Portability patch for NetBSD.
+else
+ install -m755 libquickjs.lto.so.0 "$(DESTDIR)$(PREFIX)/lib"
+ (cd "$(DESTDIR)$(PREFIX)/lib" && ln -sf libquickjs.lto.so.0 libquickjs.lto.so)
-+endif
endif
++endif
mkdir -p "$(DESTDIR)$(PREFIX)/include/quickjs"
install -m644 quickjs.h quickjs-libc.h "$(DESTDIR)$(PREFIX)/include/quickjs"
-@@ -390,7 +462,7 @@ HELLO_OPTS=-fno-string-normalize -fno-ma
+
+@@ -396,7 +468,7 @@ hello.c: $(QJSC) $(HELLO_SRCS)
-fno-date -fno-module-loader
hello.c: $(QJSC) $(HELLO_SRCS)
@@ -187,7 +190,7 @@ Portability patch for NetBSD.
examples/hello: $(OBJDIR)/hello.o $(QJS_LIB_OBJS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
-@@ -401,12 +473,12 @@ HELLO_MODULE_OPTS=-fno-string-normalize
+@@ -407,12 +479,12 @@ examples/hello_module: $(QJSC) libquickjs$(LTOEXT).a $
-fno-typedarray -fno-regexp -fno-json -fno-eval -fno-proxy \
-fno-date -m
examples/hello_module: $(QJSC) libquickjs$(LTOEXT).a $(HELLO_MODULE_SRCS)
Index: pkgsrc/lang/quickjs/patches/patch-quickjs.c
diff -u pkgsrc/lang/quickjs/patches/patch-quickjs.c:1.8 pkgsrc/lang/quickjs/patches/patch-quickjs.c:1.9
--- pkgsrc/lang/quickjs/patches/patch-quickjs.c:1.8 Sun Jun 28 17:59:25 2026
+++ pkgsrc/lang/quickjs/patches/patch-quickjs.c Thu Aug 13 18:11:24 2026
@@ -1,9 +1,27 @@
-$NetBSD: patch-quickjs.c,v 1.8 2026/06/28 17:59:25 osa Exp $
+$NetBSD: patch-quickjs.c,v 1.9 2026/08/13 18:11:24 wiz Exp $
- Portability patch for NetBSD.
+- Fix SIGBUS on strict-alignment platforms (e.g. sparc, sparc64): the
+ function bytecode's constant pool (an array of JSValue, which can
+ hold a double/int64_t and needs 8-byte alignment) was suballocated
+ at an offset that was only guaranteed 4-byte alignment, since none
+ of the preceding JSFunctionBytecode fields force 8-byte alignment
+ on their own. This crashed the first time a compiled script's
+ constant pool was read or written, e.g.:
---- quickjs.c.orig 2026-06-04 08:26:08.000000000 -0400
-+++ quickjs.c 2026-06-28 13:52:10.705459429 -0400
+ # qjsc -s -c -o repl.c -m repl.js
+ Bus error (core dumped)
+
+ (gdb) bt
+ #0 JS_WriteFunctionTag (obj=<optimized out>, s=0xefffccbc) at quickjs.c:37315
+ 37315 if (JS_WriteObjectRec(s, b->cpool[i]))
+
+ Round cpool_offset up to 8 bytes in both the writer's allocation
+ path (js_create_function) and the matching reader's allocation
+ path (JS_ReadFunctionTag).
+
+--- quickjs.c.orig 2026-06-04 12:26:08.000000000 +0000
++++ quickjs.c
@@ -69,7 +69,15 @@
/* define to include Atomics.* operations which depend on the OS
threads */
@@ -20,7 +38,7 @@ $NetBSD: patch-quickjs.c,v 1.8 2026/06/2
#endif
#if !defined(__EMSCRIPTEN__)
-@@ -2140,7 +2148,7 @@
+@@ -2140,7 +2148,7 @@ static size_t js_def_malloc_usable_size(const void *pt
return malloc_size(ptr);
#elif defined(_WIN32)
return _msize((void *)ptr);
@@ -29,3 +47,25 @@ $NetBSD: patch-quickjs.c,v 1.8 2026/06/2
return 0;
#elif defined(__linux__) || defined(__GLIBC__)
return malloc_usable_size((void *)ptr);
+@@ -36006,8 +36014,8 @@ static JSValue js_create_function(JSContext *ctx, JSFu
+ } else {
+ function_size = sizeof(*b);
+ }
+- cpool_offset = function_size;
+- function_size += fd->cpool_count * sizeof(*fd->cpool);
++ cpool_offset = (function_size + 7) & ~7;
++ function_size = cpool_offset + fd->cpool_count * sizeof(*fd->cpool);
+ vardefs_offset = function_size;
+ function_size += (fd->arg_count + fd->var_count) * sizeof(*b->vardefs);
+ closure_var_offset = function_size;
+@@ -38682,8 +38690,8 @@ static JSValue JS_ReadFunctionTag(BCReaderState *s)
+ } else {
+ function_size = offsetof(JSFunctionBytecode, debug);
+ }
+- cpool_offset = function_size;
+- function_size += (uint64_t)bc.cpool_count * sizeof(*bc.cpool);
++ cpool_offset = (function_size + 7) & ~7;
++ function_size = cpool_offset + bc.cpool_count * sizeof(*bc.cpool);
+ vardefs_offset = function_size;
+ function_size += (uint64_t)local_count * sizeof(*bc.vardefs);
+ closure_var_offset = function_size;
Home |
Main Index |
Thread Index |
Old Index