[U-Boot] [PATCH v2] ARM: move -march=* and -mtune= options to arch/arm/Makefile

Masahiro Yamada yamada.masahiro at socionext.com
Sat Apr 11 16:41:43 CEST 2015


Hi Stephen,


2015-04-11 12:49 GMT+09:00 Stephen Warren <swarren at wwwdotorg.org>:
> On 03/27/2015 11:06 AM, Albert ARIBAUD wrote:
>> On Fri, 27 Feb 2015 02:40:33 +0900, Masahiro Yamada <yamada.m at jp.panasonic.com> wrote:
>>> My main motivations for this commit are:
>>>
>>> [1] Follow the arch/arm/Makefile style of Linux Kernel
>>>
>>> [2] Maintain compiler options systematically
>>>   Currently, we give -march=* and -mtune=* options inconsistently:
>>>   Only some of the CPUs pass -march=* and -mtune=* options.
>>>   By collecting such options into the single place arch/arm/Makefile
>>>   we can tell which options are missing at a glance.
>>>
>>> [3] Prepare for deprecating arch/*/cpu/*/config.mk
>>>
>>> Note:
>>>   This commit just moves the compiler options so as not to change
>>>   the behavior at all.  It does not care about the correctness of
>>>   the given options.  Fox example, "-march=armv5te" might be better
>>>   than "-march=armv4" for ARM946EJS, but it is beyond the scope this
>>>   commit.  Also, filling the missing -march=* and -tune=* is left
>>>   to follow-up patches.
> ...
>> Applied to u-boot-arm/master, thanks!
>
> This patch breaks Tegra (at least Seaboard, and I'd guess all Tegra
> boards). Reverting it solves the problem.
>
> It causes the SPL to be build for ARMv7 even though it should be built
> for an earlier architecture. I added a $(warning) to arch/arm/Makefile,
> and it prints:
>
> arch/arm/Makefile:37: SPL_BUILD  FLAGS  -D__ARM__ -marm
> -mno-thumb-interwork  -mabi=aapcs-linux  -mword-relocations
> -mno-unaligned-access  -ffunction-sections -fdata-sections -fno-common
> -ffixed-r9  -msoft-float  -pipe  -march=armv7-a
>
> arch/arm/Makefile:37: SPL_BUILD y FLAGS  -D__ARM__ -marm
> -mno-thumb-interwork  -mabi=aapcs-linux  -ffunction-sections
> -fdata-sections -fno-common -ffixed-r9  -msoft-float  -pipe  -march=armv7-a
>


Just a tip:

You can also check it by ".*.cmd" files.


After I fixed this problem, I confirmed it as follows:


For U-boot proper, for example,

$ head common/.stdio.o.cmd
cmd_common/stdio.o := arm-linux-gnueabi-gcc -Wp,-MD,common/.stdio.o.d
-nostdinc -isystem /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/include
-Iinclude  -I./arch/arm/include -include ./include/linux/kconfig.h
-D__KERNEL__ -D__UBOOT__ -DCONFIG_SYS_TEXT_BASE=0x0010E000 -Wall
-Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding
-Os -fno-stack-protector -g -fstack-usage -Wno-format-nonliteral
-D__ARM__ -marm -mno-thumb-interwork -mabi=aapcs-linux
-mword-relocations -mno-unaligned-access -ffunction-sections
-fdata-sections -fno-common -ffixed-r9 -msoft-float -pipe
-march=armv7-a -I./arch/arm/mach-tegra/include
-D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stdio)"
-D"KBUILD_MODNAME=KBUILD_STR(stdio)" -c -o common/stdio.o
common/stdio.c
[ snip ]



For SPL,


$ head spl/common/.stdio.o.cmd
cmd_spl/common/stdio.o := arm-linux-gnueabi-gcc
-Wp,-MD,spl/common/.stdio.o.d  -nostdinc -isystem
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/include -Iinclude
-I./arch/arm/include -include ./include/linux/kconfig.h -D__KERNEL__
-D__UBOOT__ -DCONFIG_SYS_TEXT_BASE=0x0010E000 -DCONFIG_SPL_BUILD -Wall
-Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding
-Os -fno-stack-protector -g -fstack-usage -Wno-format-nonliteral
-ffunction-sections -fdata-sections -D__ARM__ -marm
-mno-thumb-interwork -mabi=aapcs-linux -ffunction-sections
-fdata-sections -fno-common -ffixed-r9 -msoft-float -pipe -march=armv4
-mtune=arm7tdmi -I./arch/arm/mach-tegra/include
-D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(stdio)"
-D"KBUILD_MODNAME=KBUILD_STR(stdio)" -c -o spl/common/stdio.o
common/stdio.c
[ snip ]



-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list