[Bug 131] struct globals/struct globals2 not portable or safe

bugzilla at busybox.net bugzilla at busybox.net
Thu Feb 26 11:25:29 UTC 2009


https://bugs.busybox.net/show_bug.cgi?id=131


Denys Vlasenko <vda.linux at googlemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vda.linux at googlemail.com




--- Comment #1 from Denys Vlasenko <vda.linux at googlemail.com>  2009-02-26 11:25:29 UTC ---
> Underneath it all, the problem is that the trick of declaring two structures
and shoving them next to each other in memory provides no alignment guarantees.

> More generally, it's not a particularly well-designed strategy; there's not
much likely benefit from "small offsets" when you're dealing with structures
this large anyway,

In hindsight, I agree with you. This probably is a bit too ugly. However, size
savings aren't too small - structures are not "large", one is < 128 bytes and
other is barely bigger, so this ugly trick did result in almost all offsets
being single-byte encodable on x86-32.

Try combining it into one struct, then compare code size, and you will see.

> and the alignment penalties are probably worse.

But this can be fixed:

http://busybox.net/downloads/fixes-1.13.2/busybox-1.13.2-awk.patch

Fixed in svn. Thanks.


-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list