This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/10283] New: localedef fails to generate locale-archive on SH4 arch


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]