blob: 50d47d9f7a89fc52f8542d2bb3dff858ed91ede1 [file] [log] [blame]
Andrew Geisslereff27472021-10-29 15:35:00 -05001From: Richard Purdie <richard.purdie@linuxfoundation.org>
2Subject: [PATCH 05/12] ltmain.in: Don't encode RATHS which match default linker paths
3
4We don't want to add RPATHS which match default linker search paths, they're
5a waste of space. This patch filters libtools list of paths to encoode and
6removes the ones we don't need.
7
8Libtool may be passed link paths of the form "/usr/lib/../lib" so normalize
9the paths before comparision.
10
11Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
12
13Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2021-10/msg00013.html]
14
15diff -u b/build-aux/ltmain.in b/build-aux/ltmain.in
16--- b/build-aux/ltmain.in
17+++ b/build-aux/ltmain.in 2012-08-22 11:01:34.191345989 -0700
18@@ -7286,8 +7286,16 @@
19 esac
20 fi
21 else
22- eval flag=\"$hardcode_libdir_flag_spec\"
23- func_append dep_rpath " $flag"
24+ # We only want to hardcode in an rpath if it isn't in the
25+ # default dlsearch path.
26+ func_normal_abspath "$libdir"
27+ libdir_norm=$func_normal_abspath_result
28+ case " $sys_lib_dlsearch_path " in
29+ *" $libdir_norm "*) ;;
30+ *) eval flag=\"$hardcode_libdir_flag_spec\"
31+ func_append dep_rpath " $flag"
32+ ;;
33+ esac
34 fi
35 elif test -n "$runpath_var"; then
36 case "$perm_rpath " in
37@@ -8019,8 +8027,16 @@
38 esac
39 fi
40 else
41- eval flag=\"$hardcode_libdir_flag_spec\"
42- func_append rpath " $flag"
43+ # We only want to hardcode in an rpath if it isn't in the
44+ # default dlsearch path.
45+ func_normal_abspath "$libdir"
46+ libdir_norm=$func_normal_abspath_result
47+ case " $sys_lib_dlsearch_path " in
48+ *" $libdir_norm "*) ;;
49+ *) eval flag=\"$hardcode_libdir_flag_spec\"
50+ rpath+=" $flag"
51+ ;;
52+ esac
53 fi
54 elif test -n "$runpath_var"; then
55 case "$perm_rpath " in
56@@ -8070,8 +8086,14 @@
57 esac
58 fi
59 else
60- eval flag=\"$hardcode_libdir_flag_spec\"
61- func_append rpath " $flag"
62+ # We only want to hardcode in an rpath if it isn't in the
63+ # default dlsearch path.
64+ case " $sys_lib_dlsearch_path " in
65+ *" $libdir "*) ;;
66+ *) eval flag=\"$hardcode_libdir_flag_spec\"
67+ func_append rpath " $flag"
68+ ;;
69+ esac
70 fi
71 elif test -n "$runpath_var"; then
72 case "$finalize_perm_rpath " in