me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

Build and run native binutils for both Vinix architectures

diviocity committed 5 days ago · 06d5cb5a514cf178265571c63bd4bab7555f7bb1 View patch
Unverified signature 2 files changed +18 -10
binutils/PKGBUILD.vile +12 -10

@@ -1,10 +1,10 @@

1-; Alpine 3.21 binutils source and patches, producing native x86-64 ELF tools.

1+; Alpine 3.21 binutils source and patches, producing native Vinix ELF tools.

22defpkgbuild(binutils,

33 #:pkgname, "binutils",

44 #:pkgver, "2.43.1",

5- #:pkgrel, 1,

5+ #:pkgrel, 2,

66 #:pkgdesc, "GNU assembler, linker, and binary utilities for Vinix",

7- #:arch, [#:x86-64],

7+ #:arch, [#:x86-64, #:aarch64],

88 #:url, "https://www.gnu.org/software/binutils/",

99 #:license, ["GPL-2.0-or-later", "LGPL-2.1-or-later", "BSD-3-Clause"],

1010 #:depends, ["musl", "zlib"],

@@ -26,19 +26,21 @@ defpkgbuild(binutils,

2626 "binutils-ld-fix-static-linking.patch", "CVE-2025-0840.patch", "CVE-2025-1153.patch", "CVE-2025-3198.patch"))

2727 },

2828 #:build, fn() {

29- 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",

30- "binutils-2.43.1/configure", "--prefix=/usr", "--build=x86_64-pc-linux-gnu", "--host=x86_64-linux-musl",

31- "--target=x86_64-linux-musl", "--with-sysroot=/", "--with-system-zlib", "--without-zstd", "--disable-gold",

29+ prefix := get-environment-variable("CROSS_COMPILE")

30+ tools := if string?(prefix) { prefix } else { "" }

31+ ; When --target is omitted GNU configure uses --host, producing a

32+ ; native assembler and linker for the requested Vinix architecture.

33+ run("env", string-append("AR=", tools, "ar"), string-append("RANLIB=", tools, "ranlib"), string-append("NM=", tools, "nm"),

34+ string-append("AS=", tools, "as"), string-append("LD=", tools, "ld"), "CC_FOR_BUILD=gcc", "CFLAGS=-O2 -std=gnu17",

35+ "CXXCPP=vinix-cc -E -x c++", "PKG_CONFIG=false", "vinix-configure", "binutils-2.43.1/configure",

36+ "--with-sysroot=/", "--with-system-zlib", "--without-zstd", "--disable-gold",

3237 "--disable-gdb", "--disable-gprofng", "--disable-sim", "--disable-nls", "--disable-werror",

3338 "--disable-multilib", "--disable-libctf", "--disable-shared", "--enable-deterministic-archives",

3439 "--enable-new-dtags", "--enable-relro", "--enable-default-hash-style=gnu")

3540 run("make")

3641 },

3742 #:check, fn() {

38- root := get-environment-variable("VPAC_MAKEPKG_ROOT")

39- for-each(fn(tool) {

40- run(string-append(root, "/lib/ld-musl-x86_64.so.1"), "--library-path", string-append(root, "/usr/lib"), tool, "--version")

41- }, list("gas/as-new", "ld/ld-new", "binutils/objdump"))

43+ for-each(fn(tool) { run("vinix-run", tool, "--version") }, list("gas/as-new", "ld/ld-new", "binutils/objdump"))

4244 },

4345 #:package, fn() {

4446 run("make", string-append("DESTDIR=", pkgdir()), "install")

tests/toolchain/exit-aarch64.s new file +6 -0

@@ -0,0 +1,6 @@

1+ .text

2+ .globl _start

3+_start:

4+ mov x0, #23

5+ mov x8, #93

6+ svc #0