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

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

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
I checked that this compiles correctly, if I supply -DCONFIG_SPL_SYS_THUMB_BUILD on the commandline. Works as expected.
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@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

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@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

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@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@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@rock-chips.com mailto:kever.yang@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

Hi Philipp,
Yes, I'm building TPL, the error message gone after I add TPL_SYS_THUMB_BUILD.
I still confuse where the build option affects, eg. which Mackfile or config.mk?
Thanks, - Kever On 08/30/2017 06:16 PM, Dr. Philipp Tomsich wrote:
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@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@rock-chips.com mailto:kever.yang@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 Yangkever.yang@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

I just looked at the codebase and now I am also confused. ;-) At least the usage in the Makefiles seems to not correctly support TPL at this point.
For what I have seen, we seem to have multiple problems: 1/ arch/arm/config.mk does test for '$(CONFIG_$(SPL_)SYS_THUMB_BUILD)’ instead of '$(CONFIG_$(SPL_TPL_)SYS_THUMB_BUILD)’ 2/ same goes for arch/arm/lib/Makefile
And then there’s a few instances of unnecessary (and undocumented) complexity: 3/ in arch/arm/lib/cache.c, a CONFIG_IS_ENABLED(SYS_THUMB_BUILD) test guards whether invalidate_l2_cache(void) is present 4/ in arch/arm/include/asm/cache.h, a CONFIG_IS_ENABLED(SYS_THUMB_BUILD) test decides whether invalidate_l2_cache() is inline or not
Could you do a quick review all uses of ‘SYS_THUMB_BUILD’ throughout the code-base and and (a) change $(CONFIG_$(SPL_)SYS_THUMB_BUILD) to $(CONFIG_$(SPL_TPL_)SYS_THUMB_BUILD), unless guaranteed that TPL will be handled in a different path (b) make sure that .c files never test this, unless absolutely necessary (the compiler usually provides us with a predefined __thumb__ if we are compiling for Thumb) (c) clean up the cache.h/c complexity: this seems to be there, because the cache-maintainance instructions are available as ARM instructions only, but the arch/arm/include/asm/cache.h could be included either by ARM or by Thumb code; an “attribute((arm))” on the inline-function might suffice to allow for a single, common case (if GCC is smart enough to insert an interwork transition for the inlined code).
Regards, Philipp.
On 31 Aug 2017, at 03:19, Kever Yang kever.yang@rock-chips.com wrote:
Hi Philipp,
Yes, I'm building TPL, the error message gone after I add TPL_SYS_THUMB_BUILD.
I still confuse where the build option affects, eg. which Mackfile or config.mk?
Thanks,
- Kever
On 08/30/2017 06:16 PM, Dr. Philipp Tomsich wrote:
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@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@rock-chips.com mailto:kever.yang@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@rock-chips.com mailto:kever.yang@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
participants (2)
-
Dr. Philipp Tomsich
-
Kever Yang