~ chicken-core (chicken-5) d8f63e7c6a8ebfda54e3cebac6555d44b0b63ff1


commit d8f63e7c6a8ebfda54e3cebac6555d44b0b63ff1
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Wed Mar 11 18:41:50 2020 +0100
Commit:     Kooda <kooda@upyum.com>
CommitDate: Tue Mar 24 13:03:30 2020 +0100

    use -rpath instead of -R on all platforms but Solaris
    
    Signed-off-by: Kooda <kooda@upyum.com>

diff --git a/Makefile.aix b/Makefile.aix
index ce4cf4fb..93322b06 100644
--- a/Makefile.aix
+++ b/Makefile.aix
@@ -49,7 +49,7 @@ CXX_COMPILER = g++
 
 LINKER_OPTIONS = -maix64 -Wl,-bsvr4 -Wl,-bbigtoc
 LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared
-LINKER_EXECUTABLE_OPTIONS = -L. -Wl,-R"$(RUNTIME_LINKER_PATH)"
+LINKER_EXECUTABLE_OPTIONS = -L. -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
 LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
 
 LIBRARIAN_OPTIONS = -rv -X 64
diff --git a/Makefile.android b/Makefile.android
index 1812dcc1..7d30e01f 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -42,8 +42,8 @@ C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer
 endif
 endif
 LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
-LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-R"$(RUNTIME_LINKER_PATH)"
-LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-R"$(RUNTIME_LINKER_PATH)"
+LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
+LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
 # Android NDK build system currently does not understand
 # versioned sonames, so don't try to embed a soname.
 #LIBCHICKEN_SO_LINKER_OPTIONS = -Wl,-soname,lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION)
diff --git a/Makefile.bsd b/Makefile.bsd
index b982a06f..b1996e0b 100644
--- a/Makefile.bsd
+++ b/Makefile.bsd
@@ -43,8 +43,8 @@ C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer
 endif
 endif
 LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
-LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -shared -Wl,-R"$(RUNTIME_LINKER_PATH)" -Wl,-L.
-LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-R"$(RUNTIME_LINKER_PATH)"
+LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -shared -Wl,-rpath="$(RUNTIME_LINKER_PATH)" -Wl,-L.
+LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
 LIBCHICKEN_SO_LINKER_OPTIONS = -Wl,-soname,lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION)
 LIBRARIES = -lm -lpthread
 NEEDS_RELINKING = yes
diff --git a/Makefile.haiku b/Makefile.haiku
index a20da9b2..27763fa0 100644
--- a/Makefile.haiku
+++ b/Makefile.haiku
@@ -42,8 +42,8 @@ C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer
 endif
 endif
 LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
-LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-R"$(RUNTIME_LINKER_PATH)"
-LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-R"$(RUNTIME_LINKER_PATH)"
+LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
+LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
 LIBCHICKEN_SO_LINKER_OPTIONS = -Wl,-soname,lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION)
 LIBRARIES = -lnetwork
 NEEDS_RELINKING = yes
diff --git a/Makefile.hurd b/Makefile.hurd
index f09d6ded..abac66a2 100644
--- a/Makefile.hurd
+++ b/Makefile.hurd
@@ -43,8 +43,8 @@ C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer
 endif
 endif
 LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
-LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-R"$(RUNTIME_LINKER_PATH)"
-LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-R"$(RUNTIME_LINKER_PATH)"
+LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
+LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
 LIBCHICKEN_SO_LINKER_OPTIONS = -Wl,-soname,lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION)
 LIBRARIES = -lm -ldl
 NEEDS_RELINKING = yes
diff --git a/Makefile.linux b/Makefile.linux
index cfa8c2c5..7f0fa06c 100644
--- a/Makefile.linux
+++ b/Makefile.linux
@@ -43,8 +43,8 @@ C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer
 endif
 endif
 LINKER_LINK_SHARED_LIBRARY_OPTIONS = -shared
-LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-R"$(RUNTIME_LINKER_PATH)"
-LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-R"$(RUNTIME_LINKER_PATH)"
+LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -L. -shared -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
+LINKER_LINK_SHARED_PROGRAM_OPTIONS = -Wl,-rpath="$(RUNTIME_LINKER_PATH)"
 LIBCHICKEN_SO_LINKER_OPTIONS = -Wl,-soname,lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION)
 LIBRARIES = -lm -ldl
 NEEDS_RELINKING = yes
diff --git a/README b/README
index 3b20cc00..ac852b85 100644
--- a/README
+++ b/README
@@ -435,7 +435,7 @@ _/        _/    _/    _/    _/        _/  _/    _/        _/    _/_/
 	    you add the following definitions to `Makefile.bsd':
 
 	      C_COMPILER_OPTIONS += -I/usr/pkg/lib
-	      LINKER_OPTIONS += -L/usr/pkg/lib -Wl,-R/usr/pkg/lib
+	      LINKER_OPTIONS += -L/usr/pkg/lib -Wl,-rpath=/usr/pkg/lib
 
 	    Note that this may cause build-problems, if you already have
 	    an existing CHICKEN installation in the /usr/pkg prefix.
diff --git a/csc.scm b/csc.scm
index a3a89aa3..01cfd04f 100644
--- a/csc.scm
+++ b/csc.scm
@@ -68,6 +68,7 @@
 (define osx (eq? (software-version) 'macosx))
 (define cygwin (eq? (software-version) 'cygwin))
 (define aix (eq? (build-platform) 'aix))
+(define solaris (memq (software-version) '(solaris sunos)))
 
 (define elf
   (memq (software-version) '(linux netbsd freebsd solaris openbsd hurd haiku)))
@@ -256,20 +257,21 @@
 (define linking-optimization-options default-linking-optimization-options)
 
 (define link-options '())
+(define rpath-option (if solaris "-R" "-rpath="))
 
 (define (builtin-link-options)
   (append
    (cond (elf
 	  (list
 	   (conc "-L" library-dir)
-	   (conc "-Wl,-R"
+	   (conc "-Wl," rpath-option
 		 (if deployed
 		     "$ORIGIN"
 		     (if host-mode
 			 host-libdir
 			 TARGET_RUN_LIB_HOME)))))
 	 (aix
-	  (list (conc "-Wl,-R\"" library-dir "\"")))
+	  (list (conc "-Wl," rpath-option "\"" library-dir "\"")))
 	 (else
 	  (list (conc "-L" library-dir))))
    (if (and deployed (memq (software-version) '(freebsd openbsd netbsd)))
@@ -776,7 +778,8 @@ EOF
 		(set! rpath (car rest))
 		(when (and (memq (build-platform) '(gnu clang))
 			   (not mingw) (not osx))
-		  (set! link-options (append link-options (list (string-append "-Wl,-R" rpath)))) )
+		  (set! link-options
+                    (append link-options (list (string-append "-Wl," rpath-option rpath)))) )
 	  	(set! rest (cdr rest)) ]
 	       [(-host) #f]
 	       ((-oi) 
diff --git a/manual/Cross development b/manual/Cross development
index d1a07742..fe6757fb 100644
--- a/manual/Cross development	
+++ b/manual/Cross development	
@@ -198,7 +198,7 @@ Looks good.
   arm-none-linux-gnueabi-gcc hello.c -o hello.o -c -fno-strict-aliasing -DHAVE_CHICKEN_CONFIG_H -g -Wall \
     -Wno-unused -I /home/felix/cross-chicken/arm-chicken/include
   rm hello.c
-  arm-none-linux-gnueabi-gcc hello.o -o hello -L/home/felix/cross-chicken/arm-chicken/lib  -Wl,-R/usr/lib -lm \
+  arm-none-linux-gnueabi-gcc hello.o -o hello -L/home/felix/cross-chicken/arm-chicken/lib  -Wl,-rpath=/usr/lib -lm \
     -ldl -lchicken
   rm hello.o
 
Trap