This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How do I avoid linker padding?


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.





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]