summaryrefslogtreecommitdiff
path: root/util/shlib_wrap.sh.in
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2018-11-13 00:16:55 +0100
committerRichard Levitte <levitte@openssl.org>2018-11-14 00:41:57 +0100
commit18289399743da6c3db462f37fc8797738e8acf7c (patch)
treeb5b0b6ce1fa84cd37fe27a2d26b9a515b32b3a2f /util/shlib_wrap.sh.in
parent6e624a645300d784eaa97ddda29364081ede36d7 (diff)
downloadopenssl-new-18289399743da6c3db462f37fc8797738e8acf7c.tar.gz
Fix rpath-related Linux "test_shlibload" failure.
When libssl and libcrypto are compiled on Linux with "-rpath", but not "--enable-new-dtags", the RPATH takes precedence over LD_LIBRARY_PATH, and we end up running with the wrong libraries. This is resolved by using full (or at least relative, rather than just the filename to be found on LD_LIBRARY_PATH) paths to the shared objects. Reviewed-by: Viktor Dukhovni <viktor@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7626)
Diffstat (limited to 'util/shlib_wrap.sh.in')
-rwxr-xr-xutil/shlib_wrap.sh.in28
1 files changed, 19 insertions, 9 deletions
diff --git a/util/shlib_wrap.sh.in b/util/shlib_wrap.sh.in
index 9199d12fc7..eac70ed972 100755
--- a/util/shlib_wrap.sh.in
+++ b/util/shlib_wrap.sh.in
@@ -1,5 +1,22 @@
#!/bin/sh
+{-
+ use lib '.';
+ use configdata;
+ sub shlib {
+ my $lib = shift;
+ return "" if $disabled{shared};
+ $lib = $unified_info{rename}->{$lib}
+ if defined $unified_info{rename}->{$lib};
+ $lib = $unified_info{sharednames}->{$lib}
+ . ($target{shlib_variant} || "")
+ . ($target{shared_extension} || ".so");
+ $lib =~ s|\.\$\(SHLIB_VERSION_NUMBER\)
+ |.$config{shlib_version_number}|x;
+ return $lib;
+ }
+ ""; # Make sure no left over string sneaks its way into the script
+-}
# To test this OpenSSL version's applications against another version's
# shared libraries, simply set
#
@@ -25,15 +42,8 @@ fi
THERE="`echo $0 | sed -e 's|[^/]*$||' 2>/dev/null`.."
[ -d "${THERE}" ] || exec "$@" # should never happen...
-# Alternative to this is to parse ${THERE}/Makefile...
-LIBCRYPTOSO="${THERE}/libcrypto.so"
-if [ -f "$LIBCRYPTOSO" ]; then
- while [ -h "$LIBCRYPTOSO" ]; do
- LIBCRYPTOSO="${THERE}/`ls -l "$LIBCRYPTOSO" | sed -e 's|.*\-> ||'`"
- done
- SOSUFFIX=`echo ${LIBCRYPTOSO} | sed -e 's|.*\.so||' 2>/dev/null`
- LIBSSLSO="${THERE}/libssl.so${SOSUFFIX}"
-fi
+LIBCRYPTOSO="${THERE}/{- shlib('libcrypto') -}"
+LIBSSLSO="${THERE}/{- shlib('libssl') -}"
SYSNAME=`(uname -s) 2>/dev/null`;
case "$SYSNAME" in