public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] compiled result not align to 4 bytes
@ 2008-05-22  7:51 Frank Lin
  2008-05-22 11:09 ` Gary Thomas
  2008-05-22 11:23 ` Nick Garnett
  0 siblings, 2 replies; 6+ messages in thread
From: Frank Lin @ 2008-05-22  7:51 UTC (permalink / raw)
  To: ecos-discuss

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] compiled result not align to 4 bytes
  2008-05-22  7:51 [ECOS] compiled result not align to 4 bytes Frank Lin
@ 2008-05-22 11:09 ` Gary Thomas
  2008-05-22 12:49   ` Frank Lin
  2008-05-22 11:23 ` Nick Garnett
  1 sibling, 1 reply; 6+ messages in thread
From: Gary Thomas @ 2008-05-22 11:09 UTC (permalink / raw)
  To: Frank Lin; +Cc: ecos-discuss

Frank Lin wrote:
> 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.

What version of GCC & BINUTILS are you using?

Note that these come from different source files, so it may be a linker problem.

> 
> 0c1102a8 <hal_lsbindex>:

> 0c110345 <hal_thread_switch_context>:               <-----------not aligh to 4 bytes


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] compiled result not align to 4 bytes
  2008-05-22  7:51 [ECOS] compiled result not align to 4 bytes Frank Lin
  2008-05-22 11:09 ` Gary Thomas
@ 2008-05-22 11:23 ` Nick Garnett
  2008-05-22 12:50   ` Frank Lin
  1 sibling, 1 reply; 6+ messages in thread
From: Nick Garnett @ 2008-05-22 11:23 UTC (permalink / raw)
  To: Frank Lin; +Cc: ecos-discuss

"Frank Lin" <franklin373@gmail.com> writes:

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

I doubt that this is a GCC bug. If the asm files needed .align 4 they
would have it. In any case all text sections will be 4 byte aligned
by default.


The following is not code but ASCII text:

"DEFINE(sym, val) asm volatile"...

This seems to be part of the source of hal_mk_defs.c. The compiled
code of this file shouldn't make it into the executable, let alone the
source!

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


The following code doesn't seem to correspond to the current version
in anoncvs. Are you using V2.0 or anoncvs?
 
> 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


Basically, something has gone horribly wrong with your build. I would advise
getting the current anoncvs and make sure you can build all the test
programs before building your own application.


-- 
Nick Garnett                                      eCos Kernel Architect
eCosCentric Limited    http://www.eCosCentric.com      The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.     Tel: +44 1223 245571
Registered in England and Wales:                        Reg No: 4422071


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] compiled result not align to 4 bytes
  2008-05-22 11:09 ` Gary Thomas
@ 2008-05-22 12:49   ` Frank Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Frank Lin @ 2008-05-22 12:49 UTC (permalink / raw)
  To: Gary Thomas; +Cc: ecos-discuss


----- Original Message ----- 
From: "Gary Thomas" <gary@mlbassoc.com>
To: "Frank Lin" <franklin373@gmail.com>
Cc: <ecos-discuss@ecos.sourceware.org>
Sent: Thursday, May 22, 2008 7:08 PM
Subject: Re: [ECOS] compiled result not align to 4 bytes


> 
> What version of GCC & BINUTILS are you using?
> 
$ arm-elf-gcc --version
arm-elf-gcc (GCC) 3.2.1 (eCosCentric)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] compiled result not align to 4 bytes
  2008-05-22 11:23 ` Nick Garnett
@ 2008-05-22 12:50   ` Frank Lin
  2008-05-22 13:03     ` Nick Garnett
  0 siblings, 1 reply; 6+ messages in thread
From: Frank Lin @ 2008-05-22 12:50 UTC (permalink / raw)
  To: Nick Garnett; +Cc: ecos-discuss


----- Original Message ----- 
From: "Nick Garnett" <nickg@ecoscentric.com>
To: "Frank Lin" <franklin373@gmail.com>
Cc: <ecos-discuss@ecos.sourceware.org>
Sent: Thursday, May 22, 2008 7:22 PM
Subject: Re: [ECOS] compiled result not align to 4 bytes


> 
> 
> The following code doesn't seem to correspond to the current version
> in anoncvs. Are you using V2.0 or anoncvs?
> 
Abount 20 days ago, I installed this ecos version as http://ecos.sourceware.org/getstart.html says:
wget --passive-ftp ftp://ecos.sourceware.org/pub/ecos/ecos-install.tcl 
sh ecos-install.tcl 


Now, I modify global compiler flags and global linker flags from "-gdwarf-2 -g3" to "-g", now compile seems OK, "-gdwarf-2 -g3" enable to debug on MACRO as gdb document says. 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [ECOS] compiled result not align to 4 bytes
  2008-05-22 12:50   ` Frank Lin
@ 2008-05-22 13:03     ` Nick Garnett
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Garnett @ 2008-05-22 13:03 UTC (permalink / raw)
  To: Frank Lin; +Cc: ecos-discuss

"Frank Lin" <franklin373@gmail.com> writes:

> ----- Original Message ----- 
> From: "Nick Garnett" <nickg@ecoscentric.com>
> To: "Frank Lin" <franklin373@gmail.com>
> Cc: <ecos-discuss@ecos.sourceware.org>
> Sent: Thursday, May 22, 2008 7:22 PM
> Subject: Re: [ECOS] compiled result not align to 4 bytes
> 
> 
> > 
> > 
> > The following code doesn't seem to correspond to the current version
> > in anoncvs. Are you using V2.0 or anoncvs?
> > 
> Abount 20 days ago, I installed this ecos version as http://ecos.sourceware.org/getstart.html says:
> wget --passive-ftp ftp://ecos.sourceware.org/pub/ecos/ecos-install.tcl 
> sh ecos-install.tcl 

That would have been version 2.0 which is now getting old. The most
recent version is available via anoncvs. Now that you have 2.0
installed you can get a new source repository by following the
directions here:

http://ecos.sourceware.org/anoncvs.html


> Now, I modify global compiler flags and global linker flags from
> "-gdwarf-2 -g3" to "-g", now compile seems OK, "-gdwarf-2 -g3"
> enable to debug on MACRO as gdb document says.

There is no real guarantee that any of the non-default debug options
will work. 



-- 
Nick Garnett                                      eCos Kernel Architect
eCosCentric Limited    http://www.eCosCentric.com      The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.     Tel: +44 1223 245571
Registered in England and Wales:                        Reg No: 4422071


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-05-22 13:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22  7:51 [ECOS] compiled result not align to 4 bytes Frank Lin
2008-05-22 11:09 ` Gary Thomas
2008-05-22 12:49   ` Frank Lin
2008-05-22 11:23 ` Nick Garnett
2008-05-22 12:50   ` Frank Lin
2008-05-22 13:03     ` Nick Garnett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).