This is the mail archive of the
ecos-discuss@sourceware.cygnus.com
mailing list for the eCos project.
Re: How do I avoid linker padding?
- To: "William A. Gatliff" <bgat at open-widgets dot com>
- Subject: [ECOS] Re: How do I avoid linker padding?
- From: Luke Diamand <ldiamand at virata dot com>
- Date: Tue, 21 Mar 2000 12:39:29 +0000
- CC: crossgcc at sourceware dot cygnus dot com, ecos-discuss at sourceware dot cygnus dot com
- Organization: Virata
- References: <38D66F0E.6B61B773@open-widgets.com>
Dunno if this helps, but I found that when linking a.out, it aligned the
start of each compilation unit on a 16 byte boundary.
This is set in binutils/bfd/cpu-arm.c with the macro 'N'. Argument 8 is
used - it raises it to the power 2 and byte aligns that much. So we
changed it locally from 4 to 2.
HTH!
Luke Diamand
"William A. Gatliff" wrote:
>
> Guys:
>
> I'm trying to implement something similar to the DEVTAB stuff in eCos,
> but having some problems.
>
> What I want to be able to do is allocate data structures in random
> source modules to a particular link section, and have the linker gather
> them up and locate them contiguously. For example:
>
> typedef struct {int x;} my_struct;
>
> #define DEVTAB(name, x) my_struct name
> __attribute__((section(".devtab")) = {x}
>
> in foo.c:
>
> DEVTAB( my_driver, 10 );
>
> What I have found, is that when the linker (binutils 2.9.1, as well as
> recent snapshots) finds multiple DEVTABs in a single module, it jams
> them all together according to the alignment requirements for the
> architecture, as expected. However, when the linker locates DEVTABs
> from different modules, it puts big gaps between them.
>
> I know that eCos is doing this successfully, but the source code doesn't
> tell me how they're doing it. Any ideas?
>
> Thanks!
>
> b.g.
>
> ------
> Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
--
Virata http://www.virata.com
Cambridge
Tel: +44 1223 566919 Fax: +44 1223 566915