scripts: Use fixed temporary file instead of pipe for here-doc
PATCH 1/1 scripts: Use fixed temporary file instead of pipe for here-doc
From: He Zhe <[email protected]>
A workaround for possible "*** Compiler lacks asm-goto support.. Stop." linux-libc-headers is built by gcc on build machine, which could not contain the fix.
--- ...-fixed-temporary-file-instead-of-pipe-for.patch | 60 ++++++++++++++++++++++ .../linux-libc-headers/linux-libc-headers_4.18.bb | 4 ++ 2 files changed, 64 insertions(+) create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch
meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch new file +60 -0
@@ -0,0 +1,60 @@ +From 3bbea65e11918f8753e8006a2198b999cdb0af58 Mon Sep 17 00:00:00 2001 +From: He Zhe <[email protected]> +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 gcc 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 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, gcc would wrongly think the input file and the output file are the +same and report the following error. + +*** Compiler lacks asm-goto support.. Stop. + +The fix below for the bug has not been released from upstream. Since there has +not been gcc-cross when building linux-libc-headers, we have to use build +machine gcc which could not contain the fix for the moment. To work around the +error, we create a fixed temporary file to contain the program being tested. + +https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h= +2a50366ded329bfb39d387253450c9d5302c3503 + +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 [Just a work around for old gcc] + +Signed-off-by: He Zhe <[email protected]> +--- + 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 <[email protected]> + +-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 +
meta/recipes-kernel/linux-libc-headers/linux-libc-headers_4.18.bb +4 -0
@@ -9,5 +9,9 @@ SRC_URI_append_libc-musl = "\ file://0001-include-linux-stddef.h-in-swab.h-uapi-header.patch \ " +SRC_URI_append = "\ + file://0001-scripts-Use-fixed-temporary-file-instead-of-pipe-for.patch \ +" + SRC_URI[md5sum] = "bee5fe53ee1c3142b8f0c12c0d3348f9" SRC_URI[sha256sum] = "19d8bcf49ef530cd4e364a45b4a22fa70714b70349c8100e7308488e26f1eaf1"
Signature · 1 line
2.7.4
Quoted 9 lines · On Wed, 2018-11-21 at 17:39 +0800, [email protected] wrote:
From: He Zhe <[email protected]>
A workaround for possible "*** Compiler lacks asm-goto support.. Stop."
linux-libc-headers is built by gcc on build machine, which could not contain the
fix.Signed-off-by He Zhe <[email protected]>
Quoted 8 lines
--- ...-fixed-temporary-file-instead-of-pipe-for.patch | 60 ++++++++++++++++++++++ .../linux-libc-headers/linux-libc-headers_4.18.bb | 4 ++ 2 files changed, 64 insertions(+) create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe- for.patch
How old is an "old gcc"?
If this isn't going upstream, I'm not sure we want to take and carry this either. Unless this is a gcc people would commonly run into I'm tempted not to take this.
Also, your patch subject is wrong as this does not change our scripts directory.
Cheers,
Richard
Quoted 18 lines · Richard Purdie
Quoted 9 lines · On Wed, 2018-11-21 at 17:39 +0800, [email protected] wrote:
From: He Zhe <[email protected]>
A workaround for possible "*** Compiler lacks asm-goto support.. Stop."
linux-libc-headers is built by gcc on build machine, which could not contain the
fix.Signed-off-by He Zhe <[email protected]>Quoted 8 lines
--- ...-fixed-temporary-file-instead-of-pipe-for.patch | 60 ++++++++++++++++++++++ .../linux-libc-headers/linux-libc-headers_4.18.bb | 4 ++ 2 files changed, 64 insertions(+) create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of-pipe- for.patch
Quoted 1 line
How old is an "old gcc"?
I put the full explanation in the commit log of the patch inside.
The fix below for the bug has not been released from upstream. Since there has not been gcc-cross when building linux-libc-headers, we have to use build machine gcc which could not contain the fix for the moment. To work around the error, we create a fixed temporary file to contain the program being tested.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=2a50366ded329bfb39d387253450c9d5302c3503
Quoted 4 lines
If this isn't going upstream, I'm not sure we want to take and carry this either. Unless this is a gcc people would commonly run into I'm tempted not to take this.
This is a gcc issue, but the fix would not quickly goto versions being used by users. So this patch is used as a workaround to prevent the failure.
To be specific, we encountered this in docker where the /tmp could be rarely used that very low number inode may be allocated and triggers the error.
Quoted 3 lines
Also, your patch subject is wrong as this does not change our scripts directory.
If this is OK, I'll send v2 to change the subject.
Thanks,
Zhe
Quoted 8 lines
Cheers,
Richard
Quoted 23 lines · He Zhe
Quoted 21 lines · Richard Purdie
Quoted 19 lines · On Wed, 2018-11-21 at 17:39 +0800, [email protected] wrote:
From: He Zhe <[email protected]>
A workaround for possible "*** Compiler lacks asm-goto support.. Stop."
linux-libc-headers is built by gcc on build machine, which could not
contain the
fix.Signed-off-by He Zhe <[email protected]>--- ...-fixed-temporary-file-instead-of-pipe-for.patch | 60 ++++++++++++++++++++++ .../linux-libc-headers/linux-libc-headers_4.18.bb | 4 ++ 2 files changed, 64 insertions(+) create mode 100644 meta/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-scripts-Use-fixed-temporary-file-instead-of- pipe-
for.patch
Quoted 3 lines
Quoted 1 line
How old is an "old gcc"?
I put the full explanation in the commit log of the patch inside.
No, you did not. I went and looked at the link (which I had to un-line wrap) to understand this and the problem is in binutils in the assembler (as), *not* gcc. Its also not just some "old gcc" but any current released version of binutils which is quite different.
Please improve the commit message to reference binutils, not gcc, mention the current version of bintuils (2.31) and that it and all previous versions have the bug.
Also please set the Upstream-Status correctly.
Quoted 19 lines
The fix below for the bug has not been released from upstream. Since there has
not been gcc-cross when building linux-libc-headers, we have to use build
machine gcc which could not contain the fix for the moment. To work around the
error, we create a fixed temporary file to contain the program being tested.https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=
2a50366ded329bfb39d387253450c9d5302c3503Quoted 6 lines
If this isn't going upstream, I'm not sure we want to take and carry
this either. Unless this is a gcc people would commonly run into I'm
tempted not to take this.
Quoted 8 lines
This is a gcc issue, but the fix would not quickly goto versions being used
by users. So this patch is used as a workaround to prevent the failure.To be specific, we encountered this in docker where the /tmp could be rarely used that very low number inode may be allocated and triggers the error.
That should also be mentioned in the commit message as that does put it in a different light.
Quoted 6 lines
Quoted 4 lines
Also, your patch subject is wrong as this does not change our scripts
directory.If this is OK, I'll send v2 to change the subject.
Along with the other changes please.
Thanks,
Richard