From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Bürgel To: ecos-discuss@sourceware.cygnus.com Subject: [ECOS] ARM Assembler problem Date: Tue, 28 Nov 2000 06:53:00 -0000 Message-id: <3A23C448.1EEC787D@genologic.de> X-SW-Source: 2000-11/msg00348.html Hi, I've got following problem with GNU arm-elf-as (Host: i686-linux, Target: ARM7TDMI): Consider the following piece of code (simple delay loop): ldr r2, .WAIT loop: sub r2, r2, #1 cmp r2, #0 bne loop ... .WAIT: .word 0x1000000 After assembling with "arm-elf-as -marm7tdmi file.S" I had a closer look to a.out with "arm-elf-objdump -d a.out" and found ... 2c: e59f2038 ldr r2, [pc, #38] ; 6c <.WAIT> 00000030 : 30: e2422001 sub r2, r2, #1 ; 0x1 34: e3520000 cmp r2, #0 ; 0x0 38: 1afffffe bne 38 ... As you can see the assembler computed a wrong target address (opcode 1afffffe at address 38). The offset should be -2 resulting in an opcode of 1afffffc. If I use a hex-editor to change the opcode in the binary image, the program works as expected. Is there a special option I forgot or is the assembler buggy (resp. built wrong). Thanks in advance.