1From: Richard Purdie <richard.purdie@linuxfoundation.org> 2Subject: [PATCH 04/12] ltmain.sh: Fix sysroot paths being encoded into RPATHs 3 4There is a bug where RPATHs could end up containing sysroot values when 5cross compiling which is obviously incorrect. Strip out sysroot components 6from libdir when building RPATH values to avoid this. 7 8Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> 9 10Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00009.html] 11 12diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in 13index 2c994612..96238350 100644 14--- a/build-aux/ltmain.in 15+++ b/build-aux/ltmain.in 16@@ -7654,9 +7654,11 @@ EOF 17 test relink = "$opt_mode" || rpath=$compile_rpath$rpath 18 for libdir in $rpath; do 19 if test -n "$hardcode_libdir_flag_spec"; then 20+ func_replace_sysroot "$libdir" 21+ libdir=$func_replace_sysroot_result 22+ func_stripname '=' '' "$libdir" 23+ libdir=$func_stripname_result 24 if test -n "$hardcode_libdir_separator"; then 25- func_replace_sysroot "$libdir" 26- libdir=$func_replace_sysroot_result 27 if test -z "$hardcode_libdirs"; then 28 hardcode_libdirs=$libdir 29 else 30@@ -8386,6 +8388,10 @@ EOF 31 hardcode_libdirs= 32 for libdir in $compile_rpath $finalize_rpath; do 33 if test -n "$hardcode_libdir_flag_spec"; then 34+ func_replace_sysroot "$libdir" 35+ libdir=$func_replace_sysroot_result 36+ func_stripname '=' '' "$libdir" 37+ libdir=$func_stripname_result 38 if test -n "$hardcode_libdir_separator"; then 39 if test -z "$hardcode_libdirs"; then 40 hardcode_libdirs=$libdir 41@@ -8437,6 +8443,10 @@ EOF 42 hardcode_libdirs= 43 for libdir in $finalize_rpath; do 44 if test -n "$hardcode_libdir_flag_spec"; then 45+ func_replace_sysroot "$libdir" 46+ libdir=$func_replace_sysroot_result 47+ func_stripname '=' '' "$libdir" 48+ libdir=$func_stripname_result 49 if test -n "$hardcode_libdir_separator"; then 50 if test -z "$hardcode_libdirs"; then 51 hardcode_libdirs=$libdir 52-- 532.25.1 54 55