<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 13, 2012 at 6:59 AM, Richard Purdie <span dir="ltr">&lt;<a href="mailto:richard.purdie@linuxfoundation.org" target="_blank">richard.purdie@linuxfoundation.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":24b">Signed-off-by: Richard Purdie &lt;<a href="mailto:richard.purdie@linuxfoundation.org">richard.purdie@linuxfoundation.org</a>&gt;<br>


---<br>
diff --git a/meta/recipes-extended/bash/bash-4.2/crossfix.patch b/meta/recipes-extended/bash/bash-4.2/crossfix.patch<br>
new file mode 100644<br>
index 0000000..f587c34<br>
--- a/dev/null<br>
+++ b/meta/recipes-extended/bash/bash-4.2/crossfix.patch<br>
@@ -0,0 +1,28 @@<br>
+Adding @CROSS_COMPILE@ to CFLAGS_FOR_BUILD causes errors like:<br>
+<br>
+mkbuiltins.o: In function `open&#39;:<br>
+/usr/include/x86_64-linux-gnu/bits/fcntl2.h:54: undefined reference to `xopen&#39;<br>
+mkbuiltins.o: In function `read&#39;:<br>
+/usr/include/x86_64-linux-gnu/bits/unistd.h:45: undefined reference to `xread&#39;<br>
+collect2: ld returned 1 exit status<br>
+<br>
+when compiling on a 64 bit x86 build system for a 32 bit x86 target since<br>
+config.h confuses the compiler about settings. By removing the option, config.h<br>
+isn&#39;t used and the compiler stops getting confused.<br>
+<br>
+Upstream-Status: Pending<br>
+RP 2012/11/13</div></blockquote></div><br>Relying on the target config.h to build a host tool could fail if the build and target environments differ greatly, which is likely why mkbuiltins.c has hardcoded defines assuming less about the host (just POSIX) based on the CROSS_COMPILE define. I don&#39;t think removing that is the best fix, personally.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">The reason for this failure has to do with a particular set of circumstances. A header in the bash source tree defines STRING() based on HAVE_STRINGIZE. This define overwrites the unistd.h define of the same macro. The unistd.h definitions of read() and open() wrap the call to the real functions to implement FORTIFY_SOURCES, and those wrappers use STRING() to do it. As a result, for any host that defaults to -DFORTIFY_SOURCES, STRING() returns &#39;x&#39; resulting in a concatenation rather than an assembly level rename of the function being called.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">If we add -DHAVE_STRINGIZE in the CROSS_COMPILE case, then STRING() will be defined to something useful, and therefore the FORTIFY_SOURCES wrappers don&#39;t get hosed.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">SeeĀ <a href="http://git.yoctoproject.org/cgit/cgit.cgi/meta-mentor/commit/?id=da0ff91">http://git.yoctoproject.org/cgit/cgit.cgi/meta-mentor/commit/?id=da0ff91</a> for an alternative fix which may be more likely to be accepted upstream.<br>

-- <br>Christopher Larson<br>
</div>