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