[arm-gnu] undefined instruction

Carlos O'Donell carlos_odonell at mentor.com
Tue May 15 23:04:06 UTC 2012


On 5/15/2012 6:33 PM, Carlo Caione wrote:
> Hi,
> In a big project (barebox) I have this simple snippet of code in string.c
> 
> size_t strlen(const char * s)
> {
> 	const char *sc;
> 
> 	for (sc = s; *sc != '\0'; ++sc)
> 		/* nothing */;
> 	return sc - s;
> }
> 
> I'm using Sourcery CodeBench Lite 2011.09-69 to compile the project.
> In particular for string.c:
> 
> arm-none-eabi-gcc -Wp,-MD,lib/.string.o.d  -nostdinc -isystem
> /opt/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin/../lib/gcc/arm-none-eabi/4.6.1/include
> -D__KERNEL__ -D__BAREBOX__ -Iinclude
> -I/home/carlo/projects/barebox/arch/arm/include
> -I/home/carlo/projects/barebox/arch/arm/include -include
> include/generated/autoconf.h -include
> /home/carlo/projects/barebox/include/linux/kconfig.h -fno-builtin
> -ffreestanding -D__ARM__ -fno-strict-aliasing -marm -mlittle-endian
> -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7
> -march=armv7-a  -msoft-float  -Iarch/arm/mach-omap/include
> -DTEXT_BASE=0x40200000 -fdata-sections -ffunction-sections -Wall
> -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
> -fno-common -Os -pipe -g  -fno-stack-protector
> -Wno-unused-but-set-variable -Wno-trampolines
> -Wdeclaration-after-statement -Wno-pointer-sign
> -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(string)"
> -D"KBUILD_MODNAME=KBUILD_STR(string)" -c -o lib/string.o lib/string.c
> 
> The problem is that the disassembly looks like:
> 
> 40205c84: strlen+0              beq 0x40205d18 <memcpy>
> 40205c88: strlen+4               ; <UNDEFINED> instruction: 0xf03fe03a
> 40205c8c: strlen+8              andeq r0, r0, r6
> 40205c90: strlen+12             andeq r0, r0, r4
> 40205c94: strlen+16             andeq r0, r0, r7
> 40205c98: strlen+20             andeq r0, r0, sp, lsl r0
> 40205c9c: strlen+24             ldrdmi r0, [r0], -r3
> 40205ca0: strlen+28              ; <UNDEFINED> instruction: 0xffffffff
> 
> Why the undefined instruction?

What did you use to get this disassembly?

When you compile with -save-temps what does the output assembly look like before being assembled?

It might be that the mapping symbols are missing and your disassembling constant pool data.

What are the .gnu_attribute flags for the object file?

Cheers,
Carlos.
-- 
Carlos O'Donell
Mentor Graphics / CodeSourcery
carlos_odonell at mentor.com
carlos at codesourcery.com
+1 (613) 963 1026



More information about the arm-gnu mailing list