[oe-commits] [openembedded-core] 12/12: linux-yocto: Fix GCC 8 -Wrestrict error

git at git.openembedded.org git at git.openembedded.org
Wed Jun 6 23:32:01 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit e12103d3e0b08c18c17c874d7574b862ce394614
Author: Khem Raj <raj.khem at gmail.com>
AuthorDate: Wed Jun 6 14:37:28 2018 -0700

    linux-yocto: Fix GCC 8 -Wrestrict error
    
    pager.c: do not alias select() params
    
    Signed-off-by: Khem Raj <raj.khem at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 ...01-objtool-perf-Fix-GCC-8-Wrestrict-error.patch | 51 ++++++++++++++++++++++
 ...subcmd-pager.c-do-not-alias-select-params.patch | 43 ++++++++++++++++++
 meta/recipes-kernel/linux/linux-yocto_4.15.bb      |  2 +
 3 files changed, 96 insertions(+)

diff --git a/meta/recipes-kernel/linux/files/0001-objtool-perf-Fix-GCC-8-Wrestrict-error.patch b/meta/recipes-kernel/linux/files/0001-objtool-perf-Fix-GCC-8-Wrestrict-error.patch
new file mode 100644
index 0000000..6389da4
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/0001-objtool-perf-Fix-GCC-8-Wrestrict-error.patch
@@ -0,0 +1,51 @@
+From 233aa0194c7ca773866f3ec871f5d12d64ad44e1 Mon Sep 17 00:00:00 2001
+From: Josh Poimboeuf <jpoimboe at redhat.com>
+Date: Thu, 15 Mar 2018 22:11:54 -0500
+Subject: [PATCH] objtool, perf: Fix GCC 8 -Wrestrict error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+commit 854e55ad289ef8888e7991f0ada85d5846f5afb9 upstream.
+
+Starting with recent GCC 8 builds, objtool and perf fail to build with
+the following error:
+
+  ../str_error_r.c: In function ‘str_error_r’:
+  ../str_error_r.c:25:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 5 [-Werror=restrict]
+     snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
+
+The code seems harmless, but there's probably no benefit in printing the
+'buf' pointer in this situation anyway, so just remove it to make GCC
+happy.
+
+Reported-by: Laura Abbott <labbott at redhat.com>
+Signed-off-by: Josh Poimboeuf <jpoimboe at redhat.com>
+Tested-by: Laura Abbott <labbott at redhat.com>
+Cc: Adrian Hunter <adrian.hunter at intel.com>
+Cc: Jiri Olsa <jolsa at kernel.org>
+Cc: Namhyung Kim <namhyung at kernel.org>
+Cc: Wang Nan <wangnan0 at huawei.com>
+Link: http://lkml.kernel.org/r/20180316031154.juk2uncs7baffctp@treble
+Signed-off-by: Arnaldo Carvalho de Melo <acme at redhat.com>
+Cc: Fredrik Schön <fredrikschon at gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ tools/lib/str_error_r.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/lib/str_error_r.c b/tools/lib/str_error_r.c
+index d6d65537b0d9..6aad8308a0ac 100644
+--- a/tools/lib/str_error_r.c
++++ b/tools/lib/str_error_r.c
+@@ -22,6 +22,6 @@ char *str_error_r(int errnum, char *buf, size_t buflen)
+ {
+ 	int err = strerror_r(errnum, buf, buflen);
+ 	if (err)
+-		snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d", errnum, buf, buflen, err);
++		snprintf(buf, buflen, "INTERNAL ERROR: strerror_r(%d, [buf], %zd)=%d", errnum, buflen, err);
+ 	return buf;
+ }
+-- 
+2.17.0
+
diff --git a/meta/recipes-kernel/linux/files/0001-tools-lib-subcmd-pager.c-do-not-alias-select-params.patch b/meta/recipes-kernel/linux/files/0001-tools-lib-subcmd-pager.c-do-not-alias-select-params.patch
new file mode 100644
index 0000000..285b139
--- /dev/null
+++ b/meta/recipes-kernel/linux/files/0001-tools-lib-subcmd-pager.c-do-not-alias-select-params.patch
@@ -0,0 +1,43 @@
+From ad343a98e74e85aa91d844310e797f96fee6983b Mon Sep 17 00:00:00 2001
+From: Sergey Senozhatsky <sergey.senozhatsky at gmail.com>
+Date: Tue, 6 Feb 2018 15:37:52 -0800
+Subject: [PATCH] tools/lib/subcmd/pager.c: do not alias select() params
+
+Use a separate fd set for select()-s exception fds param to fix the
+following gcc warning:
+
+  pager.c:36:12: error: passing argument 2 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
+    select(1, &in, NULL, &in, NULL);
+              ^~~        ~~~
+
+Link: http://lkml.kernel.org/r/20180101105626.7168-1-sergey.senozhatsky@gmail.com
+Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky at gmail.com>
+Cc: Arnaldo Carvalho de Melo <acme at redhat.com>
+Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ tools/lib/subcmd/pager.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/tools/lib/subcmd/pager.c b/tools/lib/subcmd/pager.c
+index 5ba754d17952..9997a8805a82 100644
+--- a/tools/lib/subcmd/pager.c
++++ b/tools/lib/subcmd/pager.c
+@@ -30,10 +30,13 @@ static void pager_preexec(void)
+ 	 * have real input
+ 	 */
+ 	fd_set in;
++	fd_set exception;
+ 
+ 	FD_ZERO(&in);
++	FD_ZERO(&exception);
+ 	FD_SET(0, &in);
+-	select(1, &in, NULL, &in, NULL);
++	FD_SET(0, &exception);
++	select(1, &in, NULL, &exception, NULL);
+ 
+ 	setenv("LESS", "FRSX", 0);
+ }
+-- 
+2.17.0
+
diff --git a/meta/recipes-kernel/linux/linux-yocto_4.15.bb b/meta/recipes-kernel/linux/linux-yocto_4.15.bb
index 32e63a5..c05e042 100644
--- a/meta/recipes-kernel/linux/linux-yocto_4.15.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_4.15.bb
@@ -28,6 +28,8 @@ SRC_URI += "file://0001-powerpc-Disable-attribute-alias-warnings-from-gcc8.patch
             file://0002-powerpc-ptrace-Disable-array-bounds-warning-with-gcc.patch \
             file://0001-mips-Disable-attribute-alias-warnings.patch \
             file://0001-mips64-Disable-attribute-alias-warning.patch \
+            file://0001-objtool-perf-Fix-GCC-8-Wrestrict-error.patch \
+            file://0001-tools-lib-subcmd-pager.c-do-not-alias-select-params.patch \
 "
 
 LINUX_VERSION ?= "4.15.13"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list