From 0d836013e43f29cb7d4a1f8bb9ef04dd8d9132df Mon Sep 17 00:00:00 2001 From: He Zhe Date: Mon, 7 Jan 2019 09:33:45 -0500 Subject: linux-libc-headers: Fix build failure with fixed input and output files instead of pipe This is an amendment for 2322dc4 "linux-libc-headers: Fix build failure by using fixed temporary file instead of pipe" which moves just the temporary input file from /tmp to build directory. But the build directory may not in the same file system with the output file, /dev/null, either and thus make it possible to trigger that bug, 67f846b, in binutil v2.31. This patch puts both the input and output files into build directory for good. Signed-off-by: He Zhe Signed-off-by: Bruce Ashfield Signed-off-by: Richard Purdie --- ...-fixed-input-and-output-files-instead-of-.patch | 68 +++++++++++++++++++++ ...-fixed-temporary-file-instead-of-pipe-for.patch | 70 ---------------------- .../linux-libc-headers/linux-libc-headers_4.18.bb | 2 +- 3 files changed, 69 insertions(+), 71 deletions(-) create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch delete mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch (limited to 'meta/recipes-kernel') diff --git a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch new file mode 100644 index 0000000000..9ba1c076e8 --- /dev/null +++ b/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch @@ -0,0 +1,68 @@ +From 694eba7bb974f6b8bd308804cb24350150108b2b Mon Sep 17 00:00:00 2001 +From: He Zhe +Date: Wed, 21 Nov 2018 15:12:43 +0800 +Subject: [PATCH] scripts: Use fixed input and output files instead of pipe for + here-doc + +There was a bug of "as" in binutils that when it checks if the input file and +output file are the same one, it would not check if they are on the same block +device. The check is introduced by the following commit in v2.31. + +https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h= +67f846b59b32f3d704c601669409c2584383fea9 + +The here-doc usage in this script creates temporary file in /tmp. When we run in +an environment where /tmp has rarely been used, the newly created temporary file +may have a very low inode number. If the inode number was 6 which is the same as +/dev/null, the as would wrongly think the input file and the output file are the +same and report the following error. + +*** Compiler lacks asm-goto support.. Stop. + +One observed case happened in docker where the /tmp could be so rarely used that +very low number inode may be allocated and triggers the error. + +The fix below for the bug only exists on the master branch of binutils so far +and has not been released from upstream. As the convict is introduced since +v2.31, only v2.31 is affected. + +https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h= +2a50366ded329bfb39d387253450c9d5302c3503 + +When building linux-libc-headers we need to use "as" in binutils which does not +contain the fix for the moment. To work around the error, we create a fixed +temporary file to contain the program being tested. + +This patch also removes ">/dev/null 2>&1" so we will have more direct error +information in case something else wrong happened. + +Upstream-Status: Inappropriate [A work around for binutils v2.31] + +Signed-off-by: He Zhe +--- + scripts/gcc-goto.sh | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh +index 083c526..8dfac55 100755 +--- a/scripts/gcc-goto.sh ++++ b/scripts/gcc-goto.sh +@@ -3,7 +3,7 @@ + # Test for gcc 'asm goto' support + # Copyright (C) 2010, Jason Baron + +-cat << "END" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" ++cat << "END" > ./input + int main(void) + { + #if defined(__arm__) || defined(__aarch64__) +@@ -20,3 +20,6 @@ entry: + return 0; + } + END ++ ++$@ -x c ./input -c -o ./output && echo "y" ++rm ./input ./output +-- +2.7.4 + 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 deleted file mode 100644 index 0d8fa80939..0000000000 --- a/meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 3bbea65e11918f8753e8006a2198b999cdb0af58 Mon Sep 17 00:00:00 2001 -From: He Zhe -Date: Wed, 21 Nov 2018 15:12:43 +0800 -Subject: [PATCH] scripts: Use fixed temporary file instead of pipe for - here-doc - -There was a bug of "as" in binutils that when it checks if the input file and -output file are the same one, it would not check if they are on the same block -device. The check is introduced by the following commit in v2.31. - -https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h= -67f846b59b32f3d704c601669409c2584383fea9 - -The here-doc usage in this script creates temporary file in /tmp. When we run in -an environment where /tmp has rarely been used, the newly created temporary file -may have a very low inode number. If the inode number was 6 which is the same as -/dev/null, the as would wrongly think the input file and the output file are the -same and report the following error. - -*** Compiler lacks asm-goto support.. Stop. - -One observed case happened in docker where the /tmp could be so rarely used that -very low number inode may be allocated and triggers the error. - -The fix below for the bug only exists on the master branch of binutils so far -and has not been released from upstream. As the convict is introduced since -v2.31, only v2.31 is affected. - -https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h= -2a50366ded329bfb39d387253450c9d5302c3503 - -When building linux-libc-headers we need to use "as" in binutils which does not -contain the fix for the moment. To work around the error, we create a fixed -temporary file to contain the program being tested. - -This patch also removes ">/dev/null 2>&1" so we will have more direct error -information in case something else wrong happened. - -Upstream-Status: Inappropriate [A work around for binutils v2.31] - -Signed-off-by: He Zhe ---- - scripts/gcc-goto.sh | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/scripts/gcc-goto.sh b/scripts/gcc-goto.sh -index 083c526..0aaf1b4 100755 ---- a/scripts/gcc-goto.sh -+++ b/scripts/gcc-goto.sh -@@ -3,7 +3,9 @@ - # Test for gcc 'asm goto' support - # Copyright (C) 2010, Jason Baron - --cat << "END" | $@ -x c - -c -o /dev/null >/dev/null 2>&1 && echo "y" -+TMPFILE=`mktemp -p .` -+ -+cat << "END" > ${TMPFILE} - int main(void) - { - #if defined(__arm__) || defined(__aarch64__) -@@ -20,3 +22,6 @@ entry: - return 0; - } - END -+ -+$@ -x c ${TMPFILE} -c -o /dev/null && echo "y" -+rm ${TMPFILE} --- -2.7.4 - 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 00420aa6f7..229a0027d7 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 @@ -10,7 +10,7 @@ SRC_URI_append_libc-musl = "\ " SRC_URI_append = "\ - file://0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch \ + file://0001-scripts-Use-fixed-input-and-output-files-instead-of-.patch \ " SRC_URI[md5sum] = "bee5fe53ee1c3142b8f0c12c0d3348f9" -- cgit 1.2.3-korg