[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] code sequence, function order
From: |
Erik Christiansen |
Subject: |
Re: [avr-gcc-list] code sequence, function order |
Date: |
Thu, 1 Jul 2004 15:04:36 +1000 |
User-agent: |
Mutt/1.3.28i |
On Wed, Jun 30, 2004 at 08:47:59PM +0200, sebastian meuren wrote:
> does anybody know how I can garanty that the compiler puts the code of
> one function before an other one?
Within one sourcefile, __attribute__ ((section(".foo"))) commands, or on
the gcc command line -Wl,--section-start=.foo=0x1000 options are used to
place stuff where you want it, when you need it out of order, or with
holes. Alternatively, you can use a linker command script.
> Does the compiler always use the sequence in the c-code when
> generating the hex/assembler-code?
The sequence of sourcefiles on the gcc command line will affect the
linking order. (Or order of .o files on the ld command line if you're
invoking it directly.) It's difficult to imagine optimisation doing
anything across functions, but I haven't looked.
Is there a specific reason why function order is important? Since the
linker sorts out for you where functions are located, and places
sections where you want them, does function order matter?
Erik
- Re: [avr-gcc-list] code sequence, function order,
Erik Christiansen <=