public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/3002] New: iconvconfig misalignes hash table on ARM
@ 2006-08-05 18:58 mikpe at it dot uu dot se
2007-02-17 19:25 ` [Bug ports/3002] " drepper at redhat dot com
0 siblings, 1 reply; 2+ messages in thread
From: mikpe at it dot uu dot se @ 2006-08-05 18:58 UTC (permalink / raw)
To: glibc-bugs
Iconvconfig explicitly aligns the hash table part of its output file
(gconv-modules.cache) to a two-byte boundary. That's not OK for ARM
because the hash table is an array of structures, and those structures
have 4-byte alignment on ARM. When compiling for gcc's default CPU
type (the ARMv3 arm6 processor), gcc uses combinations of 4-byte loads
and shifts to read 2-byte fields from the hash table; this occurs in
__gconv_lookup_cache(). Due the broken code to align the hash table,
there is a very high probability (50%, depends on the size of the
preceeding string table) that each of these loads will cause an alignment
exception and require kernel fixup.
The fix is to use __alignof__ (struct hash_entry) not sizeof (gidx_t)
when aligning the hash table. This has no effect on other architectures
since they make __alignof__ (struct hash_entry) == __alignof__ (gidx_t).
--- glibc-2.3.6/iconv/iconvconfig.c.~1~ 2005-04-05 20:37:52.000000000 -0400
+++ glibc-2.3.6/iconv/iconvconfig.c 2006-07-28 09:59:22.000000000 -0400
@@ -1028,7 +1028,7 @@ write_output (void)
size_t n;
int idx;
struct iovec iov[6];
- static const gidx_t null_word;
+ static const char null_word[__alignof__ (struct hash_entry)];
size_t total;
char finalname[prefix_len + sizeof GCONV_MODULES_CACHE];
char tmpfname[(output_file == NULL ? sizeof finalname : output_file_len + 1)
@@ -1193,11 +1193,11 @@ write_output (void)
total += iov[1].iov_len;
idx = 2;
- if ((string_table_size & (sizeof (gidx_t) - 1)) != 0)
+ if ((string_table_size & (__alignof__ (struct hash_entry) - 1)) != 0)
{
iov[2].iov_base = (void *) &null_word;
- iov[2].iov_len = (sizeof (gidx_t)
- - (string_table_size & (sizeof (gidx_t) - 1)));
+ iov[2].iov_len = (__alignof__ (struct hash_entry)
+ - (string_table_size & (__alignof__ (struct hash_entry)
- 1)));
total += iov[2].iov_len;
++idx;
}
--
Summary: iconvconfig misalignes hash table on ARM
Product: glibc
Version: 2.3.6
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: mikpe at it dot uu dot se
CC: glibc-bugs at sources dot redhat dot com
GCC build triplet: armv5b-unknown-linux
GCC host triplet: armv5b-unknown-linux
GCC target triplet: armv5b-unknown-linux
http://sourceware.org/bugzilla/show_bug.cgi?id=3002
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-15 17:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-3002-131@http.sourceware.org/bugzilla/>
2012-02-15 17:54 ` [Bug ports/3002] iconvconfig misalignes hash table on ARM jsm28 at gcc dot gnu.org
2006-08-05 18:58 [Bug libc/3002] New: " mikpe at it dot uu dot se
2007-02-17 19:25 ` [Bug ports/3002] " drepper at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).