Skip to contentSkip to conversation

Build fixes for nodejs and uftrace, kernel-selftest OOM skips

PATCH New Khem Raj 1 participant 4 messages Nov 27

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

cover Build fixes for nodejs and uftrace, kernel-selftest OOM skips

- nodejs: V8 in Node.js 26 has static_asserts in discarded if constexpr branches that GCC 12 rejects. Debian 12 build hosts use GCC 12 for the host tools, so the build fails there. Checked with a full native build using GCC 12.5.
- kernel-selftest: skip cgroup:test_memcontrol, whose OOM cases make testimage fail on "Killed process" in dmesg, and cgroup:test_kmem, which fails intermittently under memory pressure in the test VM.
- uftrace: fix a parallel build race on the arch common.o, sent upstream as https://github.com/namhyung/uftrace/pull/2079, and backport the upstream fix for a second race that make --shuffle exposes in 0.20.

These apply on master on their own and on top of the series sent earlier.

Khem Raj (3):
nodejs: Fix build with gcc 12 on the build host
kernel-selftest: Skip the cgroup tests that hit the OOM killer
uftrace: Fix parallel build races

 ...carded-constexpr-branches-for-gcc-12.patch | 73 +++++++++++++++++++
 .../recipes-devtools/nodejs/nodejs_26.13.1.bb |  1 +
 ...d-error-with-make-shuffle-for-arch-c.patch | 44 +++++++++++
 ...-Fix-a-build-error-with-make-shuffle.patch | 43 +++++++++++
 .../recipes-devtools/uftrace/uftrace_0.20.bb  |  2 +
 .../kernel-selftest/kernel-selftest/run-ptest |  7 +-
 6 files changed, 169 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs-26/0012-v8-Fix-static_assert-in-discarded-constexpr-branches-for-gcc-12.patch
 create mode 100644 meta-oe/recipes-devtools/uftrace/uftrace/0002-build-Fix-a-build-error-with-make-shuffle-for-arch-c.patch
 create mode 100644 meta-oe/recipes-devtools/uftrace/uftrace/0003-build-Fix-a-build-error-with-make-shuffle.patch
author
#1 lore raw

PATCH 1/3 nodejs: Fix build with gcc 12 on the build host

Debian 12 build hosts fail to compile the V8 host tools (CXX(host)) with gcc 12:

turboshaft/assembler.h:1838:33: error: static assertion failed

    static_assert(kTaggedSize == kInt32Size);

note: the comparison reduces to '(8 == 4)'

GCC before 13 evaluates non-dependent static_asserts in the discarded branch of an if constexpr inside a template. A full gcc 12 build found a second case in builtins-iterator-inl.h. Hoist the first check in front of the if constexpr and make the second depend on a template parameter.

Node.js 26 requires GCC 13.2, so the patch is not for upstream. Checked with a complete native build using gcc 12.5.

AI-Generated: Uses Claude Code

---
 ...carded-constexpr-branches-for-gcc-12.patch | 73 +++++++++++++++++++
 .../recipes-devtools/nodejs/nodejs_26.13.1.bb |  1 +
 2 files changed, 74 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/nodejs/nodejs-26/0012-v8-Fix-static_assert-in-discarded-constexpr-branches-for-gcc-12.patch
meta-oe/recipes-devtools/nodejs/nodejs-26/0012-v8-Fix-static_assert-in-discarded-constexpr-branches-for-gcc-12.patch new file +73 -0
new file mode 100644
index 0000000000..f6fa856d3a
@@ -0,0 +1,73 @@
+From f5ce52fd44c5f3f9bc6d9134fc1c14e4eabec2a4 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 26 Nov 2026 17:16:05 -0800
+Subject: [PATCH] v8: Fix static_assert in discarded constexpr branches for gcc
+ 12
+
+GCC before 13 evaluates a static_assert whose condition does not depend
+on a template parameter when it parses the template, even inside the
+discarded branch of an if constexpr. GCC 13 implemented P2593 and defers
+the check. On 64-bit targets this breaks two places in V8:
+
+- turboshaft::AssemblerOpInterface::SmiLessThan() asserts the 32-bit
+  tagged layout in the branch that is only taken with 4-byte tagged
+  values.
+- IterableForEach() asserts that typed array element types fit in an
+  int, including in the branch discarded for the BigInt64, BigUint64 and
+  Uint32 element types.
+
+Hoist the first check in front of the if constexpr, where it holds for
+both layouts, and make the second depend on the IntVisitor template
+parameter so it is only checked on instantiation.
+
+Node.js 26 requires GCC 13.2, but Debian 12 build hosts ship GCC 12 and
+use it for the host tools (CXX(host)).
+
+Upstream-Status: Inappropriate [Node.js 26 requires GCC >= 13.2; this is for older build host compilers]
+AI-Generated: Uses Claude Code
+Signed-off-by: Khem Raj <[email protected]>
+---
+ deps/v8/src/builtins/builtins-iterator-inl.h | 10 ++++++----
+ deps/v8/src/compiler/turboshaft/assembler.h  |  5 +++--
+ 2 files changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/deps/v8/src/builtins/builtins-iterator-inl.h b/deps/v8/src/builtins/builtins-iterator-inl.h
+index a8632ba9..eb9081cf 100644
+--- a/deps/v8/src/builtins/builtins-iterator-inl.h
++++ b/deps/v8/src/builtins/builtins-iterator-inl.h
+@@ -272,10 +272,12 @@ MaybeDirectHandle<Object> IterableForEach(Isolate* isolate,
+             return MaybeDirectHandle<Object>();                             \
+           }                                                                 \
+         } else {                                                            \
+-          static_assert(std::numeric_limits<ctype>::max() <=                \
+-                        std::numeric_limits<int>::max());                   \
+-          static_assert(std::numeric_limits<ctype>::min() >=                \
+-                        std::numeric_limits<int>::min());                   \
++          static_assert(sizeof(IntVisitor) > 0 &&                           \
++                        std::numeric_limits<ctype>::max() <=                \
++                            std::numeric_limits<int>::max());               \
++          static_assert(sizeof(IntVisitor) > 0 &&                           \
++                        std::numeric_limits<ctype>::min() >=                \
++                            std::numeric_limits<int>::min());               \
+           if (!int_visitor(static_cast<int>(val))) {                        \
+             return MaybeDirectHandle<Object>();                             \
+           }                                                                 \
+diff --git a/deps/v8/src/compiler/turboshaft/assembler.h b/deps/v8/src/compiler/turboshaft/assembler.h
+index 85ca7d42..cef87c7b 100644
+--- a/deps/v8/src/compiler/turboshaft/assembler.h
++++ b/deps/v8/src/compiler/turboshaft/assembler.h
+@@ -1832,11 +1832,12 @@ class AssemblerOpInterface : public Next {
+   V<Word32> SmiOpName(ConstOrV<Smi> left, ConstOrV<Smi> right) {           \
+     V<WordPtr> l = BitcastTaggedToWordPtrForTagAndSmiBits(resolve(left));  \
+     V<WordPtr> r = BitcastTaggedToWordPtrForTagAndSmiBits(resolve(right)); \
++    static_assert(kTaggedSize == kInt64Size ||                             \
++                  (kTaggedSize == kInt32Size &&                            \
++                   v8::internal::SmiValuesAre31Bits()));                   \
+     if constexpr (kTaggedSize == kInt64Size) {                             \
+       return IntPtrOpName(l, r);                                           \
+     } else {                                                               \
+-      static_assert(kTaggedSize == kInt32Size);                            \
+-      static_assert(v8::internal::SmiValuesAre31Bits());                   \
+       return Int32OpName(TruncateWordPtrToWord32(l),                       \
+                          TruncateWordPtrToWord32(r));                      \
+     }                                                                      \
meta-oe/recipes-devtools/nodejs/nodejs_26.13.1.bb +1 -0
index c42b07acf3..5d968b0f36 100644
@@ -30,6 +30,7 @@ SRC_URI = "https://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://0007-positional-args.patch \
            file://0008-custom-env.patch \
            file://0011-v8-handle-supplementary-case-equivalents-of-BMP-characters.patch \
+           file://0012-v8-Fix-static_assert-in-discarded-constexpr-branches-for-gcc-12.patch \
            file://run-ptest \
            "
 SRC_URI:append:class-target = " \
author
#2 lore raw

PATCH 2/3 kernel-selftest: Skip the cgroup tests that hit the OOM killer

In reply to Khem Raj

cgroup:test_memcontrol runs memcg OOM cases on purpose, and testimage fails the ptest image whenever dmesg has "Killed process":

AssertionError: ERROR: Processes were killed by the OOM Killer:
Memory cgroup out of memory: Killed process 3424 (test_memcontrol) ...

cgroup:test_kmem fails intermittently under memory pressure in the test VM. Skip both.

AI-Generated: Uses Claude Code

---
 .../kernel-selftest/kernel-selftest/run-ptest              | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
meta-oe/recipes-kernel/kernel-selftest/kernel-selftest/run-ptest +6 -1
index 85fa63b5e4..3c4b4993c1 100755
@@ -16,8 +16,13 @@
 #
 # landlock:fs_bench only reports timings, and walking its 10000 nested
 # directories takes about 90 seconds in qemu, twice the default timeout.
+#
+# cgroup:test_memcontrol triggers the OOM killer on purpose, and testimage
+# fails the run whenever dmesg has "Killed process". cgroup:test_kmem fails
+# intermittently under memory pressure in the test VM. Skip both.
 SKIP="-S ftrace:ftracetest-ktap -S filesystems:file_stressor \
-      -S ptrace:vmaccess -S tty:tty_tiocsti_test -S landlock:fs_bench"
+      -S ptrace:vmaccess -S tty:tty_tiocsti_test -S landlock:fs_bench \
+      -S cgroup:test_memcontrol -S cgroup:test_kmem"
 
 # sysmap_is_sealed can't tell at runtime whether the kernel seals the system
 # mappings, so skip it when the running kernel's config says it doesn't.
author
#3 lore raw

PATCH 3/3 uftrace: Fix parallel build races

In reply to Khem Raj

misc/symbols and misc/dbginfo link arch/<arch>/common.o, which only the arch Makefile knows how to build. When the top-level make reaches it first, it uses the builtin %.o rule without the -iquote include paths:

arch/x86_64/common.c:10:10: fatal error: 'uftrace.h' file not found
make: *** [<builtin>: .../arch/x86_64/common.o] Error 1

Make the object depend on uftrace-arch.a so the arch Makefile builds it. Before the change, "make -j16 --shuffle=2" failed this way, and so did building $(objdir)/misc/symbols alone in a clean tree.

Also backport the upstream fix for the libmcount dependency on version.h, a second race that "make --shuffle" exposes in 0.20.

AI-Generated: Uses Claude Code

---
 ...d-error-with-make-shuffle-for-arch-c.patch | 44 +++++++++++++++++++
 ...-Fix-a-build-error-with-make-shuffle.patch | 43 ++++++++++++++++++
 .../recipes-devtools/uftrace/uftrace_0.20.bb  |  2 +
 3 files changed, 89 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/uftrace/uftrace/0002-build-Fix-a-build-error-with-make-shuffle-for-arch-c.patch
 create mode 100644 meta-oe/recipes-devtools/uftrace/uftrace/0003-build-Fix-a-build-error-with-make-shuffle.patch
meta-oe/recipes-devtools/uftrace/uftrace/0002-build-Fix-a-build-error-with-make-shuffle-for-arch-c.patch new file +44 -0
new file mode 100644
index 0000000000..cd18eddb00
@@ -0,0 +1,44 @@
+From 2347c298f7ac45f2a55dea065deadd0eabc410f1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 26 Nov 2026 23:25:06 -0800
+Subject: [PATCH] build: Fix a build error with make --shuffle for arch
+ common.o
+
+The misc/symbols and misc/dbginfo link $(objdir)/arch/$(ARCH)/common.o
+but the top-level Makefile has no rule for it; it's built by the arch
+Makefile as a part of uftrace-arch.a.  When make reaches the object
+before uftrace-arch.a, it falls back to the builtin %.o rule which lacks
+the -iquote include paths (or fails with "No rule to make target" when
+objdir is different from srcdir):
+
+  $ make -j16 --shuffle=2
+  ...
+  arch/x86_64/common.c:10:10: fatal error: uftrace.h: No such file or directory
+  make: *** [<builtin>: .../arch/x86_64/common.o] Error 1
+
+Building the tool alone, like `make $PWD/misc/symbols` in a clean tree,
+fails the same way every time.
+
+Add a rule with an empty recipe that makes the object depend on
+uftrace-arch.a so that it's always built by the arch Makefile.
+
+Upstream-Status: Submitted [https://github.com/namhyung/uftrace/pull/2079]
+AI-Generated: Uses Claude Code
+Signed-off-by: Khem Raj <[email protected]>
+---
+ Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index a4e43a12..a220cc86 100644
+--- a/Makefile
++++ b/Makefile
+@@ -316,6 +316,8 @@ $(LIBMCOUNT_ARCH_OBJS): $(wildcard $(srcdir)/arch/$(ARCH)/*.[cS]) $(LIBMCOUNT_DE
+ $(UFTRACE_ARCH_OBJS): $(wildcard $(srcdir)/arch/$(ARCH)/*.[cS]) $(COMMON_DEPS)
+ 	@$(MAKE) -B -C $(srcdir)/arch/$(ARCH) $@
+ 
++$(objdir)/arch/$(ARCH)/common.o: $(UFTRACE_ARCH_OBJS) ;
++
+ $(objdir)/uftrace.o: $(srcdir)/uftrace.c $(objdir)/version.h $(COMMON_DEPS)
+ 	$(QUIET_CC)$(CC) $(UFTRACE_CFLAGS) -c -o $@ $<
+ 
meta-oe/recipes-devtools/uftrace/uftrace/0003-build-Fix-a-build-error-with-make-shuffle.patch new file +43 -0

43 lines not on this page · raw message

meta-oe/recipes-devtools/uftrace/uftrace_0.20.bb +2 -0
index 28c2186418..80878ee296 100644
@@ -11,6 +11,8 @@ DEPENDS:append:libc-musl = " argp-standalone"
 SRCREV = "842ed731248a9daded38774d8fb26c7b09474461"
 SRC_URI = "git://github.com/namhyung/${BPN};branch=master;protocol=https;tag=v${PV} \
            file://0001-include-libgen.h-for-basename.patch \
+           file://0002-build-Fix-a-build-error-with-make-shuffle-for-arch-c.patch \
+           file://0003-build-Fix-a-build-error-with-make-shuffle.patch \
            "
 
 LDFLAGS:append:libc-musl = " -largp"