Skip to content

Commit 2f62847

Browse files
nathanchanceRussell King (Oracle)
authored andcommitted
ARM: 9287/1: Reduce __thumb2__ definition to crypto files that require it
Commit 1d2e9b6 ("ARM: 9265/1: pass -march= only to compiler") added a __thumb2__ define to ASFLAGS to avoid build errors in the crypto code, which relies on __thumb2__ for preprocessing. Commit 59e2cf8 ("ARM: 9275/1: Drop '-mthumb' from AFLAGS_ISA") followed up on this by removing -mthumb from AFLAGS so that __thumb2__ would not be defined when the default target was ARMv7 or newer. Unfortunately, the second commit's fix assumes that the toolchain defaults to -mno-thumb / -marm, which is not the case for Debian's arm-linux-gnueabihf target, which defaults to -mthumb: $ echo | arm-linux-gnueabihf-gcc -dM -E - | grep __thumb #define __thumb2__ 1 #define __thumb__ 1 This target is used by several CI systems, which will still see redefined macro warnings, despite '-mthumb' not being present in the flags: <command-line>: warning: "__thumb2__" redefined <built-in>: note: this is the location of the previous definition Remove the global AFLAGS __thumb2__ define and move it to the crypto folder where it is required by the imported OpenSSL algorithms; the rest of the kernel should use the internal CONFIG_THUMB2_KERNEL symbol to know whether or not Thumb2 is being used or not. Be sure that __thumb2__ is undefined first so that there are no macro redefinition warnings. Link: ClangBuiltLinux#1772 Reported-by: "kernelci.org bot" <[email protected]> Suggested-by: Ard Biesheuvel <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Tested-by: Nick Desaulniers <[email protected]> Fixes: 59e2cf8 ("ARM: 9275/1: Drop '-mthumb' from AFLAGS_ISA") Fixes: 1d2e9b6 ("ARM: 9265/1: pass -march= only to compiler") Signed-off-by: Russell King (Oracle) <[email protected]>
1 parent 3cb0f23 commit 2f62847

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

arch/arm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
132132

133133
ifeq ($(CONFIG_THUMB2_KERNEL),y)
134134
CFLAGS_ISA :=-Wa,-mimplicit-it=always $(AFLAGS_NOWARN)
135-
AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb -D__thumb2__=2
135+
AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
136136
CFLAGS_ISA +=-mthumb
137137
else
138138
CFLAGS_ISA :=$(call cc-option,-marm,) $(AFLAGS_NOWARN)

arch/arm/crypto/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ $(obj)/%-core.S: $(src)/%-armv4.pl
5353

5454
clean-files += poly1305-core.S sha256-core.S sha512-core.S
5555

56+
aflags-thumb2-$(CONFIG_THUMB2_KERNEL) := -U__thumb2__ -D__thumb2__=1
57+
58+
AFLAGS_sha256-core.o += $(aflags-thumb2-y)
59+
AFLAGS_sha512-core.o += $(aflags-thumb2-y)
60+
5661
# massage the perlasm code a bit so we only get the NEON routine if we need it
5762
poly1305-aflags-$(CONFIG_CPU_V7) := -U__LINUX_ARM_ARCH__ -D__LINUX_ARM_ARCH__=5
5863
poly1305-aflags-$(CONFIG_KERNEL_MODE_NEON) := -U__LINUX_ARM_ARCH__ -D__LINUX_ARM_ARCH__=7
59-
AFLAGS_poly1305-core.o += $(poly1305-aflags-y)
64+
AFLAGS_poly1305-core.o += $(poly1305-aflags-y) $(aflags-thumb2-y)

0 commit comments

Comments
 (0)