[lkml]   [2000]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] removal of "static foo = 0"
   Date:   Mon, 27 Nov 2000 09:41:39 +0100
From: Werner Almesberger <>

egcs-2.91.66 indeed doesn't seem to make this optimization on i386.
(Maybe the pointer increment or pointer offset solution would
actually be slower - didn't check.) But I'm not sure if this is
also true for other versions/architectures, or other code

There is no guarentee that contiguous data or bss section members
will appear contiguous and in the same order, in the final object.

In fact, a specific optimization done on MIPS and other platforms is
to place all data members under a certain size in a special
"" section. So for example:

static int a;
static struct foo b;
static int b;

Would not place 'b' at "&a + sizeof(a) + sizeof(b)"

Also I believe linkers are allowed to arbitrarily reorder members in
the data and bss sections. I could be wrong on this one though.

David S. Miller
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:47    [W:0.093 / U:8.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site