[Icc-mot] BSS in reverse order?

Richard richard-lists at imagecraft.com
Thu Nov 15 14:46:59 PST 2007


It's just an artifact of the internal compiler architecture. That's 
no particular reason for it per se. Just how things fall out due to 
the algorithm and data structures we use.

As Edward say, you should not depend on the order. In fact, the 
compiler is allowed to "randomize" the order if it provides better 
code. For example, on the HCS12, we may collect all byte size 
variables together so there would be no padding needed for word 
aligned fetches for the word sized items.

At 05:41 AM 11/15/2007, Jim Fiocca wrote:
>The reverse order of the BSS just makes debugging a little awkward.
>When I look at a variable or array in memory, I'm used to seeing the 
>next variable I declared in the file as the next variable in memory.
>This just caught me a little off guard and makes debugging a little 
>more cumbersome.  Especially if you want to add a dummy padding 
>array to force alignment, you have to add it after the object you 
>want to align.
>
>So I was just wondering, from a compiler writer's point of view, why 
>this was done; because I've never seen it done before.
>

// richard (This email is for mailing lists. To reach me directly, 
please use richard at imagecraft.com) 



More information about the Icc-mot mailing list