* [PATCH] reloc-ldflags: Fix handling of multiple relocatable library directories.
@ 2020-09-14 0:52 Ben Pfaff
2020-09-20 14:49 ` Bruno Haible
0 siblings, 1 reply; 3+ messages in thread
From: Ben Pfaff @ 2020-09-14 0:52 UTC (permalink / raw)
To: bug-gnulib, Bruno Haible; +Cc: Ben Pfaff
Each one needs its own -Wl,-rpath,$dir option, instead of being attached
to a single one in some way. Otherwise, the build fails at link time.
---
2020-09-13 Ben Pfaff <blp@cs.stanford.edu>
* 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.
diff --git a/build-aux/reloc-ldflags b/build-aux/reloc-ldflags
index 145e741f8f..b1188a8707 100755
--- a/build-aux/reloc-ldflags
+++ b/build-aux/reloc-ldflags
@@ -90,7 +90,7 @@ if test -n "$origin_token"; then
done
dir="$origin_token"`echo "$idir" | sed -e 's,//*[^/]*,/..,g'`"$dir"
# Add dir to rpath.
- rpath="${rpath}${rpath:+ }$dir"
+ rpath="${rpath}${rpath:+ }-Wl,-rpath,$dir"
;;
*)
if test -n "$dir"; then
@@ -106,9 +106,9 @@ if test -n "$origin_token"; then
# 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,-z,origin $rpath" ;;
*)
- echo "-Wl,-rpath,$rpath" ;;
+ echo "$rpath" ;;
esac
fi
else
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] reloc-ldflags: Fix handling of multiple relocatable library directories.
2020-09-14 0:52 [PATCH] reloc-ldflags: Fix handling of multiple relocatable library directories Ben Pfaff
@ 2020-09-20 14:49 ` Bruno Haible
2020-09-20 23:33 ` Ben Pfaff
0 siblings, 1 reply; 3+ messages in thread
From: Bruno Haible @ 2020-09-20 14:49 UTC (permalink / raw)
To: Ben Pfaff; +Cc: bug-gnulib
Hi Ben,
Thanks for the patch! You are right: since none of the platforms for which
reloc-ldflags is being used is AIX, HP-UX, IRIX — these are the platforms
for which libtool.m4 defines hardcode_libdir_separator to ':' —, the rpath
options are cumulative.
I applied your patch, revising comments and a variable name.
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.
diff --git a/build-aux/reloc-ldflags b/build-aux/reloc-ldflags
index 145e741..cdb2f47 100755
--- a/build-aux/reloc-ldflags
+++ b/build-aux/reloc-ldflags
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] reloc-ldflags: Fix handling of multiple relocatable library directories.
2020-09-20 14:49 ` Bruno Haible
@ 2020-09-20 23:33 ` Ben Pfaff
0 siblings, 0 replies; 3+ messages in thread
From: Ben Pfaff @ 2020-09-20 23:33 UTC (permalink / raw)
To: Bruno Haible; +Cc: bug-gnulib
On Sun, Sep 20, 2020 at 7:50 AM Bruno Haible <bruno@clisp.org> wrote:
> Thanks for the patch! You are right: since none of the platforms for which
> reloc-ldflags is being used is AIX, HP-UX, IRIX — these are the platforms
> for which libtool.m4 defines hardcode_libdir_separator to ':' —, the rpath
> options are cumulative.
>
> I applied your patch, revising comments and a variable name.
Thanks a lot!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-20 23:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 0:52 [PATCH] reloc-ldflags: Fix handling of multiple relocatable library directories Ben Pfaff
2020-09-20 14:49 ` Bruno Haible
2020-09-20 23:33 ` Ben Pfaff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).