]> Savannah Git Hosting - gnulib.git/commitdiff
relocatable-prog: Fix for multiple relocatable library directories.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 20 Sep 2020 14:44:29 +0000 (16:44 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 20 Sep 2020 14:49:29 +0000 (16:49 +0200)
* build-aux/reloc-ldflags: Fix handling of multiple relocatable library
directories.  Each one needs its own -Wl,-rpath,$dir option, instead of
being attached to a single one.

ChangeLog
build-aux/reloc-ldflags

index 541f5d7a440d3e5e20ed1fad841397b300ac4a43..d2ba0c62d686c07b0d9c2b0a3be90d3c3efd2070 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-09-19  Ben Pfaff  <blp@cs.stanford.edu>
+            Bruno Haible  <bruno@clisp.org>
+
+       relocatable-prog: Fix for multiple relocatable library directories.
+       * build-aux/reloc-ldflags: Fix handling of multiple relocatable library
+       directories.  Each one needs its own -Wl,-rpath,$dir option, instead of
+       being attached to a single one.
+
 2020-09-19  Jim Meyering  <meyering@fb.com>
 
        test-verify.c: avoid -Wshadow warnings
index 145e741f8f5ca8a282bcad031880e739bb6b55e0..cdb2f47bda15acd1769cf905de7844cc836c15e4 100755 (executable)
@@ -68,7 +68,9 @@ case "$host_os" in
     ;;
 esac
 if test -n "$origin_token"; then
-  rpath=
+  # We are not on AIX, HP-UX, or IRIX. Therefore the -rpath options are
+  # cumulative.
+  rpath_options=
   save_IFS="$IFS"; IFS=":"
   for dir in $library_path_value; do
     IFS="$save_IFS"
@@ -89,8 +91,8 @@ if test -n "$origin_token"; then
           idir=`echo "$idir" | sed -e 's,^//*[^/]*,,'`
         done
         dir="$origin_token"`echo "$idir" | sed -e 's,//*[^/]*,/..,g'`"$dir"
-        # Add dir to rpath.
-        rpath="${rpath}${rpath:+ }$dir"
+        # Augment rpath_options with dir.
+        rpath_options="${rpath_options}${rpath_options:+ }-Wl,-rpath,$dir"
         ;;
       *)
         if test -n "$dir"; then
@@ -101,15 +103,14 @@ if test -n "$origin_token"; then
   done
   IFS="$save_IFS"
   # Output it.
-  if test -n "$rpath"; then
+  if test -n "$rpath_options"; then
     case "$host_os" in
       # At least some versions of FreeBSD, DragonFly, and OpenBSD need the
       # linker option "-z origin". See <https://lekensteyn.nl/rpath.html>.
       freebsd* | dragonfly* | openbsd*)
-        echo "-Wl,-z,origin -Wl,-rpath,$rpath" ;;
-      *)
-        echo "-Wl,-rpath,$rpath" ;;
+        rpath_options="-Wl,-z,origin $rpath_options" ;;
     esac
+    echo "$rpath_options"
   fi
 else
   echo "relocation via rpath not supported on this system: $host" 1>&2