aboutsummaryrefslogtreecommitdiff
path: root/docs/keep_data_small.txt
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-21 10:07:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-21 10:07:01 +0000
commitb8e72fdde1186f41963697d57383c08402513ca8 (patch)
tree1bd32dec2457680003e451239c4fb3ce03b068dc /docs/keep_data_small.txt
parentafa37cf508dedfec778322381b0cc1a7bf73497c (diff)
downloadbusybox-b8e72fdde1186f41963697d57383c08402513ca8.tar.gz
add info about gcc's sadistic alignment - and how to disable it
Diffstat (limited to 'docs/keep_data_small.txt')
-rw-r--r--docs/keep_data_small.txt28
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 {
char vc31[31] = { 1 }; // unaligned
char vc32[32] = { 1 }; // aligned to 32 bytes
--fpack-struct=1 reduces alignment of s28 to 1 (but probably will break layout
-of many libc structs) but s32 and vc32 are still aligned to 32 bytes.
+-fpack-struct=1 reduces alignment of s28 to 1 (but probably
+will break layout of many libc structs) but s32 and vc32
+are still aligned to 32 bytes.
+
+I will try to cook up a patch to add a gcc option for disabling it.
+Meanwhile, this is where it can be disabled in gcc source:
+
+gcc/config/i386/i386.c
+int
+ix86_data_alignment (tree type, int align)
+{
+#if 0
+ if (AGGREGATE_TYPE_P (type)
+ && TYPE_SIZE (type)
+ && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
+ && (TREE_INT_CST_LOW (TYPE_SIZE (type)) >= 256
+ || TREE_INT_CST_HIGH (TYPE_SIZE (type))) && align < 256)
+ return 256;
+#endif
+
+Result (non-static busybox built against glibc):
+
+# size /usr/srcdevel/bbox/fix/busybox.t0/busybox busybox
+ text data bss dec hex filename
+ 634416 2736 23856 661008 a1610 busybox
+ 632580 2672 22944 658196 a0b14 busybox_noalign