Skip to contentSkip to conversation

powerpc: Error on assembly warnings

PATCH Applied Benjamin Gray 3 participants 3 messages Mar 26, 2024 – Apr 22, 2024 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Error on assembly warnings

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.

---
 arch/powerpc/Kbuild | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/Kbuild +2 -1
index 22cd0d55a892..da862e9558bc 100644
@@ -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/
Signature · 1 line
2.44.0
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · 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

Quoted 7 lines

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.

Seems like a good idea to me!

Quoted 16 lines

---
 arch/powerpc/Kbuild | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/Kbuild +2 -1
index 22cd0d55a892..da862e9558bc 100644
@@ -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/

Signature · 2 lines
Andrew Donnellan    OzLabs, ADL Canberra
[email protected]   IBM Australia Limited
#2 lore raw
In reply to Benjamin Gray
Quoted 10 lines · 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.

[...]

Applied to powerpc/next.

[1/1] powerpc: Error on assembly warnings

      https://git.kernel.org/powerpc/c/608d4a5ca56302181e669cea0aa571cbec6680eb

cheers