bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ARM (Thumb) Asm Invalid Instructions


From: Duane Ellis
Subject: ARM (Thumb) Asm Invalid Instructions
Date: Fri, 10 Oct 2003 07:37:53 -0400

Using binutils-2.14.tar.gz

Confgured with

          ../binutils-2.14/configure  --target=arm-elf

This source snippet contains an invalid instruction sequence
in THUMB MODE that GAS quietly assembles incorrectly.

The form of the STORE instruction used below is *INVALID* in thumb
state. (I was hand coding some thumb code when I found it)

----------------------------------------------------------------------
        .text
        .type   foo,function
        .thumb_func
        .global foo
foo:
        @ VVVV  ldr is a valid instruction VVVV
        ldr     r0,some_variable
        @ ^^^^  ldr is a valid instruction ^^^^

        @ VVVV  this str is invalid VVVV
        str     r0,some_variable
        @ VVVV  above is invalid VVVV

        bx      lr
        .size   foo,(.-foo)
        .align 2
        .word   0
        .word   0
some_variable:
        .word   0

----------------------------------------------------------------------

This is the relevent section from "objdump"

00000000 <foo>:
   0:   4803            ldr     r0, [pc, #12]   (10 <some_variable>)
   2:   4803            ldr     r0, [pc, #12]   (10 <some_variable>)
   4:   4770            bx      lr

Note address #2 - contains an LDR instead of an STR.

Thanks.

-Duane Ellis




reply via email to

[Prev in Thread] Current Thread [Next in Thread]