blob: 589a33e8a66327799e079bffccc119d13526ecb7 [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
Andrew Geissler9aee5002022-03-30 16:27:02 +000015diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
16index 96238350..6fb58ed2 100644
17--- a/build-aux/ltmain.in
18+++ b/build-aux/ltmain.in
19@@ -7672,8 +7672,16 @@ EOF
Andrew Geisslereff27472021-10-29 15:35:00 -050020 esac
21 fi
22 else
23- eval flag=\"$hardcode_libdir_flag_spec\"
24- func_append dep_rpath " $flag"
25+ # We only want to hardcode in an rpath if it isn't in the
26+ # default dlsearch path.
27+ func_normal_abspath "$libdir"
28+ libdir_norm=$func_normal_abspath_result
29+ case " $sys_lib_dlsearch_path " in
30+ *" $libdir_norm "*) ;;
31+ *) eval flag=\"$hardcode_libdir_flag_spec\"
32+ func_append dep_rpath " $flag"
33+ ;;
34+ esac
35 fi
36 elif test -n "$runpath_var"; then
37 case "$perm_rpath " in
Andrew Geissler9aee5002022-03-30 16:27:02 +000038@@ -8406,8 +8414,16 @@ EOF
Andrew Geisslereff27472021-10-29 15:35:00 -050039 esac
40 fi
41 else
42- eval flag=\"$hardcode_libdir_flag_spec\"
43- func_append rpath " $flag"
44+ # We only want to hardcode in an rpath if it isn't in the
45+ # default dlsearch path.
46+ func_normal_abspath "$libdir"
47+ libdir_norm=$func_normal_abspath_result
48+ case " $sys_lib_dlsearch_path " in
49+ *" $libdir_norm "*) ;;
50+ *) eval flag=\"$hardcode_libdir_flag_spec\"
51+ rpath+=" $flag"
52+ ;;
53+ esac
54 fi
55 elif test -n "$runpath_var"; then
56 case "$perm_rpath " in
Andrew Geissler9aee5002022-03-30 16:27:02 +000057@@ -8461,8 +8477,14 @@ EOF
Andrew Geisslereff27472021-10-29 15:35:00 -050058 esac
59 fi
60 else
61- eval flag=\"$hardcode_libdir_flag_spec\"
62- func_append rpath " $flag"
63+ # We only want to hardcode in an rpath if it isn't in the
64+ # default dlsearch path.
65+ case " $sys_lib_dlsearch_path " in
66+ *" $libdir "*) ;;
67+ *) eval flag=\"$hardcode_libdir_flag_spec\"
68+ func_append rpath " $flag"
69+ ;;
70+ esac
71 fi
72 elif test -n "$runpath_var"; then
73 case "$finalize_perm_rpath " in
Andrew Geissler9aee5002022-03-30 16:27:02 +000074--
752.25.1
76