How do I avoid linker padding?

Luke Diamand ldiamand@virata.com
Sat Apr 1 00:00:00 GMT 2000


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

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



More information about the crossgcc mailing list