Random idea...

Robin Farine robin.farine at terminus.org
Wed Feb 22 17:48:16 UTC 2006


On Wed February 22 2006 17:16, Paul Fox wrote:

> well, i'm not sure it would be worse than the __init stuff in the
> kernel. if the linker does the right thing, space is saved.  if
> it doesn't, we're no worse off than we are today.  i haven't been
> keeping track -- can busybox build anywhere but on gcc today?
>
> in any case, it's moot unless someone pipes up and says "i know
> how to do this."  that wouldn't be me.

I think one can achieve this by having each applet declare a global 
variable such as

  struct my_applet_global_state applet_globals
  __attribute__ ((common));

The linker will then overlay all the definitions of variables named 
'applet_globals' at the same address in the 'common' section.

Of course, this attribute thing is gcc specific but the notion of 
'common section' is not, so there must be ways to do it with other 
compilers as well.

Robin



More information about the busybox mailing list