<div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Nov 21, 2018 at 9:06 AM <<a href="mailto:zhe.he@windriver.com" target="_blank">zhe.he@windriver.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: He Zhe <<a href="mailto:zhe.he@windriver.com" target="_blank">zhe.he@windriver.com</a>><br>
<br>
This is a workaround for the following possible build failure.<br>
<br>
*** Compiler lacks asm-goto support.. Stop.<br>
<br>
When building linux-libc-headers we need to use binutils on build machine.<br>
binutils v2.31 introduces a bug that could cause scripts/gcc-goto.sh to fail<br>
when running in an environment where /tmp is rarely used, e.g. in docker.<br>
<br>
Signed-off-by: He Zhe <<a href="mailto:zhe.he@windriver.com" target="_blank">zhe.he@windriver.com</a>><br>
---<br>
v2: Improve commit log<br>
v3: Shorten long lines as patchwork suggested<br>
v4: Shorten subject line...<br>
<br>
...-fixed-temporary-file-instead-of-pipe-for.patch | 70 ++++++++++++++++++++++<br>
.../linux-libc-headers/<a href="http://linux-libc-headers_4.18.bb" rel="noreferrer" target="_blank">linux-libc-headers_4.18.bb</a> | 4 ++<br>
2 files changed, 74 insertions(+)<br>
create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch<br>
<br>
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch<br>
new file mode 100644<br>
index 0000000..0d8fa80<br>
--- /dev/null<br>
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch<br>
@@ -0,0 +1,70 @@<br>
+From 3bbea65e11918f8753e8006a2198b999cdb0af58 Mon Sep 17 00:00:00 2001<br>
+From: He Zhe <<a href="mailto:zhe.he@windriver.com" target="_blank">zhe.he@windriver.com</a>><br>
+Date: Wed, 21 Nov 2018 15:12:43 +0800<br>
+Subject: [PATCH] scripts: Use fixed temporary file instead of pipe for<br>
+ here-doc<br>
+<br>
+There was a bug of "as" in binutils that when it checks if the input file and<br>
+output file are the same one, it would not check if they are on the same block<br>
+device. The check is introduced by the following commit in v2.31.<br>
+<br>
+<a href="https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=+67f846b59b32f3d704c601669409c2584383fea9" rel="noreferrer" target="_blank">https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=<br>
+67f846b59b32f3d704c601669409c2584383fea9</a><br>
</blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Can you double check the links to the upstream changes ? They didn't work</div><div class="gmail_default" style="font-size:small">for me.</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">+<br>
+The here-doc usage in this script creates temporary file in /tmp. When we run in<br>
+an environment where /tmp has rarely been used, the newly created temporary file<br>
+may have a very low inode number. If the inode number was 6 which is the same as<br>
+/dev/null, the as would wrongly think the input file and the output file are the<br>
+same and report the following error.<br>
+<br>
+*** Compiler lacks asm-goto support.. Stop.<br>
+<br>
+One observed case happened in docker where the /tmp could be so rarely used that<br>
+very low number inode may be allocated and triggers the error.<br>
+<br>
+The fix below for the bug only exists on the master branch of binutils so far<br>
+and has not been released from upstream. As the convict is introduced since<br>
+v2.31, only v2.31 is affected.<br>
+<br>
+<a href="https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=+2a50366ded329bfb39d387253450c9d5302c3503" rel="noreferrer" target="_blank">https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=<br>
+2a50366ded329bfb39d387253450c9d5302c3503</a><br>
+<br>
+When building linux-libc-headers we need to use "as" in binutils which does not<br>
+contain the fix for the moment. To work around the error, we create a fixed<br>
+temporary file to contain the program being tested.<br>
+<br>
+This patch also removes ">/dev/null 2>&1" so we will have more direct error<br>
+information in case something else wrong happened.<br>
+<br>
+Upstream-Status: Inappropriate [A work around for binutils v2.31]<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">It would be nice to have a way to test for the host binutils version, since without it</div><div class="gmail_default" style="font-size:small">we have no way to know when we can stop carrying this change. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Not that the change is all that complex or should cause any problems, it is just</div><div class="gmail_default" style="font-size:small">very open ended without a check.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Did you look into any conditional way to test the binutils in the recipe and only</div><div class="gmail_default" style="font-size:small">patch if required ?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Bruce</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+Signed-off-by: He Zhe <<a href="mailto:zhe.he@windriver.com" target="_blank">zhe.he@windriver.com</a>><br>
+---<br>
+ scripts/gcc-goto.sh | 7 ++++++-<br>
+ 1 file changed, 6 insertions(+), 1 deletion(-)<br>
+<br>
+diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh<br>
+index 083c526..0aaf1b4 100755<br>
+--- a/scripts/gcc-goto.sh<br>
++++ b/scripts/gcc-goto.sh<br>
+@@ -3,7 +3,9 @@<br>
+ # Test for gcc 'asm goto' support<br>
+ # Copyright (C) 2010, Jason Baron <<a href="mailto:jbaron@redhat.com" target="_blank">jbaron@redhat.com</a>><br>
+ <br>
+-cat << "END" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y"<br>
++TMPFILE=`mktemp -p .`<br>
++<br>
++cat << "END" > ${TMPFILE}<br>
+ int main(void)<br>
+ {<br>
+ #if defined(__arm__) || defined(__aarch64__)<br>
+@@ -20,3 +22,6 @@ entry:<br>
+ return 0;<br>
+ }<br>
+ END<br>
++<br>
++$@ -x c ${TMPFILE} -c -o /dev/null && echo "y"<br>
++rm ${TMPFILE}<br>
+-- <br>
+2.7.4<br>
+<br>
diff --git a/meta/recipes-kernel/linux-libc-headers/<a href="http://linux-libc-headers_4.18.bb" rel="noreferrer" target="_blank">linux-libc-headers_4.18.bb</a> b/meta/recipes-kernel/linux-libc-headers/<a href="http://linux-libc-headers_4.18.bb" rel="noreferrer" target="_blank">linux-libc-headers_4.18.bb</a><br>
index eb7bee7..00420aa 100644<br>
--- a/meta/recipes-kernel/linux-libc-headers/<a href="http://linux-libc-headers_4.18.bb" rel="noreferrer" target="_blank">linux-libc-headers_4.18.bb</a><br>
+++ b/meta/recipes-kernel/linux-libc-headers/<a href="http://linux-libc-headers_4.18.bb" rel="noreferrer" target="_blank">linux-libc-headers_4.18.bb</a><br>
@@ -9,5 +9,9 @@ SRC_URI_append_libc-musl = "\<br>
file://0001-include-linux-stddef.h-in-swab.h-uapi-header.patch \<br>
"<br>
<br>
+SRC_URI_append = "\<br>
+ file://0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch \<br>
+"<br>
+<br>
SRC_URI[md5sum] = "bee5fe53ee1c3142b8f0c12c0d3348f9"<br>
SRC_URI[sha256sum] = "19d8bcf49ef530cd4e364a45b4a22fa70714b70349c8100e7308488e26f1eaf1"<br>
-- <br>
2.7.4<br>
<br>
-- <br>
_______________________________________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_7788677128731203657gmail_signature" data-smartmail="gmail_signature">- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end<br>- "Use the force Harry" - Gandalf, Star Trek II<br><br></div></div>