diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-03-21 10:07:01 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2007-03-21 10:07:01 +0000 |
commit | 2807ff5416e136df2adcb508f803aaa306fe2c59 (patch) | |
tree | 1bd32dec2457680003e451239c4fb3ce03b068dc | |
parent | aaddfc614a370d3187f041b0651edf0cb12f71dd (diff) | |
download | busybox-w32-2807ff5416e136df2adcb508f803aaa306fe2c59.tar.gz busybox-w32-2807ff5416e136df2adcb508f803aaa306fe2c59.tar.bz2 busybox-w32-2807ff5416e136df2adcb508f803aaa306fe2c59.zip |
add info about gcc's sadistic alignment - and how to disable it
git-svn-id: svn://busybox.net/trunk/busybox@18191 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | docs/keep_data_small.txt | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/docs/keep_data_small.txt b/docs/keep_data_small.txt index 15e41aefd..3c3d27396 100644 --- a/docs/keep_data_small.txt +++ b/docs/keep_data_small.txt | |||
@@ -178,5 +178,29 @@ struct { | |||
178 | char vc31[31] = { 1 }; // unaligned | 178 | char vc31[31] = { 1 }; // unaligned |
179 | char vc32[32] = { 1 }; // aligned to 32 bytes | 179 | char vc32[32] = { 1 }; // aligned to 32 bytes |
180 | 180 | ||
181 | -fpack-struct=1 reduces alignment of s28 to 1 (but probably will break layout | 181 | -fpack-struct=1 reduces alignment of s28 to 1 (but probably |
182 | of many libc structs) but s32 and vc32 are still aligned to 32 bytes. | 182 | will break layout of many libc structs) but s32 and vc32 |
183 | are still aligned to 32 bytes. | ||
184 | |||
185 | I will try to cook up a patch to add a gcc option for disabling it. | ||
186 | Meanwhile, this is where it can be disabled in gcc source: | ||
187 | |||
188 | gcc/config/i386/i386.c | ||
189 | int | ||
190 | ix86_data_alignment (tree type, int align) | ||
191 | { | ||
192 | #if 0 | ||
193 | if (AGGREGATE_TYPE_P (type) | ||
194 | && TYPE_SIZE (type) | ||
195 | && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST | ||
196 | && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= 256 | ||
197 | || TREE_INT_CST_HIGH (TYPE_SIZE (type))) && align < 256) | ||
198 | return 256; | ||
199 | #endif | ||
200 | |||
201 | Result (non-static busybox built against glibc): | ||
202 | |||
203 | # size /usr/srcdevel/bbox/fix/busybox.t0/busybox busybox | ||
204 | text data bss dec hex filename | ||
205 | 634416 2736 23856 661008 a1610 busybox | ||
206 | 632580 2672 22944 658196 a0b14 busybox_noalign | ||