blob: 4fcf456b0b8e9873cdf50b0f5abf62f191bf4199 [file] [log] [blame]
Andrew Geisslereff27472021-10-29 15:35:00 -05001From: 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
Andrew Geissler9aee5002022-03-30 16:27:02 +000013index 2c994612..96238350 100644
Andrew Geisslereff27472021-10-29 15:35:00 -050014--- a/build-aux/ltmain.in
15+++ b/build-aux/ltmain.in
Andrew Geissler9aee5002022-03-30 16:27:02 +000016@@ -7654,9 +7654,11 @@ EOF
Andrew Geisslereff27472021-10-29 15:35:00 -050017 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
18 for libdir in $rpath; do
19 if test -n "$hardcode_libdir_flag_spec"; then
Andrew Geissler9aee5002022-03-30 16:27:02 +000020+ func_replace_sysroot "$libdir"
21+ libdir=$func_replace_sysroot_result
22+ func_stripname '=' '' "$libdir"
23+ libdir=$func_stripname_result
Andrew Geisslereff27472021-10-29 15:35:00 -050024 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
Andrew Geissler9aee5002022-03-30 16:27:02 +000030@@ -8386,6 +8388,10 @@ EOF
Andrew Geisslereff27472021-10-29 15:35:00 -050031 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
Andrew Geissler9aee5002022-03-30 16:27:02 +000041@@ -8437,6 +8443,10 @@ EOF
Andrew Geisslereff27472021-10-29 15:35:00 -050042 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
Andrew Geissler9aee5002022-03-30 16:27:02 +000052--
532.25.1
54