From 6a834d9c90c2ee0ec0a63fb3f5a9c0845323c456 Mon Sep 17 00:00:00 2001 From: diviocity Date: Mon, 30 Nov 2026 04:31:36 +0100 Subject: [PATCH] Resolve indirect shared library dependencies inside the target SDK --- tools/vinix-cc.v | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/vinix-cc.v b/tools/vinix-cc.v index c2f7b6c..48fb016 100644 --- a/tools/vinix-cc.v +++ b/tools/vinix-cc.v @@ -44,11 +44,14 @@ fn main() { } mut args := ['--sysroot=${root}', '-specs=${specs}'] args << target_search_args(root, os.args[1..]) - // The released AArch64 kernel maps 16 KiB pages. Some cross GCC - // distributions select a 4 KiB linker maximum even with a musl sysroot. - if os.is_file(os.join_path(root, 'lib/ld-musl-aarch64.so.1')) - && !os.args[1..].any(it in ['-c', '-E', '-S', '-M', '-MM', '-fsyntax-only', '-r']) { - args << '-Wl,-z,max-page-size=16384' + if !os.args[1..].any(it in ['-c', '-E', '-S', '-M', '-MM', '-fsyntax-only', '-r']) { + // The build machine's linker also needs to find DT_NEEDED libraries + // named by input shared objects. Keep this path out of the target ELF. + args << ['-Xlinker', '-rpath-link', '-Xlinker', '${root}/usr/lib:${root}/lib'] + // The released AArch64 kernel maps 16 KiB pages. + if os.is_file(os.join_path(root, 'lib/ld-musl-aarch64.so.1')) { + args << '-Wl,-z,max-page-size=16384' + } } os.execvp(compiler, args) or { eprintln('${driver}: ${compiler}: ${err}') -- 2.56.1