Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 1 | From d71c715554a054c534954b0aa357ca699ed68430 Mon Sep 17 00:00:00 2001 |
| 2 | From: Ross Burton <ross.burton@intel.com> |
| 3 | Date: Mon, 6 Mar 2017 23:33:27 -0800 |
| 4 | Subject: [PATCH] sync with OE libtool changes |
| 5 | |
| 6 | Apply these patches from our libtool patches as not only are redundant RPATHs a |
| 7 | waste of space but they can cause incorrect linking when native packages are |
| 8 | restored from sstate. |
| 9 | |
| 10 | fix-rpath.patch: |
| 11 | We don't want to add RPATHS which match default linker |
| 12 | search paths, they're a waste of space. This patch |
| 13 | filters libtools list and removes the ones we don't need. |
| 14 | |
| 15 | norm-rpath.patch: |
| 16 | Libtool may be passed link paths of the form "/usr/lib/../lib", which |
| 17 | fool its detection code into thinking it should be included as an |
| 18 | RPATH in the generated binary. Normalize before comparision. |
| 19 | |
| 20 | Upstream-Status: Inappropriate |
| 21 | |
| 22 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 23 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 24 | --- |
| 25 | ltmain.sh | 34 ++++++++++++++++++++++++++++------ |
| 26 | 1 file changed, 28 insertions(+), 6 deletions(-) |
| 27 | |
| 28 | diff --git a/ltmain.sh b/ltmain.sh |
| 29 | index 11ee684cccf..3b19ac15328 100644 |
| 30 | --- a/ltmain.sh |
| 31 | +++ b/ltmain.sh |
| 32 | @@ -8053,8 +8053,16 @@ EOF |
| 33 | esac |
| 34 | fi |
| 35 | else |
| 36 | - eval flag=\"$hardcode_libdir_flag_spec\" |
| 37 | - func_append dep_rpath " $flag" |
| 38 | + # We only want to hardcode in an rpath if it isn't in the |
| 39 | + # default dlsearch path. |
| 40 | + func_normal_abspath "$libdir" |
| 41 | + libdir_norm=$func_normal_abspath_result |
| 42 | + case " $sys_lib_dlsearch_path " in |
| 43 | + *" $libdir_norm "*) ;; |
| 44 | + *) eval flag=\"$hardcode_libdir_flag_spec\" |
| 45 | + func_append dep_rpath " $flag" |
| 46 | + ;; |
| 47 | + esac |
| 48 | fi |
| 49 | elif test -n "$runpath_var"; then |
| 50 | case "$perm_rpath " in |
| 51 | @@ -8790,8 +8798,16 @@ EOF |
| 52 | esac |
| 53 | fi |
| 54 | else |
| 55 | - eval flag=\"$hardcode_libdir_flag_spec\" |
| 56 | - func_append rpath " $flag" |
| 57 | + # We only want to hardcode in an rpath if it isn't in the |
| 58 | + # default dlsearch path. |
| 59 | + func_normal_abspath "$libdir" |
| 60 | + libdir_norm=$func_normal_abspath_result |
| 61 | + case " $sys_lib_dlsearch_path " in |
| 62 | + *" $libdir_norm "*) ;; |
| 63 | + *) eval flag=\"$hardcode_libdir_flag_spec\" |
| 64 | + rpath+=" $flag" |
| 65 | + ;; |
| 66 | + esac |
| 67 | fi |
| 68 | elif test -n "$runpath_var"; then |
| 69 | case "$perm_rpath " in |
| 70 | @@ -8841,8 +8857,14 @@ EOF |
| 71 | esac |
| 72 | fi |
| 73 | else |
| 74 | - eval flag=\"$hardcode_libdir_flag_spec\" |
| 75 | - func_append rpath " $flag" |
| 76 | + # We only want to hardcode in an rpath if it isn't in the |
| 77 | + # default dlsearch path. |
| 78 | + case " $sys_lib_dlsearch_path " in |
| 79 | + *" $libdir "*) ;; |
| 80 | + *) eval flag=\"$hardcode_libdir_flag_spec\" |
| 81 | + func_append rpath " $flag" |
| 82 | + ;; |
| 83 | + esac |
| 84 | fi |
| 85 | elif test -n "$runpath_var"; then |
| 86 | case "$finalize_perm_rpath " in |