2011-07-04 15:26:19 +02:00
|
|
|
Check:
|
|
|
|
http://sourceware.org/bugzilla/show_bug.cgi?id=10855
|
|
|
|
|
2009-02-20 08:46:43 +01:00
|
|
|
-------------------------------------------------------------------
|
|
|
|
Mon Oct 21 17:20:04 CEST 2002 - schwab@suse.de
|
|
|
|
|
|
|
|
- Fix alignment in locale-archive.
|
|
|
|
|
2009-11-16 09:54:19 +01:00
|
|
|
Index: locale/programs/locarchive.c
|
|
|
|
===================================================================
|
|
|
|
--- locale/programs/locarchive.c.orig
|
|
|
|
+++ locale/programs/locarchive.c
|
|
|
|
@@ -75,6 +75,9 @@ static const char *locnames[] =
|
|
|
|
#define RESERVE_MMAP_SIZE 512 * 1024 * 1024
|
2009-02-20 08:46:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
+#define ALIGN(offset, alignment) \
|
|
|
|
+ (((offset) + (alignment) - 1) & -(alignment))
|
|
|
|
+
|
|
|
|
static void
|
|
|
|
create_archive (const char *archivefname, struct locarhandle *ah)
|
|
|
|
{
|
2009-11-16 09:54:19 +01:00
|
|
|
@@ -94,7 +97,8 @@ create_archive (const char *archivefname
|
2009-02-20 08:46:43 +01:00
|
|
|
/* Create the initial content of the archive. */
|
|
|
|
head.magic = AR_MAGIC;
|
|
|
|
head.serial = 0;
|
|
|
|
- head.namehash_offset = sizeof (struct locarhead);
|
|
|
|
+ head.namehash_offset = ALIGN (sizeof (struct locarhead),
|
|
|
|
+ __alignof__ (struct namehashent));
|
|
|
|
head.namehash_used = 0;
|
|
|
|
head.namehash_size = next_prime (INITIAL_NUM_NAMES);
|
|
|
|
|
2009-11-16 09:54:19 +01:00
|
|
|
@@ -103,12 +107,15 @@ create_archive (const char *archivefname
|
2009-02-20 08:46:43 +01:00
|
|
|
head.string_used = 0;
|
|
|
|
head.string_size = INITIAL_SIZE_STRINGS;
|
|
|
|
|
|
|
|
- head.locrectab_offset = head.string_offset + head.string_size;
|
|
|
|
+ head.locrectab_offset = ALIGN (head.string_offset + head.string_size,
|
|
|
|
+ __alignof__ (struct locrecent));
|
|
|
|
head.locrectab_used = 0;
|
|
|
|
head.locrectab_size = INITIAL_NUM_LOCREC;
|
|
|
|
|
|
|
|
- head.sumhash_offset = (head.locrectab_offset
|
|
|
|
- + head.locrectab_size * sizeof (struct locrecent));
|
|
|
|
+ head.sumhash_offset = ALIGN (head.locrectab_offset
|
|
|
|
+ + (head.locrectab_size
|
|
|
|
+ * sizeof (struct locrecent)),
|
|
|
|
+ __alignof__ (struct sumhashent));
|
|
|
|
head.sumhash_used = 0;
|
|
|
|
head.sumhash_size = next_prime (INITIAL_NUM_SUMS);
|
|
|
|
|
2009-11-16 09:54:19 +01:00
|
|
|
@@ -356,13 +363,16 @@ enlarge_archive (struct locarhandle *ah,
|
|
|
|
newhead.string_size = MAX ((2 * newhead.string_used + 3) & -4,
|
|
|
|
newhead.string_size);
|
2009-02-20 08:46:43 +01:00
|
|
|
|
|
|
|
- newhead.locrectab_offset = newhead.string_offset + newhead.string_size;
|
|
|
|
+ newhead.locrectab_offset = ALIGN (newhead.string_offset
|
|
|
|
+ + newhead.string_size,
|
|
|
|
+ __alignof__ (struct locrecent));
|
|
|
|
newhead.locrectab_size = MAX (2 * newhead.locrectab_used,
|
|
|
|
newhead.locrectab_size);
|
|
|
|
|
|
|
|
- newhead.sumhash_offset = (newhead.locrectab_offset
|
|
|
|
- + (newhead.locrectab_size
|
|
|
|
- * sizeof (struct locrecent)));
|
|
|
|
+ newhead.sumhash_offset = ALIGN (newhead.locrectab_offset
|
|
|
|
+ + (newhead.locrectab_size
|
|
|
|
+ * sizeof (struct locrecent)),
|
|
|
|
+ __alignof__ (struct sumhashent));
|
|
|
|
newhead.sumhash_size = MAX (next_prime (2 * newhead.sumhash_used),
|
|
|
|
newhead.sumhash_size);
|
|
|
|
|