linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] powerpc: Error on assembly warnings
@ 2024-03-26  4:44 Benjamin Gray
  2024-04-02  4:09 ` Andrew Donnellan
  2024-04-22  8:16 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Benjamin Gray @ 2024-03-26  4:44 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: ajd, Benjamin Gray

We currently enable -Werror on the arch/powerpc subtree. However this
only catches C warnings. Assembly warnings are logged, but the make
invocation will still succeed. This can allow incorrect syntax such as

  ori r3, r4, r5

to be compiled without catching that the assembler is treating r5
as the immediate value 5.

To prevent this in assembly files and inline assembly, add the
-fatal-warnings option to assembler invocations.

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
---
 arch/powerpc/Kbuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Kbuild b/arch/powerpc/Kbuild
index 22cd0d55a892..da862e9558bc 100644
--- a/arch/powerpc/Kbuild
+++ b/arch/powerpc/Kbuild
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
+subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror -Wa,-fatal-warnings
+subdir-asflags-$(CONFIG_PPC_WERROR) := -Wa,-fatal-warnings
 
 obj-y += kernel/
 obj-y += mm/
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] powerpc: Error on assembly warnings
  2024-03-26  4:44 [PATCH v1] powerpc: Error on assembly warnings Benjamin Gray
@ 2024-04-02  4:09 ` Andrew Donnellan
  2024-04-22  8:16 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Donnellan @ 2024-04-02  4:09 UTC (permalink / raw)
  To: Benjamin Gray, linuxppc-dev

On Tue, 2024-03-26 at 15:44 +1100, Benjamin Gray wrote:
> We currently enable -Werror on the arch/powerpc subtree. However this
> only catches C warnings. Assembly warnings are logged, but the make
> invocation will still succeed. This can allow incorrect syntax such
> as
> 
>   ori r3, r4, r5
> 
> to be compiled without catching that the assembler is treating r5
> as the immediate value 5.
> 
> To prevent this in assembly files and inline assembly, add the
> -fatal-warnings option to assembler invocations.
> 
> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>

Seems like a good idea to me!

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
Tested-by: Andrew Donnellan <ajd@linux.ibm.com>

> ---
>  arch/powerpc/Kbuild | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/Kbuild b/arch/powerpc/Kbuild
> index 22cd0d55a892..da862e9558bc 100644
> --- a/arch/powerpc/Kbuild
> +++ b/arch/powerpc/Kbuild
> @@ -1,5 +1,6 @@
>  # SPDX-License-Identifier: GPL-2.0
> -subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
> +subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror -Wa,-fatal-warnings
> +subdir-asflags-$(CONFIG_PPC_WERROR) := -Wa,-fatal-warnings
>  
>  obj-y += kernel/
>  obj-y += mm/

-- 
Andrew Donnellan    OzLabs, ADL Canberra
ajd@linux.ibm.com   IBM Australia Limited

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] powerpc: Error on assembly warnings
  2024-03-26  4:44 [PATCH v1] powerpc: Error on assembly warnings Benjamin Gray
  2024-04-02  4:09 ` Andrew Donnellan
@ 2024-04-22  8:16 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2024-04-22  8:16 UTC (permalink / raw)
  To: linuxppc-dev, Benjamin Gray; +Cc: ajd

On Tue, 26 Mar 2024 15:44:20 +1100, Benjamin Gray wrote:
> We currently enable -Werror on the arch/powerpc subtree. However this
> only catches C warnings. Assembly warnings are logged, but the make
> invocation will still succeed. This can allow incorrect syntax such as
> 
>   ori r3, r4, r5
> 
> to be compiled without catching that the assembler is treating r5
> as the immediate value 5.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc: Error on assembly warnings
      https://git.kernel.org/powerpc/c/608d4a5ca56302181e669cea0aa571cbec6680eb

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-22  8:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-26  4:44 [PATCH v1] powerpc: Error on assembly warnings Benjamin Gray
2024-04-02  4:09 ` Andrew Donnellan
2024-04-22  8:16 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).