[PATCH] extra/locale: Mark __codeset_8_bit_t as packed.

Will Newton will.newton at gmail.com
Thu Mar 24 11:44:42 UTC 2011


gen_ldc writes offsets into the __locale_mmap_t structure. This
relies on the host system having the same struct offsets as the
target. On some architectures structs are aligned to 4 byte
boundaries and for these targets it is required for the struct to
be packed so that it is more likely to match the host system
(typically x86 which does not align structs).
---
 extra/locale/gen_wc8bit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/extra/locale/gen_wc8bit.c b/extra/locale/gen_wc8bit.c
index a861caa..1d42d3c 100644
--- a/extra/locale/gen_wc8bit.c
+++ b/extra/locale/gen_wc8bit.c
@@ -182,7 +182,7 @@ int main(int argc, char **argv)
 	printf("\tunsigned char idx8c2wc[%d];\n", C2WC_IDX_LEN);
 	printf("\tunsigned char idx8wc2c[%d];\n", II_LEN);
 #endif
-	printf("} __codeset_8_bit_t;\n\n");
+	printf("} __attribute__((__packed__)) __codeset_8_bit_t;\n\n");

 	printf("#ifdef WANT_DATA\n\n");
 	printf("static const __codeset_8_bit_t codeset_8_bit[%d] = {\n", argc-1);
-- 
1.7.3.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-extra-locale-Mark-__codeset_8_bit_t-as-packed.patch
Type: text/x-patch
Size: 1232 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20110324/fad6b373/attachment-0001.bin>


More information about the uClibc mailing list