[U-Boot] tpl build error "width suffixes are invalid in ARM mode"

Dr. Philipp Tomsich philipp.tomsich at theobroma-systems.com
Wed Aug 30 10:16:50 UTC 2017


I just realised that you are building TPL.
For this you will need a TPL_SYS_THUMB_BUILD symbol now (with the CONFIG_IS_ENABLED knowing about the difference between TPL and SPL).

Here’s the test output from my commandline:

ptomsich at android:~/rk3399-spl/u-boot$ ~/x-tools/arm-unknown-eabi/bin/arm-unknown-eabi-gcc -nostdinc -Iinclude    -I./arch/arm/include -include ./include/linux/kconfig.h -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -DCONFIG_TPL_BUILD -DCONFIG_TPL_SYS_THUMB_BUILD -D__ASSEMBLY__ -g -DCONFIG_THUMB2_KERNEL -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access -ffunction-sections -fdata-sections -fno-common -ffixed-r9 -msoft-float -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -I./arch/arm/mach-rockchip/include -c -o /tmp/test.o arch/arm/lib/memcpy.S && echo 'GREAT SUCCESS'
GREAT SUCCESS

Note that this is a 'gcc version 6.3.0’ built from source.

> On 30 Aug 2017, at 11:27, Kever Yang <kever.yang at rock-chips.com> wrote:
> 
> Philipp,
> 
> On 08/30/2017 04:59 PM, Dr. Philipp Tomsich wrote:
>> Kever,
>> 
>> I took a quick look and this seems to be an issue with CONFIG macros.
>> This is failing, because the assembly (after preprocessing) requests regular ARM mode and
>> supplies Thumb mnemonics (e.g. nop.w).
>> 
>> The trigger seems to be the following CONFIG_IS_ENABLED check in arch/arm/lib/memcpy.S:
>> 	#if CONFIG_IS_ENABLED(SYS_THUMB_BUILD) && !defined(MEMCPY_NO_THUMB_BUILD)
>> 	       .thumb
>>  	       .thumb_func
>> 	#endif
> 
> This is the first point I checked, and I'm sure .thunb and .thumb_func are there.
> Both and the SPL_SYS_THUMB_BUILD and SYS_THUMB_BUILD are defined, they are enabled
> by default in armv7.
> 
>> 
>> I checked that this compiles correctly, if I supply -DCONFIG_SPL_SYS_THUMB_BUILD on the
>> commandline. Works as expected.
> 
> I check with command below and the error still there.
> arm-linux-gnueabihf-gcc -Wp,-MD,tpl/arch/arm/lib/.memcpy.o.d  -nostdinc -isystem /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/include -Iinclude    -I./arch/arm/include -include ./include/linux/kconfig.h -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -DCONFIG_TPL_BUILD -DCONFIG_SPL_SYS_THUMB_BUILD -D__ASSEMBLY__ -g -DCONFIG_THUMB2_KERNEL -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access -ffunction-sections -fdata-sections -fno-common -ffixed-r9 -msoft-float -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -I./arch/arm/mach-rockchip/include   -c -o tpl/arch/arm/lib/memcpy.o arch/arm/lib/memcpy.S
> 
> Thanks,
> - Kever
>> So, you’ll just have to enable SPL_SYS_THUMB_BUILD for you configuration (see also Tom’s
>> commit message in commit 3a649407a49b041ceb826d55b5919dc8297f8965).
>> 
>> Regards,
>> Philipp.
>> 
>>> On 30 Aug 2017, at 10:33, Kever Yang <kever.yang at rock-chips.com> <mailto:kever.yang at rock-chips.com> wrote:
>>> 
>>> Hi 
>>> I get build error when I try to enable TPL for a new armv7 chip, the error happen when I build arch/arm/lib/memcpy.S,
>>> 
>>> the file can pass the build for SPL but failed in TPL build, the log is here:
>>> 
>>> The build can success if I remove the '-DCONFIT_TPL_BUILD' in red, any people can help on this?
>>> arm-linux-gnueabihf-gcc -Wp,-MD,tpl/arch/arm/lib/.memcpy.o.d  -nostdinc -isystem /usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/include -Iinclude    -I./arch/arm/include -include ./include/linux/kconfig.h -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -DCONFIG_TPL_BUILD -D__ASSEMBLY__ -g -DCONFIG_THUMB2_KERNEL -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access -ffunction-sections -fdata-sections -fno-common -ffixed-r9 -msoft-float -pipe -march=armv7-a -D__LINUX_ARM_ARCH__=7 -I./arch/arm/mach-rockchip/include   -c -o tpl/arch/arm/lib/memcpy.o arch/arm/lib/memcpy.S
>>> arch/arm/lib/memcpy.S: Assembler messages:
>>> arch/arm/lib/memcpy.S:114: Error: width suffixes are invalid in ARM mode -- `nop.w'
>>> arch/arm/lib/memcpy.S:115: Error: width suffixes are invalid in ARM mode -- `ldr.w r3,[r1],#4'
>>> arch/arm/lib/memcpy.S:116: Error: width suffixes are invalid in ARM mode -- `ldr.w r4,[r1],#4'
>>> arch/arm/lib/memcpy.S:117: Error: width suffixes are invalid in ARM mode -- `ldr.w r5,[r1],#4'
>>> arch/arm/lib/memcpy.S:118: Error: width suffixes are invalid in ARM mode -- `ldr.w r6,[r1],#4'
>>> arch/arm/lib/memcpy.S:119: Error: width suffixes are invalid in ARM mode -- `ldr.w r7,[r1],#4'
>>> arch/arm/lib/memcpy.S:120: Error: width suffixes are invalid in ARM mode -- `ldr.w r8,[r1],#4'
>>> arch/arm/lib/memcpy.S:121: Error: width suffixes are invalid in ARM mode -- `ldr.w lr,[r1],#4'
>>> ...
>>> 
>>> Thanks,
>>> - Kever
>> 
> 



More information about the U-Boot mailing list