From 05bce11ca3428b3510166634166a05ae4efbb03b Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 15:26:08 +0100 Subject: [PATCH] Link GCC development libraries to packaged SONAMEs --- gcc/BOOTSTRAP.md | 2 ++ gcc/PKGBUILD.vile | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/gcc/BOOTSTRAP.md b/gcc/BOOTSTRAP.md index df223b0..e134abf 100644 --- a/gcc/BOOTSTRAP.md +++ b/gcc/BOOTSTRAP.md @@ -45,6 +45,8 @@ vinix-run ./parallel For the compiler build, set `VPAC_MAKEPKG_ROOT` and `VPAC_MAKEPKG_DB` to the full SDK containing `gcc-libs` and `isl25`. ISL supplies the integer set operations used by GCC's Graphite loop optimizer. Keep the private link directory ahead of `/opt/cxx-link` in `LDFLAGS` and set `-Wl,-rpath-link,$VPAC_MAKEPKG_ROOT/usr/lib`. Run `vpac --native-build /work/gcc/PKGBUILD.vile /work/compiler-archive`. On a native build GCC builds its target development files with the new compiler and the SDK binutils. +The compiler package links `libstdc++.so`, `libatomic.so` and `libgomp.so` to the SONAMEs owned by `gcc-libs`. It keeps GCC's `libgcc_s.so` linker script and puts `libitm.spec` in the target compiler's versioned directory. + After publishing the compiler archive, install `gcc`, `make`, `busybox` and `linux-headers` by name in a fresh signed root. Copy `tests/toolchain/` into a writable directory in that root and run `make check` there. The test compiles and executes C and C++ programs with the packaged compiler, checks the three arithmetic libraries, unwinds a C++ exception and exercises the OpenMP and atomic runtimes. It also checks that Graphite found an affine loop region and uses a normal binutils archive containing link-time-optimization objects. ### Building native AArch64 tools on x86-64 diff --git a/gcc/PKGBUILD.vile b/gcc/PKGBUILD.vile index faa6ddf..d14ba79 100644 --- a/gcc/PKGBUILD.vile +++ b/gcc/PKGBUILD.vile @@ -127,14 +127,20 @@ defpkgbuild(gcc, run("make", "-C", build-dir(), string-append("DESTDIR=", pkgdir()), "install-gcc", "install-libcc1", "install-lto-plugin", "install-target-libgcc", "install-target-libstdc++-v3", "install-target-libatomic", "install-target-libgomp") run("make", "-C", build-dir(), string-append("DESTDIR=", pkgdir()), itm-compiler(), "install-target-libitm") - ; The versioned shared objects are owned by gcc-libs. Keep the unversioned - ; linker entries, static archives and headers here. - for-each(fn(lib) { - files := glob(string-append(pkgdir(), "/usr/lib/", lib, ".so.[0-9]*")) - run("test", "-f", car(files)) - for-each(fn(file) { run("rm", file) }, files) - }, list("libgcc_s", "libstdc++", "libatomic", "libgomp")) - for-each(fn(la) { run("rm", la) }, glob(string-append(pkgdir(), "/usr/lib/*.la"))) + ; gcc-libs owns the versioned ELF files. Point the development links at + ; their SONAMEs so they work with that package's installed filenames. + libdir := string-append(pkgdir(), "/usr/lib/") + for-each(fn(lib, version) { + linker := string-append(libdir, lib, ".so") + soname := string-append(lib, ".so.", version) + run("test", "-f", string-append(libdir, soname)) + if not(string=?("libgcc_s", lib)) { + run("ln", "-sfn", soname, linker) + } + for-each(fn(file) { run("rm", file) }, glob(string-append(linker, ".*"))) + }, list("libgcc_s", "libstdc++", "libatomic", "libgomp"), list("1", "6", "1", "1")) + for-each(fn(la) { run("rm", la) }, glob(string-append(libdir, "*.la"))) + run("mv", string-append(libdir, "libitm.spec"), string-append(libdir, "gcc/", triplet, "/14.2.0/libitm.spec")) run("ln", "-s", "gcc", string-append(pkgdir(), "/usr/bin/cc")) for-each(fn(standard) { path := string-append(pkgdir(), "/usr/bin/", standard) -- 2.56.1