ARM: 9275/1: Drop '-mthumb' from AFLAGS_ISA
authorNathan Chancellor <nathan@kernel.org>
Mon, 21 Nov 2022 19:21:21 +0000 (20:21 +0100)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Mon, 28 Nov 2022 11:57:36 +0000 (11:57 +0000)
commit59e2cf8d21e05391c42628eb9fb5bb40f9d9698f
tree236ace165e381de6f30aed8b44a9c74fa2f6992e
parentfea53546be574f2e357fa53f4a582788b20f283c
ARM: 9275/1: Drop '-mthumb' from AFLAGS_ISA

When building with CONFIG_THUMB2_KERNEL=y + a version of clang from
Debian using CROSS_COMPILE=arm-linux-gnueabihf-, the following warning
occurs frequently:

  <built-in>:383:9: warning: '__thumb2__' macro redefined [-Wmacro-redefined]
  #define __thumb2__ 2
          ^
  <built-in>:353:9: note: previous definition is here
  #define __thumb2__ 1
          ^
  1 warning generated.

Debian carries a downstream patch that changes the default CPU of the
arm-linux-gnueabihf target from 'arm1176jzf-s' (v6) to 'cortex-a7' (v7).
As a result, '-mthumb' defines both '__thumb__' and '__thumb2__'. The
define of '__thumb2__' via the command line was purposefully added to
catch a situation like this.

In a similar vein as commit 26b12e084bce ("ARM: 9264/1: only use
-mtp=cp15 for the compiler"), do not add '-mthumb' to AFLAGS_ISA, as it
is already passed to the assembler via '-Wa,-mthumb' and '__thumb2__' is
already defined for preprocessing.

Link: https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/raw/622dbcbd40b316ed3905a2d25d9623544a06e6b1/debian/patches/930008-arm.diff
Fixes: 1d2e9b67b001 ("ARM: 9265/1: pass -march= only to compiler")
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
arch/arm/Makefile