From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/9] ARM: pass -marm to gcc by default for both C and assembler
Date: Tue, 9 Oct 2012 18:27:31 +0100 [thread overview]
Message-ID: <20121009172731.GC2122@linaro.org> (raw)
In-Reply-To: <1349796183-30648-7-git-send-email-arnd@arndb.de>
On Tue, Oct 09, 2012 at 05:23:00PM +0200, Arnd Bergmann wrote:
> The Linaro cross toolchain and probably others nowadays default to
> building in THUMB2 mode. When building a kernel for a CPU that does
> not support THUMB2, the compiler complains about incorrect flags.
> We can work around this by setting -marm for all non-T2 builds.
>
> Without this patch, building assabet_defconfig results in:
>
> usr/initramfs_data.S:1:0: warning: target CPU does not support THUMB instructions [enabled by default]
> arch/arm/nwfpe/entry.S:1:0: warning: target CPU does not support THUMB instructions [enabled by default]
> firmware/cis/PCMLM28.cis.gen.S:1:0: warning: target CPU does not support THUMB instructions [enabled by default]
> (and many more)
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Nicolas Pitre <nico@linaro.org>
> Cc: Russell King <rmk+kernel@arm.linux.org.uk>
> Cc: Dave Martin <dave.martin@linaro.org>
This looks like a sensible fix, but it could be worth amending the
commit message to explain what was fixed, since it took me a moment or
two to puzzle out why the code this patch removes was broken. Maybe
something like:
-marm was passed unconditionally for C files previously, but nothing was
passed to the gcc frontend when processing .S files, resulting in a
warning. The assembler never defaults to ARM unless -Wa,-mthumb is
supplied explicitly, so the files were still assembled correctly.
This patch makes sure that -marm is passed for .S files too, and also
avoids the redundant gcc -marm -mthumb in Thumb kernels.
Preferably with that (or equivalent):
Acked-by: Dave Martin <dave.martin@linaro.org>
> ---
> arch/arm/Makefile | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index f023e3a..5f914fc 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -21,8 +21,6 @@ endif
> OBJCOPYFLAGS :=-O binary -R .comment -S
> GZFLAGS :=-9
> #KBUILD_CFLAGS +=-pipe
> -# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
> -KBUILD_CFLAGS +=$(call cc-option,-marm,)
>
> # Never generate .eh_frame
> KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm)
> @@ -105,17 +103,20 @@ endif
> ifeq ($(CONFIG_THUMB2_KERNEL),y)
> AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
> AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
> -CFLAGS_THUMB2 :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
> -AFLAGS_THUMB2 :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb
> +CFLAGS_ISA :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
> +AFLAGS_ISA :=$(CFLAGS_ISA) -Wa$(comma)-mthumb
> # Work around buggy relocation from gas if requested:
> 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)
> endif
>
> # Need -Uarm for gcc < 3.x
> -KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_THUMB2) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
> -KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
> +KBUILD_CFLAGS +=$(CFLAGS_ABI) $(CFLAGS_ISA) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
> +KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_ISA) $(arch-y) $(tune-y) -include asm/unified.h -msoft-float
>
> CHECKFLAGS += -D__arm__
>
> --
> 1.7.10
>
next prev parent reply other threads:[~2012-10-09 17:27 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-09 15:22 [GIT PULL 0/9] ARM architecture fixes for 3.7 Arnd Bergmann
2012-10-09 15:22 ` [PATCH 1/9] ARM: kprobes: make more tests conditional Arnd Bergmann
2012-10-09 15:22 ` [PATCH 2/9] ARM: export set_irq_flags Arnd Bergmann
2012-10-09 16:20 ` Thomas Gleixner
2012-10-10 6:42 ` Linus Walleij
2012-10-09 15:22 ` [PATCH 3/9] ARM: Fix another build warning in arch/arm/mm/alignment.c Arnd Bergmann
2012-10-09 15:22 ` [PATCH 4/9] ARM: export default read_current_timer Arnd Bergmann
2012-10-09 15:40 ` Jonathan Austin
2012-10-09 16:06 ` Russell King - ARM Linux
2012-10-18 8:43 ` Alexander Holler
2012-10-09 15:22 ` [PATCH 5/9] ARM: Xen: fix initial build problems: Arnd Bergmann
2012-10-09 15:35 ` [Xen-devel] " Ian Campbell
2012-10-09 15:39 ` Arnd Bergmann
2012-10-09 16:10 ` Ian Campbell
2012-10-09 18:19 ` Arnd Bergmann
2012-10-10 9:46 ` Ian Campbell
2012-10-10 11:07 ` Arnd Bergmann
2012-10-09 15:37 ` Stefano Stabellini
2012-10-09 18:21 ` Arnd Bergmann
2012-10-10 7:54 ` [Xen-devel] " Ian Campbell
2012-10-10 14:47 ` Stefano Stabellini
2012-10-10 14:53 ` Ian Campbell
2012-10-10 16:01 ` Stefano Stabellini
2012-10-09 16:04 ` Russell King - ARM Linux
2012-10-09 15:23 ` [PATCH 6/9] ARM: pass -marm to gcc by default for both C and assembler Arnd Bergmann
2012-10-09 17:27 ` Dave Martin [this message]
2012-10-09 15:23 ` [PATCH 7/9] ARM: be really quiet when building with 'make -s' Arnd Bergmann
2012-10-09 15:23 ` [PATCH 8/9] ARM: binfmt_flat: unused variable 'persistent' Arnd Bergmann
2012-10-09 15:23 ` [PATCH 9/9] ARM: warnings in arch/arm/include/asm/uaccess.h Arnd Bergmann
2012-10-09 16:08 ` [GIT PULL 0/9] ARM architecture fixes for 3.7 Russell King - ARM Linux
2012-10-09 17:06 ` Stefano Stabellini
2012-10-09 18:40 ` Arnd Bergmann
2012-10-10 14:58 ` Stefano Stabellini
2012-10-12 13:20 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121009172731.GC2122@linaro.org \
--to=dave.martin@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).