<p dir="ltr">This looks fine</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Oct 3, 2016 7:17 AM, "Ross Burton" <<a href="mailto:ross.burton@intel.com">ross.burton@intel.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We don't autoreconf/libtoolize binutils as it has very strict requirements, so<br>
extend our patching of the stock libtool to include two fixes to RPATH<br>
behaviour, as part of the solution to ensure that native binaries don't have<br>
RPATHs pointing at the host system's /usr/lib.<br>
<br>
This generally doesn't cause a problem but it can cause some binaries (such as<br>
ar) to abort on startup:<br>
<br>
./x86_64-pokysdk-linux-ar: relocation error: /usr/lib/libc.so.6: symbol<br>
_dl_starting_up, version GLIBC_PRIVATE not defined in file ld-linux.so.2 with<br>
link time reference<br>
<br>
The situation here is that ar is built and as it links to the host libc/loader<br>
has an RPATH for /usr/lib. If tmp is wiped and then binutils is installed from<br>
sstate relocation occurs and the loader changed to the sysroot, but there<br>
remains a RPATH for /usr/lib. This means that the sysroot loader is used with<br>
the host libc, which can be incompatible. By telling libtool that the host<br>
library paths are in the default search path, and ensuring that all default<br>
search paths are not added as RPATHs by libtool, the result is a binary that<br>
links to what it should be linking to and nothing else.<br>
<br>
[ YOCTO #9287 ]<br>
<br>
Signed-off-by: Ross Burton <<a href="mailto:ross.burton@intel.com">ross.burton@intel.com</a>><br>
---<br>
meta/recipes-devtools/<wbr>binutils/binutils-2.27.inc | 1 +<br>
.../binutils/0014-libtool-<wbr>remove-rpath.patch | 100 +++++++++++++++++++++<br>
2 files changed, 101 insertions(+)<br>
create mode 100644 meta/recipes-devtools/<wbr>binutils/binutils/0014-<wbr>libtool-remove-rpath.patch<br>
<br>
diff --git a/meta/recipes-devtools/<wbr>binutils/binutils-2.27.inc b/meta/recipes-devtools/<wbr>binutils/binutils-2.27.inc<br>
index 9cc57fc..03b7bed 100644<br>
--- a/meta/recipes-devtools/<wbr>binutils/binutils-2.27.inc<br>
+++ b/meta/recipes-devtools/<wbr>binutils/binutils-2.27.inc<br>
@@ -33,6 +33,7 @@ SRC_URI = "\<br>
file://0011-Change-default-<wbr>emulation-for-mips64-linux.<wbr>patch \<br>
file://0012-Add-support-for-<wbr>Netlogic-XLP.patch \<br>
file://0013-fix-the-incorrect-<wbr>assembling-for-ppc-wait-<wbr>mnemonic.patch \<br>
+ file://0014-libtool-remove-<wbr>rpath.patch \<br>
"<br>
S = "${WORKDIR}/git"<br>
<br>
diff --git a/meta/recipes-devtools/<wbr>binutils/binutils/0014-<wbr>libtool-remove-rpath.patch b/meta/recipes-devtools/<wbr>binutils/binutils/0014-<wbr>libtool-remove-rpath.patch<br>
new file mode 100644<br>
index 0000000..d56948f<br>
--- /dev/null<br>
+++ b/meta/recipes-devtools/<wbr>binutils/binutils/0014-<wbr>libtool-remove-rpath.patch<br>
@@ -0,0 +1,100 @@<br>
+Apply these patches from our libtool patches as not only are redundant RPATHs a<br>
+waste of space but they can cause incorrect linking when native packages are<br>
+restored from sstate.<br>
+<br>
+fix-rpath.patch:<br>
+We don't want to add RPATHS which match default linker<br>
+search paths, they're a waste of space. This patch<br>
+filters libtools list and removes the ones we don't need.<br>
+<br>
+norm-rpath.patch:<br>
+Libtool may be passed link paths of the form "/usr/lib/../lib", which<br>
+fool its detection code into thinking it should be included as an<br>
+RPATH in the generated binary. Normalize before comparision.<br>
+<br>
+Upstream-Status: Inappropriate<br>
+Signed-off-by: Ross Burton <<a href="mailto:ross.burton@intel.com">ross.burton@intel.com</a>><br>
+<br>
+diff --git a/ltmain.sh b/ltmain.sh<br>
+index 683317c..860a16a 100644<br>
+--- a/ltmain.sh<br>
++++ b/ltmain.sh<br>
+@@ -8053,8 +8053,14 @@ EOF<br>
+ esac<br>
+ fi<br>
+ else<br>
+- eval flag=\"$hardcode_libdir_flag_<wbr>spec\"<br>
+- func_append dep_rpath " $flag"<br>
++ # We only want to hardcode in an rpath if it isn't in the<br>
++ # default dlsearch path.<br>
++ case " $sys_lib_dlsearch_path " in<br>
++ *" $libdir "*) ;;<br>
++ *) eval flag=\"$hardcode_libdir_flag_<wbr>spec\"<br>
++ func_append dep_rpath " $flag"<br>
++ ;;<br>
++ esac<br>
+ fi<br>
+ elif test -n "$runpath_var"; then<br>
+ case "$perm_rpath " in<br>
+@@ -8790,8 +8796,14 @@ EOF<br>
+ esac<br>
+ fi<br>
+ else<br>
+- eval flag=\"$hardcode_libdir_flag_<wbr>spec\"<br>
+- func_append rpath " $flag"<br>
++ # We only want to hardcode in an rpath if it isn't in the<br>
++ # default dlsearch path.<br>
++ case " $sys_lib_dlsearch_path " in<br>
++ *" $libdir "*) ;;<br>
++ *) eval flag=\"$hardcode_libdir_flag_<wbr>spec\"<br>
++ rpath+=" $flag"<br>
++ ;;<br>
++ esac<br>
+ fi<br>
+ elif test -n "$runpath_var"; then<br>
+ case "$perm_rpath " in<br>
+@@ -8841,8 +8853,14 @@ EOF<br>
+ esac<br>
+ fi<br>
+ else<br>
+- eval flag=\"$hardcode_libdir_flag_<wbr>spec\"<br>
+- func_append rpath " $flag"<br>
++ # We only want to hardcode in an rpath if it isn't in the<br>
++ # default dlsearch path.<br>
++ case " $sys_lib_dlsearch_path " in<br>
++ *" $libdir "*) ;;<br>
++ *) eval flag=\"$hardcode_libdir_flag_<wbr>spec\"<br>
++ func_append rpath " $flag"<br>
++ ;;<br>
++ esac<br>
+ fi<br>
+ elif test -n "$runpath_var"; then<br>
+ case "$finalize_perm_rpath " in<br>
+diff --git a/ltmain.sh b/ltmain.sh<br>
+index 683317c..860a16a 100644<br>
+--- a/ltmain.sh<br>
++++ b/ltmain.sh<br>
+@@ -8055,8 +8055,10 @@ EOF<br>
+ else<br>
+ # We only want to hardcode in an rpath if it isn't in the<br>
+ # default dlsearch path.<br>
++ func_normal_abspath "$libdir"<br>
++ libdir_norm=$func_normal_<wbr>abspath_result<br>
+ case " $sys_lib_dlsearch_path " in<br>
+- *" $libdir "*) ;;<br>
++ *" $libdir_norm "*) ;;<br>
+ *) eval flag=\"$hardcode_libdir_flag_<wbr>spec\"<br>
+ func_append dep_rpath " $flag"<br>
+ ;;<br>
+@@ -8798,8 +8800,10 @@ EOF<br>
+ else<br>
+ # We only want to hardcode in an rpath if it isn't in the<br>
+ # default dlsearch path.<br>
++ func_normal_abspath "$libdir"<br>
++ libdir_norm=$func_normal_<wbr>abspath_result<br>
+ case " $sys_lib_dlsearch_path " in<br>
+- *" $libdir "*) ;;<br>
++ *" $libdir_norm "*) ;;<br>
+ *) eval flag=\"$hardcode_libdir_flag_<wbr>spec\"<br>
+ rpath+=" $flag"<br>
+ ;;<br>
--<br>
2.8.1<br>
<br>
--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
</blockquote></div></div>