Link GCC development libraries to packaged SONAMEs
@@ -45,6 +45,8 @@ vinix-run ./parallel
4545
4646For 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.
4747
48+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.
49+
4850After 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.
4951
5052### Building native AArch64 tools on x86-64
@@ -127,14 +127,20 @@ defpkgbuild(gcc,
127127 run("make", "-C", build-dir(), string-append("DESTDIR=", pkgdir()), "install-gcc", "install-libcc1", "install-lto-plugin", "install-target-libgcc",
128128 "install-target-libstdc++-v3", "install-target-libatomic", "install-target-libgomp")
129129 run("make", "-C", build-dir(), string-append("DESTDIR=", pkgdir()), itm-compiler(), "install-target-libitm")
130- ; The versioned shared objects are owned by gcc-libs. Keep the unversioned
131- ; linker entries, static archives and headers here.
132- for-each(fn(lib) {
133- files := glob(string-append(pkgdir(), "/usr/lib/", lib, ".so.[0-9]*"))
134- run("test", "-f", car(files))
135- for-each(fn(file) { run("rm", file) }, files)
136- }, list("libgcc_s", "libstdc++", "libatomic", "libgomp"))
137- for-each(fn(la) { run("rm", la) }, glob(string-append(pkgdir(), "/usr/lib/*.la")))
130+ ; gcc-libs owns the versioned ELF files. Point the development links at
131+ ; their SONAMEs so they work with that package's installed filenames.
132+ libdir := string-append(pkgdir(), "/usr/lib/")
133+ for-each(fn(lib, version) {
134+ linker := string-append(libdir, lib, ".so")
135+ soname := string-append(lib, ".so.", version)
136+ run("test", "-f", string-append(libdir, soname))
137+ if not(string=?("libgcc_s", lib)) {
138+ run("ln", "-sfn", soname, linker)
139+ }
140+ for-each(fn(file) { run("rm", file) }, glob(string-append(linker, ".*")))
141+ }, list("libgcc_s", "libstdc++", "libatomic", "libgomp"), list("1", "6", "1", "1"))
142+ for-each(fn(la) { run("rm", la) }, glob(string-append(libdir, "*.la")))
143+ run("mv", string-append(libdir, "libitm.spec"), string-append(libdir, "gcc/", triplet, "/14.2.0/libitm.spec"))
138144 run("ln", "-s", "gcc", string-append(pkgdir(), "/usr/bin/cc"))
139145 for-each(fn(standard) {
140146 path := string-append(pkgdir(), "/usr/bin/", standard)