public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH RFC] ARM: use -marm unconditionally for THUMB2_KERNEL=n builds
@ 2015-05-27  9:42 Uwe Kleine-König
  2015-05-27  9:53 ` Russell King - ARM Linux
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2015-05-27  9:42 UTC (permalink / raw)
  To: linux-arm-kernel

When using a toolchain that defaults to v7-m code generation using
cc-option fails to add -marm because it conflicts with the default cpu
type:

	$ echo > test.c
	$ arm-cortexm3-uclinuxeabi-gcc -marm -c test.c
	test.c:1:0: error: target CPU does not support ARM mode

resulting in errors like

	Error: selected processor does not support Thumb mode `mrs r1,cpsr'

Dropping the use of cc-option and using -marm unconditionally works fine
for this compiler because it's only ever used together with $(arch-y)
(e.g. -march=armv4).

The only possible culprit is a compiler that doesn't understand -marm.
My compiler collection only goes back to 4.0.3 which does work with this
option. The use of cc-option to test for -marm was introduced in commit
5636810d6f17 ([ARM] 3982/2: Explicitly select 32-bit ARM ISA (-marm))
back in 2006 when the minimal compiler version was already 3.3.

The next best fix is using

	CFLAGS_ISA := $(call cc-option,$(arch-y) -marm,)

and dropping arch-y from KBUILD_CFLAGS in case this change breaks gcc
3.x.

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
Hello,

Arnd told me on irc that Nico did some build tests with ancient
compilers some time ago. Maybe you can tell which was the first compiler
to support -marm?

Best regards
Uwe

 arch/arm/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 0ce9d0f71f2a..6773c74a8f8b 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -115,8 +115,8 @@ ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
 CFLAGS_MODULE	+=-fno-optimize-sibling-calls
 endif
 else
-CFLAGS_ISA	:=$(call cc-option,-marm,)
-AFLAGS_ISA	:=$(CFLAGS_ISA)
+CFLAGS_ISA	:= -marm
+AFLAGS_ISA	:= $(CFLAGS_ISA)
 endif
 
 # Need -Uarm for gcc < 3.x
-- 
2.1.4

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

end of thread, other threads:[~2015-05-28 10:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-27  9:42 [PATCH RFC] ARM: use -marm unconditionally for THUMB2_KERNEL=n builds Uwe Kleine-König
2015-05-27  9:53 ` Russell King - ARM Linux
2015-05-27 14:59   ` Uwe Kleine-König
2015-05-27 17:46     ` Russell King - ARM Linux
2015-05-28 10:49       ` Dave Martin
2015-05-27 16:25 ` Nicolas Pitre
2015-05-28 10:48 ` Dave Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox