From 06d5cb5a514cf178265571c63bd4bab7555f7bb1 Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 02:21:19 +0100 Subject: [PATCH] Build and run native binutils for both Vinix architectures --- binutils/PKGBUILD.vile | 22 ++++++++++++---------- tests/toolchain/exit-aarch64.s | 6 ++++++ 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 tests/toolchain/exit-aarch64.s diff --git a/binutils/PKGBUILD.vile b/binutils/PKGBUILD.vile index b6ff42a..31a7723 100644 --- a/binutils/PKGBUILD.vile +++ b/binutils/PKGBUILD.vile @@ -1,10 +1,10 @@ -; Alpine 3.21 binutils source and patches, producing native x86-64 ELF tools. +; Alpine 3.21 binutils source and patches, producing native Vinix ELF tools. defpkgbuild(binutils, #:pkgname, "binutils", #:pkgver, "2.43.1", - #:pkgrel, 1, + #:pkgrel, 2, #:pkgdesc, "GNU assembler, linker, and binary utilities for Vinix", - #:arch, [#:x86-64], + #:arch, [#:x86-64, #:aarch64], #:url, "https://www.gnu.org/software/binutils/", #:license, ["GPL-2.0-or-later", "LGPL-2.1-or-later", "BSD-3-Clause"], #:depends, ["musl", "zlib"], @@ -26,19 +26,21 @@ defpkgbuild(binutils, "binutils-ld-fix-static-linking.patch", "CVE-2025-0840.patch", "CVE-2025-1153.patch", "CVE-2025-3198.patch")) }, #:build, fn() { - run("env", "CC=vinix-cc", "AR=ar", "RANLIB=ranlib", "NM=nm", "AS=as", "LD=ld", "CC_FOR_BUILD=gcc", "CFLAGS=-O2 -std=gnu17", "CXX=false", "CXXCPP=vinix-cc -E -x c++", "PKG_CONFIG=false", - "binutils-2.43.1/configure", "--prefix=/usr", "--build=x86_64-pc-linux-gnu", "--host=x86_64-linux-musl", - "--target=x86_64-linux-musl", "--with-sysroot=/", "--with-system-zlib", "--without-zstd", "--disable-gold", + prefix := get-environment-variable("CROSS_COMPILE") + tools := if string?(prefix) { prefix } else { "" } + ; When --target is omitted GNU configure uses --host, producing a + ; native assembler and linker for the requested Vinix architecture. + run("env", string-append("AR=", tools, "ar"), string-append("RANLIB=", tools, "ranlib"), string-append("NM=", tools, "nm"), + string-append("AS=", tools, "as"), string-append("LD=", tools, "ld"), "CC_FOR_BUILD=gcc", "CFLAGS=-O2 -std=gnu17", + "CXXCPP=vinix-cc -E -x c++", "PKG_CONFIG=false", "vinix-configure", "binutils-2.43.1/configure", + "--with-sysroot=/", "--with-system-zlib", "--without-zstd", "--disable-gold", "--disable-gdb", "--disable-gprofng", "--disable-sim", "--disable-nls", "--disable-werror", "--disable-multilib", "--disable-libctf", "--disable-shared", "--enable-deterministic-archives", "--enable-new-dtags", "--enable-relro", "--enable-default-hash-style=gnu") run("make") }, #:check, fn() { - root := get-environment-variable("VPAC_MAKEPKG_ROOT") - for-each(fn(tool) { - run(string-append(root, "/lib/ld-musl-x86_64.so.1"), "--library-path", string-append(root, "/usr/lib"), tool, "--version") - }, list("gas/as-new", "ld/ld-new", "binutils/objdump")) + for-each(fn(tool) { run("vinix-run", tool, "--version") }, list("gas/as-new", "ld/ld-new", "binutils/objdump")) }, #:package, fn() { run("make", string-append("DESTDIR=", pkgdir()), "install") diff --git a/tests/toolchain/exit-aarch64.s b/tests/toolchain/exit-aarch64.s new file mode 100644 index 0000000..c3bcb9a --- /dev/null +++ b/tests/toolchain/exit-aarch64.s @@ -0,0 +1,6 @@ + .text + .globl _start +_start: + mov x0, #23 + mov x8, #93 + svc #0 -- 2.56.1