From c8108c1852ad5761b73a2ce9ee1e7b4156752c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= Date: Sun, 23 Jan 2022 17:49:24 +0100 Subject: [PATCH] Don't append LIBDIR to rpath unconditionally by default Without this change, csc will by default unconditionally pass -Wl,-rpath=$(LIBDIR) to the linker. This was noticed on Alpine Linux where our build tool (abuild) checks for redundant rpath entries as part of the packaging process [1]. This causes a warning to be emitted for all packaged software compiled with CHICKEN Scheme since it contains redundant rpath entries. In my opinion this should be fixed in CHICKEN itself as there should be no need (in the common case) to pass -Wl,-rpath=$(LIBDIR) on most systems since LIBDIR should be part of the default rpath (otherwise it doesn't make much sense to install .so files to it). If -deployed or non-host-mode is used then the default rpath value is still modified as before. [1]: https://gitlab.alpinelinux.org/alpine/abuild/-/blob/681ef9dfcf6e57bdda767efed7e50ce8e9de0563/abuild.in#L1178-L1194 --- csc.scm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/csc.scm b/csc.scm index 921c7841..aa15ed75 100644 --- a/csc.scm +++ b/csc.scm @@ -262,14 +262,13 @@ (define (builtin-link-options) (append (cond (elf - (list - (conc "-L" library-dir) - (conc "-Wl," rpath-option - (if deployed - "$ORIGIN" - (if host-mode - host-libdir - TARGET_RUN_LIB_HOME))))) + (cons + (conc "-L" library-dir) + (if deployed + (list (conc "-Wl," rpath-option "$ORIGIN")) + (if (not host-mode) + (list (conc "-Wl," rpath-option TARGET_RUN_LIB_HOME)) + '())))) (aix (list (conc "-Wl," rpath-option "\"" library-dir "\""))) (else