This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
compiled result not align to 4 bytes
- From: "Frank Lin" <franklin373 at gmail dot com>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 22 May 2008 15:51:02 +0800
- Subject: [ECOS] compiled result not align to 4 bytes
I developed an application, but has problem, I use arm-elf-object -D ??? to got latter result, I find these code compiled from assembly file context.s not aligh to 4 bytes.
My global compiler flags is:
mcpu=arm7tdmi -mno-short-load-words -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -gdwarf-2 -g3 -O0 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority
My global linker flags is:
-mcpu=arm7tdmi -mno-short-load-words -Wl,--gc-sections -Wl,-static -gdwarf-2 -g3 -nostdlib
Whether it is caused by gcc bug? To solve this problem, whether I should place .align 4 to every assembly file, or any simple way exists?
Latter disassembly code's right part is my comments.
Thanks.
0c1102a8 <hal_lsbindex>:
c1102a8: e1a0c00d mov ip, sp
c1102ac: e92dd800 stmdb sp!, {fp, ip, lr, pc}
c1102b0: e24cb004 sub fp, ip, #4 ; 0x4
c1102b4: e24dd00c sub sp, sp, #12 ; 0xc
c1102b8: e50b0010 str r0, [fp, -#16]
c1102bc: e3a03000 mov r3, #0 ; 0x0
c1102c0: e50b3014 str r3, [fp, -#20]
c1102c4: e51b3014 ldr r3, [fp, -#20]
c1102c8: e353001f cmp r3, #31 ; 0x1f
c1102cc: da000000 ble c1102d4 <hal_lsbindex+0x2c>
c1102d0: ea00000c b c110308 <hal_lsbindex+0x60>
c1102d4: e51b2010 ldr r2, [fp, -#16]
c1102d8: e51b3014 ldr r3, [fp, -#20]
c1102dc: e1a03352 mov r3, r2, asr r3
c1102e0: e2033001 and r3, r3, #1 ; 0x1
c1102e4: e3530000 cmp r3, #0 ; 0x0
c1102e8: 0a000002 beq c1102f8 <hal_lsbindex+0x50>
c1102ec: e51b3014 ldr r3, [fp, -#20]
c1102f0: e50b3018 str r3, [fp, -#24]
c1102f4: ea000005 b c110310 <hal_lsbindex+0x68>
c1102f8: e51b3014 ldr r3, [fp, -#20]
c1102fc: e2833001 add r3, r3, #1 ; 0x1
c110300: e50b3014 str r3, [fp, -#20]
c110304: eaffffee b c1102c4 <hal_lsbindex+0x1c>
c110308: e3e03000 mvn r3, #0 ; 0x0
c11030c: e50b3018 str r3, [fp, -#24]
c110310: e51b0018 ldr r0, [fp, -#24]
c110314: e91ba800 ldmdb fp, {fp, sp, pc} <-------------hal_lsbindex end
c110318: 49464544 stmmidb r6, {r2, r6, r8, sl, lr}^ -----------------------
c11031c: 7328454e teqvc r8, #327155712 ; 0x13800000 ^
c110320: 762c6d79 undefined |
c110324: 20296c61 eorcs r6, r9, r1, ror #24 |
c110328: 206d7361 rsbcs r7, sp, r1, ror #6 |
c11032c: 616c6f76 cmnvs ip, r6, ror pc I do not know which souce code
c110330: 656c6974 strvsb r6, [ip, -#2420]! compile to these code
c110334: 6e5c2228 cdpvs 2, 5, cr2, cr12, cr8, {1} |
c110338: 652e745c strvs r7, [lr, -#1116]! |
c11033c: 745c7571 ldrvcb r7, [ip], -#1393 |
c110340: 79732022 ldmvcdb r3!, {r1, r5, sp}^ v
c110344: 4dc0146d cfstrdmi mvd1, [r0, #436] -----------------------
0c110345 <hal_thread_switch_context>: <-----------not aligh to 4 bytes
c110345: e24dc014 sub ip, sp, #20 ; 0x14
c110349: e92c6000 stmdb ip!, {sp, lr}
c11034d: e1a0d00c mov sp, ip
c110351: e92d1fff stmdb sp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp, ip}
c110355: e10f2000 mrs r2, CPSR
c110359: e58d2040 str r2, [sp, #64]
c11035d: e581d000 str sp, [r1]
0c110361 <hal_thread_load_context>:
c110361: e590b000 ldr fp, [r0]
c110365: e10f0000 mrs r0, CPSR
c110369: e38000c0 orr r0, r0, #192 ; 0xc0
c11036d: e129f000 msr CPSR_fc, r0