summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHe Zhe <zhe.he@windriver.com>2018-11-21 22:06:05 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-13 16:32:21 +0000
commit3bf7cd71824edf71400fb046f04978ef6fa83a31 (patch)
tree3d829f891a9eba6a4d2427bd5325eff99b31baa5
parentbd220d576d3bec52fd97ebc7ea370c05d9347ea3 (diff)
downloadpoky-3bf7cd71824edf71400fb046f04978ef6fa83a31.tar.gz
linux-libc-headers: Fix build failure by using fixed temporary file instead of pipe
This is a workaround for the following possible build failure. *** Compiler lacks asm-goto support.. Stop. When building linux-libc-headers we need to use binutils on build machine. binutils v2.31 introduces a bug that could cause scripts/gcc-goto.sh to fail when running in an environment where /tmp is rarely used, e.g. in docker. (From OE-Core rev: 2322dc4f414da0281fdaffa7bc2205fb82a63d12) Signed-off-by: He Zhe <zhe.he@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch70
-rw-r--r--meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.18.bb4
2 files changed, 74 insertions, 0 deletions
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
new file mode 100644
index 0000000000..0d8fa80939
--- /dev/null
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch
@@ -0,0 +1,70 @@
1From 3bbea65e11918f8753e8006a2198b999cdb0af58 Mon Sep 17 00:00:00 2001
2From: He Zhe <zhe.he@windriver.com>
3Date: Wed, 21 Nov 2018 15:12:43 +0800
4Subject: [PATCH] scripts: Use fixed temporary file instead of pipe for
5 here-doc
6
7There was a bug of "as" in binutils that when it checks if the input file and
8output file are the same one, it would not check if they are on the same block
9device. The check is introduced by the following commit in v2.31.
10
11https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=
1267f846b59b32f3d704c601669409c2584383fea9
13
14The here-doc usage in this script creates temporary file in /tmp. When we run in
15an environment where /tmp has rarely been used, the newly created temporary file
16may have a very low inode number. If the inode number was 6 which is the same as
17/dev/null, the as would wrongly think the input file and the output file are the
18same and report the following error.
19
20*** Compiler lacks asm-goto support.. Stop.
21
22One observed case happened in docker where the /tmp could be so rarely used that
23very low number inode may be allocated and triggers the error.
24
25The fix below for the bug only exists on the master branch of binutils so far
26and has not been released from upstream. As the convict is introduced since
27v2.31, only v2.31 is affected.
28
29https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=
302a50366ded329bfb39d387253450c9d5302c3503
31
32When building linux-libc-headers we need to use "as" in binutils which does not
33contain the fix for the moment. To work around the error, we create a fixed
34temporary file to contain the program being tested.
35
36This patch also removes ">/dev/null 2>&1" so we will have more direct error
37information in case something else wrong happened.
38
39Upstream-Status: Inappropriate [A work around for binutils v2.31]
40
41Signed-off-by: He Zhe <zhe.he@windriver.com>
42---
43 scripts/gcc-goto.sh | 7 ++++++-
44 1 file changed, 6 insertions(+), 1 deletion(-)
45
46diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh
47index 083c526..0aaf1b4 100755
48--- a/scripts/gcc-goto.sh
49+++ b/scripts/gcc-goto.sh
50@@ -3,7 +3,9 @@
51 # Test for gcc 'asm goto' support
52 # Copyright (C) 2010, Jason Baron <jbaron@redhat.com>
53
54-cat << "END" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y"
55+TMPFILE=`mktemp -p .`
56+
57+cat << "END" > ${TMPFILE}
58 int main(void)
59 {
60 #if defined(__arm__) || defined(__aarch64__)
61@@ -20,3 +22,6 @@ entry:
62 return 0;
63 }
64 END
65+
66+$@ -x c ${TMPFILE} -c -o /dev/null && echo "y"
67+rm ${TMPFILE}
68--
692.7.4
70
diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.18.bb b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.18.bb
index eb7bee72b0..00420aa6f7 100644
--- a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.18.bb
+++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.18.bb
@@ -9,5 +9,9 @@ SRC_URI_append_libc-musl = "\
9 file://0001-include-linux-stddef.h-in-swab.h-uapi-header.patch \ 9 file://0001-include-linux-stddef.h-in-swab.h-uapi-header.patch \
10 " 10 "
11 11
12SRC_URI_append = "\
13 file://0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch \
14"
15
12SRC_URI[md5sum] = "bee5fe53ee1c3142b8f0c12c0d3348f9" 16SRC_URI[md5sum] = "bee5fe53ee1c3142b8f0c12c0d3348f9"
13SRC_URI[sha256sum] = "19d8bcf49ef530cd4e364a45b4a22fa70714b70349c8100e7308488e26f1eaf1" 17SRC_URI[sha256sum] = "19d8bcf49ef530cd4e364a45b4a22fa70714b70349c8100e7308488e26f1eaf1"