* [PATCH] powerpc/Makefile: fix build failure by disabling attribute-alias warning
@ 2018-05-28 14:17 Christophe Leroy
2018-05-28 14:37 ` Segher Boessenkool
2018-05-28 14:39 ` Christophe Leroy
0 siblings, 2 replies; 6+ messages in thread
From: Christophe Leroy @ 2018-05-28 14:17 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, segher
Cc: linux-kernel, linuxppc-dev
Latest GCC version emit many warnings similar to the following one.
As arch/powerpc code is built with -Werror, this breaks build with
GCC 8.1
This patch inhibits that warning
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
arch/powerpc/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 26ccd0b91512..d6c557530ce8 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -145,6 +145,8 @@ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD)
CFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata)
+CFLAGS-y += $(call cc-option,-Wno-attribute-alias)
+
ifeq ($(CONFIG_PPC_BOOK3S_64),y)
ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
--
2.13.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/Makefile: fix build failure by disabling attribute-alias warning
2018-05-28 14:17 [PATCH] powerpc/Makefile: fix build failure by disabling attribute-alias warning Christophe Leroy
@ 2018-05-28 14:37 ` Segher Boessenkool
2018-05-28 14:56 ` Christophe LEROY
2018-05-28 14:39 ` Christophe Leroy
1 sibling, 1 reply; 6+ messages in thread
From: Segher Boessenkool @ 2018-05-28 14:37 UTC (permalink / raw)
To: Christophe Leroy
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
linux-kernel, linuxppc-dev
On Mon, May 28, 2018 at 02:17:49PM +0000, Christophe Leroy wrote:
> Latest GCC version emit many warnings similar to the following one.
You didn't actually show an example?
This warning should detect serious problems, so don't disable it without
first investigating please.
What do you call "latest version", btw? Trunk, aka 9.0? Or the most
advanced release, 8.1? Or the latest release (which also is 8.1 :-) )
Segher
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/Makefile: fix build failure by disabling attribute-alias warning
2018-05-28 14:17 [PATCH] powerpc/Makefile: fix build failure by disabling attribute-alias warning Christophe Leroy
2018-05-28 14:37 ` Segher Boessenkool
@ 2018-05-28 14:39 ` Christophe Leroy
2018-05-28 15:07 ` Segher Boessenkool
1 sibling, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2018-05-28 14:39 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, segher
Cc: linuxppc-dev, linux-kernel
On 05/28/2018 02:17 PM, Christophe Leroy wrote:
> Latest GCC version emit many warnings similar to the following one.
Oops, forgot to include the failure text:
In file included from arch/powerpc/kernel/syscalls.c:24:
./include/linux/syscalls.h:233:18: warning: 'sys_mmap2' alias between
functions of incompatible types 'long int(long unsigned int, size_t,
long unsigned int, long unsigned int, long unsigned int, long
unsigned int)' {aka 'long int(long unsigned int, unsigned int, long
unsigned int, long unsigned int, long unsigned int, long unsigned
int)'} and 'long int(long int, long int, long int, long int, long
int, long int)' [-Wattribute-alias]
asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
^~~
./include/linux/syscalls.h:222:2: note: in expansion of macro
'__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:216:36: note: in expansion of macro
'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name,
__VA_ARGS__)
^~~~~~~~~~~~~~~
arch/powerpc/kernel/syscalls.c:65:1: note: in expansion of macro
'SYSCALL_DEFINE6'
SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
^~~~~~~~~~~~~~~
./include/linux/syscalls.h:238:18: note: aliased declaration here
asmlinkage long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
^~~~~~~~
./include/linux/syscalls.h:222:2: note: in expansion of macro
'__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:216:36: note: in expansion of macro
'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name,
__VA_ARGS__)
^~~~~~~~~~~~~~~
arch/powerpc/kernel/syscalls.c:65:1: note: in expansion of macro
'SYSCALL_DEFINE6'
SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
^~~~~~~~~~~~~~~
./include/linux/syscalls.h:233:18: warning: 'sys_mmap' alias between
functions of incompatible types 'long int(long unsigned int, size_t,
long unsigned int, long unsigned int, long unsigned int, off_t)' {aka
'long int(long unsigned int, unsigned int, long unsigned int, long
unsigned int, long unsigned int, long int)'} and 'long int(long int,
long int, long int, long int, long int, long int)' [-Wattribute-alias]
asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
^~~
./include/linux/syscalls.h:222:2: note: in expansion of macro
'__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:216:36: note: in expansion of macro
'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name,
__VA_ARGS__)
^~~~~~~~~~~~~~~
arch/powerpc/kernel/syscalls.c:72:1: note: in expansion of macro
'SYSCALL_DEFINE6'
SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len,
^~~~~~~~~~~~~~~
./include/linux/syscalls.h:238:18: note: aliased declaration here
asmlinkage long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
^~~~~~~~
./include/linux/syscalls.h:222:2: note: in expansion of macro
'__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:216:36: note: in expansion of macro
'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name,
__VA_ARGS__)
^~~~~~~~~~~~~~~
arch/powerpc/kernel/syscalls.c:72:1: note: in expansion of macro
'SYSCALL_DEFINE6'
SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len,
^~~~~~~~~~~~~~~
CC arch/powerpc/kernel/irq.o
CC arch/powerpc/kernel/align.o
CC arch/powerpc/kernel/signal_32.o
In file included from arch/powerpc/kernel/signal_32.c:29:
./include/linux/syscalls.h:233:18: warning: 'sys_swapcontext' alias
between functions of incompatible types 'long int(struct ucontext *,
struct ucontext *, long int)' and 'long int(long int, long int, long
int)' [-Wattribute-alias]
asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
^~~
./include/linux/syscalls.h:222:2: note: in expansion of macro
'__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:213:36: note: in expansion of macro
'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name,
__VA_ARGS__)
^~~~~~~~~~~~~~~
arch/powerpc/kernel/signal_32.c:1044:1: note: in expansion of macro
'SYSCALL_DEFINE3'
SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
^~~~~~~~~~~~~~~
./include/linux/syscalls.h:238:18: note: aliased declaration here
asmlinkage long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
^~~~~~~~
./include/linux/syscalls.h:222:2: note: in expansion of macro
'__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:213:36: note: in expansion of macro
'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name,
__VA_ARGS__)
^~~~~~~~~~~~~~~
arch/powerpc/kernel/signal_32.c:1044:1: note: in expansion of macro
'SYSCALL_DEFINE3'
SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx,
^~~~~~~~~~~~~~~
./include/linux/syscalls.h:233:18: warning: 'sys_debug_setcontext' alias
between functions of incompatible types 'long int(struct ucontext *,
int, struct sig_dbg_op *)' and 'long int(long int, long int, long
int)' [-Wattribute-alias]
asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
^~~
./include/linux/syscalls.h:222:2: note: in expansion of macro
'__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:213:36: note: in expansion of macro
'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name,
__VA_ARGS__)
^~~~~~~~~~~~~~~
arch/powerpc/kernel/signal_32.c:1232:1: note: in expansion of macro
'SYSCALL_DEFINE3'
SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx,
^~~~~~~~~~~~~~~
./include/linux/syscalls.h:238:18: note: aliased declaration here
asmlinkage long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
^~~~~~~~
./include/linux/syscalls.h:222:2: note: in expansion of macro
'__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:213:36: note: in expansion of macro
'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name,
__VA_ARGS__)
^~~~~~~~~~~~~~~
arch/powerpc/kernel/signal_32.c:1232:1: note: in expansion of macro
'SYSCALL_DEFINE3'
SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx,
^~~~~~~~~~~~~~~
Christophe
>
> As arch/powerpc code is built with -Werror, this breaks build with
> GCC 8.1
>
> This patch inhibits that warning
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
> arch/powerpc/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 26ccd0b91512..d6c557530ce8 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -145,6 +145,8 @@ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
> CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD)
> CFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata)
>
> +CFLAGS-y += $(call cc-option,-Wno-attribute-alias)
> +
> ifeq ($(CONFIG_PPC_BOOK3S_64),y)
> ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
> CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/Makefile: fix build failure by disabling attribute-alias warning
2018-05-28 14:37 ` Segher Boessenkool
@ 2018-05-28 14:56 ` Christophe LEROY
0 siblings, 0 replies; 6+ messages in thread
From: Christophe LEROY @ 2018-05-28 14:56 UTC (permalink / raw)
To: Segher Boessenkool
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
linux-kernel, linuxppc-dev
Le 28/05/2018 à 16:37, Segher Boessenkool a écrit :
> On Mon, May 28, 2018 at 02:17:49PM +0000, Christophe Leroy wrote:
>> Latest GCC version emit many warnings similar to the following one.
>
> You didn't actually show an example?
Yes I forgot:
In file included from arch/powerpc/kernel/syscalls.c:24:
./include/linux/syscalls.h:233:18: warning: 'sys_mmap2' alias between
functions of incompatible types 'long int(long unsigned int, size_t,
long unsigned int, long unsigned int, long unsigned int, long
unsigned int)' {aka 'long int(long unsigned int, unsigned int, long
unsigned int, long unsigned int, long unsigned int, long unsigned
int)'} and 'long int(long int, long int, long int, long int, long
int, long int)' [-Wattribute-alias]
asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
^~~
./include/linux/syscalls.h:222:2: note: in expansion of macro
'__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:216:36: note: in expansion of macro
'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name,
__VA_ARGS__)
^~~~~~~~~~~~~~~
arch/powerpc/kernel/syscalls.c:65:1: note: in expansion of macro
'SYSCALL_DEFINE6'
SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
^~~~~~~~~~~~~~~
./include/linux/syscalls.h:238:18: note: aliased declaration here
asmlinkage long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
^~~~~~~~
./include/linux/syscalls.h:222:2: note: in expansion of macro
'__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~
./include/linux/syscalls.h:216:36: note: in expansion of macro
'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name,
__VA_ARGS__)
^~~~~~~~~~~~~~~
arch/powerpc/kernel/syscalls.c:65:1: note: in expansion of macro
'SYSCALL_DEFINE6'
SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
^~~~~~~~~~~~~~~
>
> This warning should detect serious problems, so don't disable it without
> first investigating please.
It's been a discussion on this topic, ref
https://lkml.org/lkml/2017/12/5/581
It says "The new warning seems reasonable in principle, but it doesn't
help us here, since we rely on the type mismatch to sanitize the
system call arguments. After I reported this as GCC PR82435, a new
-Wno-attribute-alias option was added that could be used to turn the
warning off globally on the command line, but I'd prefer to do it a
little more fine-grained"
>
> What do you call "latest version", btw? Trunk, aka 9.0? Or the most
> advanced release, 8.1? Or the latest release (which also is 8.1 :-) )
I encounter it with 8.1
According the refered discusion, it linked to GCC 8
Christophe
>
>
> Segher
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/Makefile: fix build failure by disabling attribute-alias warning
2018-05-28 14:39 ` Christophe Leroy
@ 2018-05-28 15:07 ` Segher Boessenkool
2018-05-28 16:18 ` Mathieu Malaterre
0 siblings, 1 reply; 6+ messages in thread
From: Segher Boessenkool @ 2018-05-28 15:07 UTC (permalink / raw)
To: Christophe Leroy
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
linuxppc-dev, linux-kernel
On Mon, May 28, 2018 at 02:39:37PM +0000, Christophe Leroy wrote:
> In file included from arch/powerpc/kernel/syscalls.c:24:
> ./include/linux/syscalls.h:233:18: warning: 'sys_mmap2' alias between
> functions of incompatible types 'long int(long unsigned int, size_t,
> long unsigned int, long unsigned int, long unsigned int, long
> unsigned int)' {aka 'long int(long unsigned int, unsigned int, long
> unsigned int, long unsigned int, long unsigned int, long unsigned
> int)'} and 'long int(long int, long int, long int, long int, long
> int, long int)' [-Wattribute-alias]
So yes, these are actually different (int vs. long).
> In file included from arch/powerpc/kernel/signal_32.c:29:
> ./include/linux/syscalls.h:233:18: warning: 'sys_swapcontext' alias
> between functions of incompatible types 'long int(struct ucontext *,
> struct ucontext *, long int)' and 'long int(long int, long int, long
> int)' [-Wattribute-alias]
And this one is quite spectacularly different.
Try putting this before the wacko aliases:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattribute-alias"
and this after:
#pragma GCC diagnostic pop
so that you will get this quite useful warning for all other code.
Segher
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] powerpc/Makefile: fix build failure by disabling attribute-alias warning
2018-05-28 15:07 ` Segher Boessenkool
@ 2018-05-28 16:18 ` Mathieu Malaterre
0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Malaterre @ 2018-05-28 16:18 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: Christophe Leroy, Paul Mackerras, linuxppc-dev, LKML
On Mon, May 28, 2018 at 5:07 PM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> On Mon, May 28, 2018 at 02:39:37PM +0000, Christophe Leroy wrote:
>> In file included from arch/powerpc/kernel/syscalls.c:24:
>> ./include/linux/syscalls.h:233:18: warning: 'sys_mmap2' alias between
>> functions of incompatible types 'long int(long unsigned int, size_t,
>> long unsigned int, long unsigned int, long unsigned int, long
>> unsigned int)' {aka 'long int(long unsigned int, unsigned int, long
>> unsigned int, long unsigned int, long unsigned int, long unsigned
>> int)'} and 'long int(long int, long int, long int, long int, long
>> int, long int)' [-Wattribute-alias]
>
> So yes, these are actually different (int vs. long).
>
>> In file included from arch/powerpc/kernel/signal_32.c:29:
>> ./include/linux/syscalls.h:233:18: warning: 'sys_swapcontext' alias
>> between functions of incompatible types 'long int(struct ucontext *,
>> struct ucontext *, long int)' and 'long int(long int, long int, long
>> int)' [-Wattribute-alias]
>
> And this one is quite spectacularly different.
https://patchwork.kernel.org/patch/10375607/
>
> Try putting this before the wacko aliases:
>
> #pragma GCC diagnostic push
> #pragma GCC diagnostic ignored "-Wattribute-alias"
>
> and this after:
>
> #pragma GCC diagnostic pop
>
> so that you will get this quite useful warning for all other code.
>
>
> Segher
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-05-28 16:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-28 14:17 [PATCH] powerpc/Makefile: fix build failure by disabling attribute-alias warning Christophe Leroy
2018-05-28 14:37 ` Segher Boessenkool
2018-05-28 14:56 ` Christophe LEROY
2018-05-28 14:39 ` Christophe Leroy
2018-05-28 15:07 ` Segher Boessenkool
2018-05-28 16:18 ` Mathieu Malaterre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox