summaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2013-09-01 19:29:18 +0200
committerThomas Schwinge <thomas@codesourcery.com>2013-09-01 19:29:18 +0200
commitcbb58c37bb81d176f106a4de3c7f3b02dee2ff66 (patch)
treec746d229279f84aac0fe3afe537813fb281f7f78 /locale
parentffeaf5a2df0d177a7780fd7c6f5e7595caba766a (diff)
parentd5860b5273bc00632c65b43cb931d3238db0ab57 (diff)
Merge branch 'baseline' into refs/top-bases/tschwinge/Roger_Whittaker
Conflicts: sysdeps/mach/hurd/i386/init-first.c sysdeps/unix/sysv/linux/ldsodefs.h
Diffstat (limited to 'locale')
-rw-r--r--locale/C-translit.h1
-rw-r--r--locale/Makefile6
-rw-r--r--locale/categories.def1
-rw-r--r--locale/gen-translit.pl2
-rw-r--r--locale/iso-639.def10
-rw-r--r--locale/locarchive.h7
-rw-r--r--locale/programs/ld-collate.c2
-rw-r--r--locale/programs/ld-identification.c2
-rw-r--r--locale/programs/ld-time.c2
-rw-r--r--locale/programs/linereader.h2
-rw-r--r--locale/programs/locarchive.c66
11 files changed, 67 insertions, 34 deletions
diff --git a/locale/C-translit.h b/locale/C-translit.h
index 98f66e28fc..fdd4450050 100644
--- a/locale/C-translit.h
+++ b/locale/C-translit.h
@@ -1,5 +1,4 @@
#include <stdint.h>
-
#define NTRANSLIT 1355
static const uint32_t translit_from_idx[] =
{
diff --git a/locale/Makefile b/locale/Makefile
index 8bab9a00ce..8ccc603b15 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -98,9 +98,3 @@ cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
$(locale-modules) $(lib-modules))
lib := locale-programs
include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
-
-# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
-# This ensures they will load libc.so for needed symbols if loaded by
-# a statically-linked program that hasn't already loaded it.
-$(objpfx)libBrokenLocale.so: $(common-objpfx)libc.so \
- $(common-objpfx)libc_nonshared.a
diff --git a/locale/categories.def b/locale/categories.def
index 9a89d2d2c2..8c2537842a 100644
--- a/locale/categories.def
+++ b/locale/categories.def
@@ -133,6 +133,7 @@ DEFINE_CATEGORY
DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE_LEN, "ctype-translit-ignore-len", std, word)
DEFINE_ELEMENT (_NL_CTYPE_TRANSLIT_IGNORE, "ctype-translit-ignore", std, string)
DEFINE_ELEMENT (_NL_CTYPE_MAP_TO_NONASCII, "map-to-nonascii", std, word)
+ DEFINE_ELEMENT (_NL_CTYPE_NONASCII_CASE, "nonascii-case", std, word)
), _nl_postload_ctype)
diff --git a/locale/gen-translit.pl b/locale/gen-translit.pl
index d44310b316..5f30e30851 100644
--- a/locale/gen-translit.pl
+++ b/locale/gen-translit.pl
@@ -53,6 +53,8 @@ while (<F>) {
}
}
+printf "#include <stdint.h>\n";
+
printf "#define NTRANSLIT %d\n", $#froms + 1;
printf "static const uint32_t translit_from_idx[] =\n{\n ";
diff --git a/locale/iso-639.def b/locale/iso-639.def
index c79e9bfeb8..50b5a52f57 100644
--- a/locale/iso-639.def
+++ b/locale/iso-639.def
@@ -181,7 +181,7 @@ DEFINE_LANGUAGE_CODE3 ("Greek, Ancient (to 1453)", grc, grc)
DEFINE_LANGUAGE_CODE ("Greek, Modern (1453-)", el, ell, gre)
DEFINE_LANGUAGE_CODE ("Guarani", gn, grn, grn)
DEFINE_LANGUAGE_CODE ("Gujarati", gu, guj, guj)
-DEFINE_LANGUAGE_CODE3 ("Gwich´in", gwi, gwi)
+DEFINE_LANGUAGE_CODE3 ("Gwich´in", gwi, gwi)
DEFINE_LANGUAGE_CODE3 ("Haida", hai, hai)
DEFINE_LANGUAGE_CODE ("Haitian; Haitian Creole", ht, hat, hat)
DEFINE_LANGUAGE_CODE ("Hausa", ha, hau, hau)
@@ -337,7 +337,7 @@ DEFINE_LANGUAGE_CODE3 ("Norse, Old", non, non)
DEFINE_LANGUAGE_CODE3 ("North American Indian", nai, nai)
DEFINE_LANGUAGE_CODE ("Northern Sami", se, sme, sme)
DEFINE_LANGUAGE_CODE3 ("Northern Sotho; Pedi; Sepedi", nso, nso)
-DEFINE_LANGUAGE_CODE ("Norwegian Bokmål", nb, nob, nob)
+DEFINE_LANGUAGE_CODE ("Norwegian Bokmål", nb, nob, nob)
DEFINE_LANGUAGE_CODE ("Norwegian Nynorsk", nn, nno, nno)
DEFINE_LANGUAGE_CODE ("Norwegian", no, nor, nor)
DEFINE_LANGUAGE_CODE3 ("Nubian languages", nub, nub)
@@ -345,7 +345,7 @@ DEFINE_LANGUAGE_CODE3 ("Nyamwezi", nym, nym)
DEFINE_LANGUAGE_CODE3 ("Nyankole", nyn, nyn)
DEFINE_LANGUAGE_CODE3 ("Nyoro", nyo, nyo)
DEFINE_LANGUAGE_CODE3 ("Nzima", nzi, nzi)
-DEFINE_LANGUAGE_CODE ("Occitan (post 1500); Provençal", oc, oci, oci)
+DEFINE_LANGUAGE_CODE ("Occitan (post 1500); Provençal", oc, oci, oci)
DEFINE_LANGUAGE_CODE ("Ojibwa", oj, oji, oji)
DEFINE_LANGUAGE_CODE ("Oriya", or, ori, ori)
DEFINE_LANGUAGE_CODE ("Oromo", om, orm, orm)
@@ -368,7 +368,7 @@ DEFINE_LANGUAGE_CODE3 ("Pohnpeian", pon, pon)
DEFINE_LANGUAGE_CODE ("Polish", pl, pol, pol)
DEFINE_LANGUAGE_CODE ("Portuguese", pt, por, por)
DEFINE_LANGUAGE_CODE3 ("Prakrit languages", pra, pra)
-DEFINE_LANGUAGE_CODE3 ("Provençal, Old (to 1500)", pro, pro)
+DEFINE_LANGUAGE_CODE3 ("Provençal, Old (to 1500)", pro, pro)
DEFINE_LANGUAGE_CODE ("Pushto", ps, pus, pus)
DEFINE_LANGUAGE_CODE ("Quechua", qu, que, que)
DEFINE_LANGUAGE_CODE ("Raeto-Romance", rm, roh, roh)
@@ -476,7 +476,7 @@ DEFINE_LANGUAGE_CODE ("Uzbek", uz, uzb, uzb)
DEFINE_LANGUAGE_CODE3 ("Vai", vai, vai)
DEFINE_LANGUAGE_CODE ("Venda", ve, ven, ven)
DEFINE_LANGUAGE_CODE ("Vietnamese", vi, vie, vie)
-DEFINE_LANGUAGE_CODE ("Volapük", vo, vol, vol)
+DEFINE_LANGUAGE_CODE ("Volapük", vo, vol, vol)
DEFINE_LANGUAGE_CODE3 ("Votic", vot, vot)
DEFINE_LANGUAGE_CODE3 ("Wakashan languages", wak, wak)
DEFINE_LANGUAGE_CODE3 ("Walser", wae, wae)
diff --git a/locale/locarchive.h b/locale/locarchive.h
index db05603dfb..f2d84771ab 100644
--- a/locale/locarchive.h
+++ b/locale/locarchive.h
@@ -84,6 +84,13 @@ struct locarhandle
void *addr;
size_t mmaped;
size_t reserved;
+ /* If this mmap required adjustment (such as re-aligning), then this is the
+ real address that was returned from mmap and thus should be passed to the
+ munmap call. The addr field above is the first usable address. */
+ void *mmap_base;
+ /* Same as above for mmap_base vs addr, but this is the real length of the
+ map rather than the usable (which is what reserved represents). */
+ size_t mmap_len;
};
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 6894a7c181..e58c8f7020 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -2674,7 +2674,7 @@ skip_to (struct linereader *ldfile, struct locale_collate_t *collate,
}
else if (nowtok == tok_else)
{
- lr_error (ldfile, _("%s: more then one 'else'"), "LC_COLLATE");
+ lr_error (ldfile, _("%s: more than one 'else'"), "LC_COLLATE");
}
lr_ignore_rest (ldfile, 0);
diff --git a/locale/programs/ld-identification.c b/locale/programs/ld-identification.c
index 2589675390..4b03fb6987 100644
--- a/locale/programs/ld-identification.c
+++ b/locale/programs/ld-identification.c
@@ -144,7 +144,7 @@ No definition for %s category found"), "LC_IDENTIFICATION"));
{ \
if (verbose && ! nothing) \
WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), \
- "LC_IDENTIFICATION", #cat)); \
+ "LC_IDENTIFICATION", #cat)); \
identification->cat = ""; \
}
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index 45e36c6719..d3646b8717 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -1040,7 +1040,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result,
time->cat[cnt] = ""; \
time->w##cat[cnt++] = empty_wstr; \
} \
- \
+ \
if (now->tok == tok_semicolon) \
{ \
now = lr_token (ldfile, charmap, result, repertoire, \
diff --git a/locale/programs/linereader.h b/locale/programs/linereader.h
index e0475a2ef7..4e4fe9d874 100644
--- a/locale/programs/linereader.h
+++ b/locale/programs/linereader.h
@@ -49,7 +49,7 @@ struct token
struct
{
/* This element is sized on the safe expectation that no single
- character in any character set uses more then 16 bytes. */
+ character in any character set uses more than 16 bytes. */
unsigned char bytes[16];
int nbytes;
} charcode;
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index b6e5d47fe6..f7225b8bea 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -37,8 +37,11 @@
#include <stdint.h>
#include <sys/mman.h>
#include <sys/param.h>
+#include <sys/shm.h>
#include <sys/stat.h>
+#include <libc-internal.h>
+#include <libc-mmap.h>
#include "../../crypt/md5.h"
#include "../localeinfo.h"
#include "../locarchive.h"
@@ -79,21 +82,29 @@ static const char *locnames[] =
mapping affects the address selection. So do this mapping from the
actual file, even though it's only a dummy to reserve address space. */
static void *
-prepare_address_space (int fd, size_t total, size_t *reserved, int *xflags)
+prepare_address_space (int fd, size_t total, size_t *reserved, int *xflags,
+ void **mmap_base, size_t *mmap_len)
{
if (total < RESERVE_MMAP_SIZE)
{
void *p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_SHARED, fd, 0);
if (p != MAP_FAILED)
- {
- *reserved = RESERVE_MMAP_SIZE;
- *xflags = MAP_FIXED;
- return p;
- }
+ {
+ void *aligned_p = PTR_ALIGN_UP (p, MAP_FIXED_ALIGNMENT);
+ size_t align_adjust = aligned_p - p;
+ *mmap_base = p;
+ *mmap_len = RESERVE_MMAP_SIZE;
+ assert (align_adjust < RESERVE_MMAP_SIZE);
+ *reserved = RESERVE_MMAP_SIZE - align_adjust;
+ *xflags = MAP_FIXED;
+ return aligned_p;
+ }
}
*reserved = total;
*xflags = 0;
+ *mmap_base = NULL;
+ *mmap_len = 0;
return NULL;
}
@@ -111,7 +122,7 @@ create_archive (const char *archivefname, struct locarhandle *ah)
/* Create a temporary file in the correct directory. */
fd = mkstemp (fname);
if (fd == -1)
- error (EXIT_FAILURE, errno, _("cannot create temporary file"));
+ error (EXIT_FAILURE, errno, _("cannot create temporary file: %s"), fname);
/* Create the initial content of the archive. */
head.magic = AR_MAGIC;
@@ -151,9 +162,11 @@ create_archive (const char *archivefname, struct locarhandle *ah)
error (EXIT_FAILURE, errval, _("cannot resize archive file"));
}
- size_t reserved;
+ size_t reserved, mmap_len;
int xflags;
- void *p = prepare_address_space (fd, total, &reserved, &xflags);
+ void *mmap_base;
+ void *p = prepare_address_space (fd, total, &reserved, &xflags, &mmap_base,
+ &mmap_len);
/* Map the header and all the administration data structures. */
p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0);
@@ -199,6 +212,8 @@ create_archive (const char *archivefname, struct locarhandle *ah)
}
ah->fd = fd;
+ ah->mmap_base = mmap_base;
+ ah->mmap_len = mmap_len;
ah->addr = p;
ah->mmaped = total;
ah->reserved = reserved;
@@ -271,8 +286,7 @@ file_data_available_p (struct locarhandle *ah, uint32_t offset, uint32_t size)
if (st.st_size > ah->reserved)
return false;
- const size_t pagesz = getpagesize ();
- size_t start = ah->mmaped & ~(pagesz - 1);
+ size_t start = ALIGN_DOWN (ah->mmaped, MAP_FIXED_ALIGNMENT);
void *p = mmap64 (ah->addr + start, st.st_size - start,
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED,
ah->fd, start);
@@ -332,10 +346,15 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
MAP_SHARED | MAP_FIXED, ah->fd, 0);
else
{
- munmap (ah->addr, ah->reserved);
+ if (ah->mmap_base)
+ munmap (ah->mmap_base, ah->mmap_len);
+ else
+ munmap (ah->addr, ah->reserved);
ah->addr = mmap64 (NULL, st.st_size, PROT_READ | PROT_WRITE,
MAP_SHARED, ah->fd, 0);
ah->reserved = st.st_size;
+ ah->mmap_base = NULL;
+ ah->mmap_len = 0;
head = ah->addr;
}
if (ah->addr == MAP_FAILED)
@@ -345,7 +364,7 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
/* Create a temporary file in the correct directory. */
fd = mkstemp (fname);
if (fd == -1)
- error (EXIT_FAILURE, errno, _("cannot create temporary file"));
+ error (EXIT_FAILURE, errno, _("cannot create temporary file: %s"), fname);
/* Copy the existing head information. */
newhead = *head;
@@ -401,9 +420,11 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
error (EXIT_FAILURE, errval, _("cannot resize archive file"));
}
- size_t reserved;
+ size_t reserved, mmap_len;
int xflags;
- void *p = prepare_address_space (fd, total, &reserved, &xflags);
+ void *mmap_base;
+ void *p = prepare_address_space (fd, total, &reserved, &xflags, &mmap_base,
+ &mmap_len);
/* Map the header and all the administration data structures. */
p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0);
@@ -432,6 +453,8 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
}
new_ah.mmaped = total;
+ new_ah.mmap_base = mmap_base;
+ new_ah.mmap_len = mmap_len;
new_ah.addr = p;
new_ah.fd = fd;
new_ah.reserved = reserved;
@@ -624,9 +647,11 @@ open_archive (struct locarhandle *ah, bool readonly)
ah->fd = fd;
ah->mmaped = st.st_size;
- size_t reserved;
+ size_t reserved, mmap_len;
int xflags;
- void *p = prepare_address_space (fd, st.st_size, &reserved, &xflags);
+ void *mmap_base;
+ void *p = prepare_address_space (fd, st.st_size, &reserved, &xflags,
+ &mmap_base, &mmap_len);
/* Map the entire file. We might need to compare the category data
in the file with the newly added data. */
@@ -638,6 +663,8 @@ open_archive (struct locarhandle *ah, bool readonly)
error (EXIT_FAILURE, errno, _("cannot map archive header"));
}
ah->reserved = reserved;
+ ah->mmap_base = mmap_base;
+ ah->mmap_len = mmap_len;
}
@@ -646,7 +673,10 @@ close_archive (struct locarhandle *ah)
{
if (ah->fd != -1)
{
- munmap (ah->addr, ah->reserved);
+ if (ah->mmap_base)
+ munmap (ah->mmap_base, ah->mmap_len);
+ else
+ munmap (ah->addr, ah->reserved);
close (ah->fd);
}
}