public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/10283] New: localedef fails to generate locale-archive on SH4 arch
@ 2009-06-15 10:12 masaki dot chikama at gmail dot com
  2009-06-15 14:03 ` [Bug libc/10283] " drepper at redhat dot com
  2009-06-16 10:12 ` masaki dot chikama at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: masaki dot chikama at gmail dot com @ 2009-06-15 10:12 UTC (permalink / raw)
  To: glibc-bugs

When building locale-archive on SH4 arch, localdef fail to mmap files 
with this message.

+ /builddir/build/BUILD/glibc-20090510T1842/build-sh4-linuxnptl/elf/ld.so
--library-path /builddir/build/BUILD/glibc-20090510T1842/build-sh4-linuxnptl/ 
/builddir/build/BUILD/glibc-20090510T1842/build-sh4-linuxnptl/locale/localedef
--prefix /builddir/build/BUILDROOT/glibc-2.10.1-1.fs1.sh4 --add-to-archive aa_DJ
....
uctw zh_TW.utf8 zu_ZA zu_ZA.utf8
cannot map archive header: Invalid argument

The failed point is mmap64() in locale/programs/locarchive.c .
On sh4 architecture, mmaped address must be aligned on 16KB boundary
instead of getpagesize() when mmapping with MAP_SHARED|MAP_FIXED.

It will be needed a patch something like this.
I think my patch may not be correct. Please fix it in proper way.
Thanks.

--- locale/programs/locarchive.c.org    2009-06-13 23:54:47.000000000 +0900
+++ locale/programs/locarchive.c        2009-06-14 22:09:26.000000000 +0900
@@ -143,6 +143,9 @@
       reserved = total;
     }
  
+#ifdef __SH4__
+  p = ((int)p + 0x4000) & ~(0x4000 -1);
+#endif
   /* Map the header and all the administration data structures.  */
   p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0);
   if (p == MAP_FAILED)
@@ -260,7 +263,13 @@
     return false;
  
   const size_t pagesz = getpagesize ();
-  size_t start = ah->mmaped & ~(pagesz - 1);
+#ifdef __SH4__
+#define SHM_ALIGN_SIZE 0x4000
+#else
+#define SHM_ALIGN_SIZE pagesz
+#endif
+//  size_t start = ah->mmaped & ~(pagesz - 1);
+  size_t start = ah->mmaped & ~(SHM_ALIGN_SIZE - 1);
   void *p = mmap64 (ah->addr + start, st.st_size - start,
                    PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
                    ah->fd, start);
@@ -405,6 +414,9 @@
       reserved = total;
     }
  
+#ifdef __SH4__
+  p = ((int)p + 0x4000) & ~(0x4000 -1);
+#endif
   /* Map the header and all the administration data structures.  */
   p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0);

-- 
           Summary: localedef fails to generate locale-archive on SH4 arch
           Product: glibc
           Version: 2.10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: masaki dot chikama at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: sh4-redhat-linux
  GCC host triplet: sh4-redhat-linux
GCC target triplet: sh4-redhat-linux


http://sourceware.org/bugzilla/show_bug.cgi?id=10283

------- 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] 3+ messages in thread

* [Bug libc/10283] localedef fails to generate locale-archive on SH4 arch
  2009-06-15 10:12 [Bug libc/10283] New: localedef fails to generate locale-archive on SH4 arch masaki dot chikama at gmail dot com
@ 2009-06-15 14:03 ` drepper at redhat dot com
  2009-06-16 10:12 ` masaki dot chikama at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: drepper at redhat dot com @ 2009-06-15 14:03 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2009-06-15 14:03 -------
(In reply to comment #0)
> The failed point is mmap64() in locale/programs/locarchive.c .
> On sh4 architecture, mmaped address must be aligned on 16KB boundary
> instead of getpagesize() when mmapping with MAP_SHARED|MAP_FIXED.

Then fix the kernel.  It is ridiculous to make such a change since all of
userland expects page-size alignment to be sufficient.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX


http://sourceware.org/bugzilla/show_bug.cgi?id=10283

------- 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] 3+ messages in thread

* [Bug libc/10283] localedef fails to generate locale-archive on SH4 arch
  2009-06-15 10:12 [Bug libc/10283] New: localedef fails to generate locale-archive on SH4 arch masaki dot chikama at gmail dot com
  2009-06-15 14:03 ` [Bug libc/10283] " drepper at redhat dot com
@ 2009-06-16 10:12 ` masaki dot chikama at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: masaki dot chikama at gmail dot com @ 2009-06-16 10:12 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From masaki dot chikama at gmail dot com  2009-06-16 10:12 -------
 According to this[1] thread, there are many architectures which need 
special alignment other than pagesize when mmapping with MAP_SHARED|MAP_FIXED.
They are sparc, parisc, m68k, mips, sh and a part of arm.
Do you have no interest in these arches ?

By the way, current sparc kernel still has this limitation and
hits the same problem[2] as mine.

[1] http://lkml.org/lkml/2003/8/29/6
[2] http://sparc.koji.fedoraproject.org/koji/getfile?taskID=174754&name=build.log

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10283

------- 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] 3+ messages in thread

end of thread, other threads:[~2009-06-16 10:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-15 10:12 [Bug libc/10283] New: localedef fails to generate locale-archive on SH4 arch masaki dot chikama at gmail dot com
2009-06-15 14:03 ` [Bug libc/10283] " drepper at redhat dot com
2009-06-16 10:12 ` masaki dot chikama at gmail 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).