diff mbox series

[v1] powerpc: Error on assembly warnings

Message ID 20240326044420.577031-1-bgray@linux.ibm.com (mailing list archive)
State Accepted
Commit 608d4a5ca56302181e669cea0aa571cbec6680eb
Headers show
Series [v1] powerpc: Error on assembly warnings | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 6 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.

Commit Message

Benjamin Gray March 26, 2024, 4:44 a.m. UTC
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(-)

Comments

Andrew Donnellan April 2, 2024, 4:09 a.m. UTC | #1
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/
Michael Ellerman April 22, 2024, 8:16 a.m. UTC | #2
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
diff mbox series

Patch

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/