brintos

brintos / llvm-project-archived public Read only

0
0

build-brintos.sh does not build llvm-objcopy (+objdump/strip/readelf) that the kernel rig requires #1

Closed sasha opened this issue · 1 comment
S sasha commented

toolchains/llvm-project/build-brintos.sh builds only clang lld opt llvm-config (its ninja line), but the kernel build rig requires llvm-objcopy in build/bindistros/common/linux-6.12/Makefile:80 (LLVMOBJCOPY := $(PINBIN)/llvm-objcopy), passed as OBJCOPY= at line 112. A fresh-clone kernel build therefore dies at the vmlinux_o stage:

  OBJCOPY modules.builtin.modinfo
/bin/sh: .../toolchains/llvm-project/build/bin/llvm-objcopy: No such file or directory
make[5]: *** [scripts/Makefile.vmlinux_o:76: modules.builtin.modinfo] Error 127

A plain make llvm never builds llvm-objcopy, so this is not a build-tree-reuse artifact; Kbuild with LLVM=1 also expects llvm-objdump/llvm-strip/llvm-readelf.

Reproduction

  1. Fresh super-repo at ea2c034 (llvm-project pin 31e14b7).
  2. make toolchain
  3. make kernel -> Error 127 on llvm-objcopy at the OBJCOPY modules.builtin.modinfo step.

Environment: super-repo ea2c034, llvm-project 31e14b7, Ubuntu 20.04.6 / gcc 9.

Proposed fix

Branch: brintos.io/brintos/llvm-project/tree/fix/build-brintos-binutils (commit e0a86e73) — the reviewable/mergeable fix (forge PRs are disabled, so the branch is the review surface).

For quick review, the whole change is one hunk:

--- a/build-brintos.sh
+++ b/build-brintos.sh
@@ -44,8 +44,13 @@
   -DLLVM_OPTIMIZED_TABLEGEN=ON \
   -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
 
-echo "brintOS LLVM: building clang lld opt llvm-config (+ libLLVM dylib)"
-ninja -C "$BUILD_DIR" ${JOBS:+-j "$JOBS"} clang lld opt llvm-config
+echo "brintOS LLVM: building clang lld opt llvm-config + binutils (+ libLLVM dylib)"
+# llvm-objcopy/objdump/strip/readelf are required by the kernel rig, which
+# passes them as OBJCOPY=/OBJDUMP=/STRIP=/READELF= (LLVM=1 build); without them
+# `make kernel` dies at the vmlinux_o stage with Error 127 (llvm-objcopy: No
+# such file or directory).
+ninja -C "$BUILD_DIR" ${JOBS:+-j "$JOBS"} clang lld opt llvm-config \
+  llvm-objcopy llvm-objdump llvm-strip llvm-readelf

Verified: building those extra targets against the existing build tree let make kernel proceed past vmlinux_o to a fully linked vmlinux.wasm (10.9 MB).

Proposed fix targets brintos/llvm-project only — no distro submodule pins moved. All distros share one lineage, so pin bumps are coordinated on merge, not per-engineer.

S sasha commented

Fixed upstream — main tip 7ca43933 (past this issue's pin 31e14b7) now builds the binutils: build-brintos.sh defines BINUTILS="llvm-ar llvm-nm llvm-ranlib llvm-link llvm-objcopy llvm-strip llvm-objdump llvm-readelf" and appends it to the ninja target list. make kernel gets past the vmlinux_o / modules.builtin.modinfo step at that tip. Good to close — thanks!

sasha closed this as completed