[ECOS] How do I avoid linker padding?

William A. Gatliff bgat@open-widgets.com
Mon Mar 20 10:35:00 GMT 2000


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.






More information about the Ecos-discuss mailing list