diff --git a/Avoid-ldbl-96-stack-corruption-from-range-reduction-.patch b/Avoid-ldbl-96-stack-corruption-from-range-reduction-.patch index b3187964b383de1bb44e90788e36b1e15022c546..09522fa248daaec9f3d5b85a7696ddbb01e67d76 100644 --- a/Avoid-ldbl-96-stack-corruption-from-range-reduction-.patch +++ b/Avoid-ldbl-96-stack-corruption-from-range-reduction-.patch @@ -1,4 +1,4 @@ -From 9333498794cde1d5cca518badf79533a24114b6f Mon Sep 17 00:00:00 2001 +From 9f997ceca28f0634ad78a1ca95b84265f7801ff4 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 12 Feb 2020 23:31:56 +0000 Subject: [PATCH] Avoid ldbl-96 stack corruption from range reduction of @@ -31,37 +31,20 @@ since that is not a form of input expected by __kernel_rem_pio2. Tested for x86_64. -backport to openeuler. - +(cherry picked from commit 9333498794cde1d5cca518badf79533a24114b6f) --- - NEWS | 4 +++ - sysdeps/ieee754/ldbl-96/Makefile | 3 +- - sysdeps/ieee754/ldbl-96/e_rem_pio2l.c | 12 +++++++ - sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c | 41 ++++++++++++++++++++++ - 4 files changed, 59 insertions(+), 1 deletion(-) + sysdeps/ieee754/ldbl-96/Makefile | 3 ++- + sysdeps/ieee754/ldbl-96/e_rem_pio2l.c | 12 +++++++++ + sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c | 41 ++++++++++++++++++++++++++++++ + 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c -diff --git a/NEWS b/NEWS -index 2b681ed7..eb31aca6 100644 ---- a/NEWS -+++ b/NEWS -@@ -246,6 +246,10 @@ Security related changes: - addresses for loaded libraries and thus bypass ASLR for a setuid - program. Reported by Marcin Kościelnicki. - -+ CVE-2020-10029: Trigonometric functions on x86 targets suffered from stack -+ corruption when they were passed a pseudo-zero argument. Reported by Guido -+ Vranken / ForAllSecure Mayhem. -+ - The following bugs are resolved with this release: - - [1190] stdio: fgetc()/fread() behaviour is not POSIX compliant diff --git a/sysdeps/ieee754/ldbl-96/Makefile b/sysdeps/ieee754/ldbl-96/Makefile -index 790f670e..99c596e3 100644 +index 995e90d..318628a 100644 --- a/sysdeps/ieee754/ldbl-96/Makefile +++ b/sysdeps/ieee754/ldbl-96/Makefile @@ -17,5 +17,6 @@ - # . + # . ifeq ($(subdir),math) -tests += test-canonical-ldbl-96 test-totalorderl-ldbl-96 @@ -69,7 +52,7 @@ index 790f670e..99c596e3 100644 +CFLAGS-test-sinl-pseudo.c += -fstack-protector-all endif diff --git a/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c b/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c -index f67805f2..b0b899bc 100644 +index 5f74232..bcdf201 100644 --- a/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c +++ b/sysdeps/ieee754/ldbl-96/e_rem_pio2l.c @@ -210,6 +210,18 @@ __ieee754_rem_pio2l (long double x, long double *y) @@ -79,11 +62,11 @@ index f67805f2..b0b899bc 100644 + if ((i0 & 0x80000000) == 0) + { + /* Pseudo-zero and unnormal representations are not valid -+ representations of long double. We need to avoid stack -+ corruption in __kernel_rem_pio2, which expects input in a -+ particular normal form, but those representations do not need -+ to be consistently handled like any particular floating-point -+ value. */ ++ representations of long double. We need to avoid stack ++ corruption in __kernel_rem_pio2, which expects input in a ++ particular normal form, but those representations do not need ++ to be consistently handled like any particular floating-point ++ value. */ + y[1] = y[0] = __builtin_nanl (""); + return 0; + } @@ -93,7 +76,7 @@ index f67805f2..b0b899bc 100644 exp = j0 - 23; diff --git a/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c b/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c new file mode 100644 -index 00000000..abbce861 +index 0000000..f59b977 --- /dev/null +++ b/sysdeps/ieee754/ldbl-96/test-sinl-pseudo.c @@ -0,0 +1,41 @@ @@ -127,9 +110,9 @@ index 00000000..abbce861 + uint64_t sig = i == 63 ? 0 : 1ULL << i; + long double ld; + SET_LDOUBLE_WORDS (ld, 0x4141, -+ sig >> 32, sig & 0xffffffffULL); ++ sig >> 32, sig & 0xffffffffULL); + /* The requirement is that no stack overflow occurs when the -+ pseudo-zero or unnormal goes through range reduction. */ ++ pseudo-zero or unnormal goes through range reduction. */ + volatile long double ldr; + ldr = sinl (ld); + (void) ldr; @@ -139,5 +122,5 @@ index 00000000..abbce861 + +#include -- -2.19.1 +2.7.4 diff --git a/Do-not-use-gettimeofday-in-random-id.patch b/Do-not-use-gettimeofday-in-random-id.patch deleted file mode 100644 index 2b1b2f2ec12698f10707e25f0bd989a400227dfd..0000000000000000000000000000000000000000 --- a/Do-not-use-gettimeofday-in-random-id.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 359653aaacad463d916323f03c0ac3c47405aafa Mon Sep 17 00:00:00 2001 -From: Adhemerval Zanella -Date: Wed, 16 Jan 2019 18:10:56 +0000 -Subject: [PATCH] Do not use HP_TIMING_NOW for random bits - -This patch removes the HP_TIMING_BITS usage for fast random bits and replace -with clock_gettime (CLOCK_MONOTONIC). It has unspecified starting time and -nano-second accuracy, so its randomness is significantly better than -gettimeofday. - -Althoug it should incur in more overhead (specially for architecture that -support hp-timing), the symbol is also common implemented as a vDSO. - -Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also -checked on a i686-gnu build. - - * include/random-bits.h: New file. - * resolv/res_mkquery.c [HP_TIMING_AVAIL] (RANDOM_BITS, - (__res_context_mkquery): Remove usage hp-timing usage and replace with - random_bits. - * resolv/res_send.c [HP_TIMING_AVAIL] (nameserver_offset): Likewise. - * sysdeps/posix/tempname.c [HP_TIMING_AVAIL] (__gen_tempname): - Likewise. - -note that this patch is just parts of the origin one to adapt glibc-2.28  - - ---- - resolv/res_mkquery.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c -index 213abeef..7ba40640 100644 ---- a/resolv/res_mkquery.c -+++ b/resolv/res_mkquery.c -@@ -95,6 +95,7 @@ - - #include - #include -+#include - #if HP_TIMING_AVAIL - # define RANDOM_BITS(Var) { uint64_t v64; HP_TIMING_NOW (v64); Var = v64; } - #endif -@@ -124,9 +125,12 @@ __res_context_mkquery (struct resolv_context *ctx, int op, const char *dname, - #ifdef RANDOM_BITS - RANDOM_BITS (randombits); - #else -- struct timeval tv; -- __gettimeofday (&tv, NULL); -- randombits = (tv.tv_sec << 8) ^ tv.tv_usec; -+ struct timespec tv; -+ clock_gettime (CLOCK_MONOTONIC, &tv); -+ /* Shuffle the lower bits to minimize the clock bias. */ -+ uint32_t ret = tv.tv_nsec ^ tv.tv_sec; -+ ret ^= (ret << 24) | (ret >> 8); -+ randombits = ret; - #endif - - hp->id = randombits; --- -2.19.1 - diff --git a/backport-CVE-2020-1751-Fix-array-overflow-in-backtrace-on-PowerPC-bug-25423.patch b/backport-CVE-2020-1751-Fix-array-overflow-in-backtrace-on-PowerPC-bug-25423.patch deleted file mode 100644 index 4bb478d422938c94efa12de790ae6b124be22161..0000000000000000000000000000000000000000 --- a/backport-CVE-2020-1751-Fix-array-overflow-in-backtrace-on-PowerPC-bug-25423.patch +++ /dev/null @@ -1,68 +0,0 @@ -From d93769405996dfc11d216ddbe415946617b5a494 Mon Sep 17 00:00:00 2001 -From: Andreas Schwab -Date: Mon, 20 Jan 2020 17:01:50 +0100 -Subject: [PATCH] Fix array overflow in backtrace on PowerPC (bug 25423) - -When unwinding through a signal frame the backtrace function on PowerPC -didn't check array bounds when storing the frame address. Fixes commit -d400dcac5e ("PowerPC: fix backtrace to handle signal trampolines"). - -Signed-off-by: wuxu.wu ---- - debug/tst-backtrace5.c | 12 ++++++++++++ - sysdeps/powerpc/powerpc32/backtrace.c | 2 ++ - sysdeps/powerpc/powerpc64/backtrace.c | 2 ++ - 3 files changed, 16 insertions(+) - -diff --git a/debug/tst-backtrace5.c b/debug/tst-backtrace5.c -index e7ce410..b2f4616 100644 ---- a/debug/tst-backtrace5.c -+++ b/debug/tst-backtrace5.c -@@ -89,6 +89,18 @@ handle_signal (int signum) - } - /* Symbol names are not available for static functions, so we do not - check do_test. */ -+ -+ /* Check that backtrace does not return more than what fits in the array -+ (bug 25423). */ -+ for (int j = 0; j < NUM_FUNCTIONS; j++) -+ { -+ n = backtrace (addresses, j); -+ if (n > j) -+ { -+ FAIL (); -+ return; -+ } -+ } - } - - NO_INLINE int -diff --git a/sysdeps/powerpc/powerpc32/backtrace.c b/sysdeps/powerpc/powerpc32/backtrace.c -index 7c2d472..d1456c8 100644 ---- a/sysdeps/powerpc/powerpc32/backtrace.c -+++ b/sysdeps/powerpc/powerpc32/backtrace.c -@@ -114,6 +114,8 @@ __backtrace (void **array, int size) - } - if (gregset) - { -+ if (count + 1 == size) -+ break; - array[++count] = (void*)((*gregset)[PT_NIP]); - current = (void*)((*gregset)[PT_R1]); - } -diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c -index 65c260a..8a53a10 100644 ---- a/sysdeps/powerpc/powerpc64/backtrace.c -+++ b/sysdeps/powerpc/powerpc64/backtrace.c -@@ -87,6 +87,8 @@ __backtrace (void **array, int size) - if (is_sigtramp_address (current->return_address)) - { - struct signal_frame_64 *sigframe = (struct signal_frame_64*) current; -+ if (count + 1 == size) -+ break; - array[++count] = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_NIP]; - current = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_R1]; - } --- -1.8.3.1 - diff --git a/backport-Kunpeng-patches.patch b/backport-Kunpeng-patches.patch deleted file mode 100644 index 7b8fee0d0b9c6ab45153ddd493474592d7d72377..0000000000000000000000000000000000000000 --- a/backport-Kunpeng-patches.patch +++ /dev/null @@ -1,1088 +0,0 @@ -From 0dfa5db2106d75db595e83f064352fb89d92986e Mon Sep 17 00:00:00 2001 -From: wangbin224 -Date: Sat, 28 Mar 2020 19:14:41 +0800 -Subject: [PATCH] glibc: backport Kunpeng patches - -backport Kunpeng patches - -Signed-off-by: wangbin224 ---- - manual/tunables.texi | 2 +- - sysdeps/aarch64/memcmp.S | 4 +- - sysdeps/aarch64/memrchr.S | 15 +- - sysdeps/aarch64/multiarch/Makefile | 2 +- - sysdeps/aarch64/multiarch/ifunc-impl-list.c | 54 +- - sysdeps/aarch64/multiarch/memcpy.c | 9 +- - sysdeps/aarch64/multiarch/memcpy_kunpeng.S | 576 ------------------ - sysdeps/aarch64/multiarch/memmove.c | 11 +- - sysdeps/aarch64/multiarch/memset.c | 14 +- - sysdeps/aarch64/multiarch/memset_kunpeng.S | 58 +- - sysdeps/aarch64/strcpy.S | 6 +- - sysdeps/aarch64/strnlen.S | 4 +- - .../unix/sysv/linux/aarch64/cpu-features.c | 4 +- - .../unix/sysv/linux/aarch64/cpu-features.h | 7 +- - 14 files changed, 86 insertions(+), 680 deletions(-) - delete mode 100755 sysdeps/aarch64/multiarch/memcpy_kunpeng.S - -diff --git a/manual/tunables.texi b/manual/tunables.texi -index bb4819bd..124b39b6 100644 ---- a/manual/tunables.texi -+++ b/manual/tunables.texi -@@ -333,7 +333,7 @@ This tunable is specific to powerpc, powerpc64 and powerpc64le. - The @code{glibc.tune.cpu=xxx} tunable allows the user to tell @theglibc{} to - assume that the CPU is @code{xxx} where xxx may have one of these values: - @code{generic}, @code{falkor}, @code{thunderxt88}, @code{thunderx2t99}, --@code{thunderx2t99p1}. -+@code{thunderx2t99p1}, @code{kunpeng}. - - This tunable is specific to aarch64. - @end deftp -diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S -index 04129d83..a2138616 100644 ---- a/sysdeps/aarch64/memcmp.S -+++ b/sysdeps/aarch64/memcmp.S -@@ -1,6 +1,6 @@ - /* memcmp - compare memory - -- Copyright (C) 2013-2019 Free Software Foundation, Inc. -+ Copyright (C) 2013-2018 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - -@@ -16,7 +16,7 @@ - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see -- . */ -+ . */ - - #include - -diff --git a/sysdeps/aarch64/memrchr.S b/sysdeps/aarch64/memrchr.S -index 9095304b..0565168a 100644 ---- a/sysdeps/aarch64/memrchr.S -+++ b/sysdeps/aarch64/memrchr.S -@@ -16,8 +16,8 @@ - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see -- . */ -- -+ . */ -+ - #include - - /* Assumptions: -@@ -61,7 +61,7 @@ - * things occur in the original string, counting trailing zeros allows to - * identify exactly which byte has matched. - */ -- -+ - ENTRY (__memrchr) - /* Do not dereference srcin if no bytes to compare. */ - cbz cntin, L(zero_length) -@@ -101,7 +101,7 @@ ENTRY (__memrchr) - addp vend.16b, vend.16b, vend.16b /* 128->64 */ - mov synd, vend.2d[0] - /* Clear the (32-soff)*2 upper bits */ -- lsl tmp, soff, #1 -+ lsl tmp, soff, #1 - lsl synd, synd, tmp - lsr synd, synd, tmp - /* The first block can also be the last */ -@@ -135,16 +135,16 @@ L(end): - b.hi L(tail) - - L(masklast): -- /* Clear the (32 - ((cntrem + (32-soff)) % 32)) * 2 lower bits */ -+ /* Clear the (32 - ((cntrem + (32-soff)) % 32)) * 2 lower bits */ - add tmp, cntrem, soff - and tmp, tmp, #31 - sub tmp, tmp, #32 -- neg tmp, tmp, lsl #1 -+ neg tmp, tmp, lsl #1 - lsr synd, synd, tmp - lsl synd, synd, tmp - - L(tail): -- /* Compensate the last post-increment*/ -+ /* Compensate the last post-increment*/ - add seek_dst, seek_dst, #32 - /* Check that we have found a character */ - cmp synd, #0 -@@ -163,4 +163,3 @@ L(zero_length): - END (__memrchr) - weak_alias (__memrchr, memrchr) - libc_hidden_builtin_def (memrchr) -- -diff --git a/sysdeps/aarch64/multiarch/Makefile b/sysdeps/aarch64/multiarch/Makefile -index 90529d40..722ed824 100644 ---- a/sysdeps/aarch64/multiarch/Makefile -+++ b/sysdeps/aarch64/multiarch/Makefile -@@ -1,4 +1,4 @@ - ifeq ($(subdir),string) --sysdep_routines += memcpy_kunpeng memcpy_generic memcpy_thunderx memcpy_thunderx2 \ -+sysdep_routines += memcpy_generic memcpy_thunderx memcpy_thunderx2 \ - memcpy_falkor memmove_falkor memset_generic memset_falkor memset_kunpeng - endif -diff --git a/sysdeps/aarch64/multiarch/ifunc-impl-list.c b/sysdeps/aarch64/multiarch/ifunc-impl-list.c -index bef9b06d..0026dbba 100644 ---- a/sysdeps/aarch64/multiarch/ifunc-impl-list.c -+++ b/sysdeps/aarch64/multiarch/ifunc-impl-list.c -@@ -1,5 +1,5 @@ - /* Enumerate available IFUNC implementations of a function. AARCH64 version. -- Copyright (C) 2017-2019 Free Software Foundation, Inc. -+ Copyright (C) 2017-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -@@ -25,36 +25,34 @@ - #include - - /* Maximum number of IFUNC implementations. */ --#define MAX_IFUNC 5 -+#define MAX_IFUNC 4 - - size_t - __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array, - size_t max) - { -- assert(max >= MAX_IFUNC); -- -- size_t i = 0; -- -- INIT_ARCH(); -- -- /* Support sysdeps/aarch64/multiarch/memcpy.c and memmove.c. */ -- IFUNC_IMPL(i, name, memcpy, -- IFUNC_IMPL_ADD(array, i, memcpy, 1, __memcpy_thunderx) -- IFUNC_IMPL_ADD(array, i, memcpy, 1, __memcpy_thunderx2) -- IFUNC_IMPL_ADD(array, i, memcpy, 1, __memcpy_falkor) -- IFUNC_IMPL_ADD(array, i, memcpy, 1, __memcpy_kunpeng) -- IFUNC_IMPL_ADD(array, i, memcpy, 1, __memcpy_generic)) -- IFUNC_IMPL(i, name, memmove, -- IFUNC_IMPL_ADD(array, i, memmove, 1, __memmove_thunderx) -- IFUNC_IMPL_ADD(array, i, memmove, 1, __memmove_falkor) -- IFUNC_IMPL_ADD(array, i, memmove, 1, __memmove_kunpeng) -- IFUNC_IMPL_ADD(array, i, memmove, 1, __memmove_generic)) -- IFUNC_IMPL(i, name, memset, -- /* Enable this on non-falkor processors too so that other cores -- can do a comparative analysis with __memset_generic. */ -- IFUNC_IMPL_ADD(array, i, memset, (zva_size == 64), __memset_falkor) -- IFUNC_IMPL_ADD(array, i, memset, 1, __memset_generic) -- IFUNC_IMPL_ADD(array, i, memset, 1, __memset_kunpeng)) -- -- return i; -+ assert (max >= MAX_IFUNC); -+ -+ size_t i = 0; -+ -+ INIT_ARCH (); -+ -+ /* Support sysdeps/aarch64/multiarch/memcpy.c and memmove.c. */ -+ IFUNC_IMPL (i, name, memcpy, -+ IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_thunderx) -+ IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_thunderx2) -+ IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_falkor) -+ IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_generic)) -+ IFUNC_IMPL (i, name, memmove, -+ IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_thunderx) -+ IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_falkor) -+ IFUNC_IMPL_ADD (array, i, memmove, 1, __memmove_generic)) -+ IFUNC_IMPL (i, name, memset, -+ /* Enable this on non-falkor processors too so that other cores -+ can do a comparative analysis with __memset_generic. */ -+ IFUNC_IMPL_ADD (array, i, memset, (zva_size == 64), __memset_falkor) -+ IFUNC_IMPL_ADD (array, i, memset, 1, __memset_kunpeng) -+ IFUNC_IMPL_ADD (array, i, memset, 1, __memset_generic)) -+ -+ return i; - } -diff --git a/sysdeps/aarch64/multiarch/memcpy.c b/sysdeps/aarch64/multiarch/memcpy.c -index 150e1ca9..2d358a83 100644 ---- a/sysdeps/aarch64/multiarch/memcpy.c -+++ b/sysdeps/aarch64/multiarch/memcpy.c -@@ -1,5 +1,5 @@ - /* Multiple versions of memcpy. AARCH64 version. -- Copyright (C) 2017-2019 Free Software Foundation, Inc. -+ Copyright (C) 2017-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -@@ -32,14 +32,11 @@ extern __typeof (__redirect_memcpy) __memcpy_generic attribute_hidden; - extern __typeof (__redirect_memcpy) __memcpy_thunderx attribute_hidden; - extern __typeof (__redirect_memcpy) __memcpy_thunderx2 attribute_hidden; - extern __typeof (__redirect_memcpy) __memcpy_falkor attribute_hidden; --extern __typeof (__redirect_memcpy) __memcpy_kunpeng attribute_hidden; - - libc_ifunc (__libc_memcpy, -- IS_KUNPENG920(midr) -- ?__memcpy_kunpeng -- : (IS_THUNDERX (midr) -+ (IS_THUNDERX (midr) - ? __memcpy_thunderx -- : (IS_FALKOR (midr) || IS_PHECDA (midr) -+ : (IS_FALKOR (midr) || IS_PHECDA (midr) || IS_KUNPENG920 (midr) - ? __memcpy_falkor - : (IS_THUNDERX2 (midr) || IS_THUNDERX2PA (midr) - ? __memcpy_thunderx2 -diff --git a/sysdeps/aarch64/multiarch/memcpy_kunpeng.S b/sysdeps/aarch64/multiarch/memcpy_kunpeng.S -deleted file mode 100755 -index 2102478a..00000000 ---- a/sysdeps/aarch64/multiarch/memcpy_kunpeng.S -+++ /dev/null -@@ -1,576 +0,0 @@ --/* A Kunpeng Optimized memcpy implementation for AARCH64. -- Copyright (C) 2018-2019 Free Software Foundation, Inc. -- -- This file is part of the GNU C Library. -- -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- The GNU C Library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- . */ -- --#include -- --/* Assumptions: -- * -- * ARMv8-a, AArch64, unaligned accesses. -- * -- */ -- --#define dstin x0 --#define src x1 --#define count x2 --#define dst x3 --#define srcend x4 --#define dstend x5 --#define tmp2 x6 --#define tmp3 x7 --#define tmp3w w7 --#define A_l x6 --#define A_lw w6 --#define A_h x7 --#define A_hw w7 --#define B_l x8 --#define B_lw w8 --#define B_h x9 --#define C_l x10 --#define C_h x11 --#define D_l x12 --#define D_h x13 --#define E_l src --#define E_h count --#define F_l srcend --#define F_h dst --#define G_l count --#define G_h dst --#define tmp1 x14 -- --#define A_q q0 --#define B_q q1 --#define C_q q2 --#define D_q q3 --#define E_q q4 --#define F_q q5 --#define G_q q6 --#define H_q q7 --#define I_q q16 --#define J_q q17 -- --#define A_v v0 --#define B_v v1 --#define C_v v2 --#define D_v v3 --#define E_v v4 --#define F_v v5 --#define G_v v6 --#define H_v v7 --#define I_v v16 --#define J_v v17 -- --#ifndef MEMMOVE --# define MEMMOVE memmove --#endif --#ifndef MEMCPY --# define MEMCPY memcpy --#endif -- --#if IS_IN (libc) -- --#undef MEMCPY --#define MEMCPY __memcpy_kunpeng --#undef MEMMOVE --#define MEMMOVE __memmove_kunpeng -- -- --/* Overlapping large forward memmoves use a loop that copies backwards. -- Otherwise memcpy is used. Small moves branch to memcopy16 directly. -- The longer memcpy cases fall through to the memcpy head. --*/ -- --ENTRY_ALIGN (MEMMOVE, 6) -- -- DELOUSE (0) -- DELOUSE (1) -- DELOUSE (2) -- -- sub tmp1, dstin, src -- cmp count, 512 -- ccmp tmp1, count, 2, hi -- b.lo L(move_long) -- cmp count, 96 -- ccmp tmp1, count, 2, hi -- b.lo L(move_middle) -- --END (MEMMOVE) --libc_hidden_builtin_def (MEMMOVE) -- -- --/* Copies are split into 3 main cases: small copies of up to 16 bytes, -- medium copies of 17..96 bytes which are fully unrolled. Large copies -- of more than 96 bytes align the destination and use load-and-merge -- approach in the case src and dst addresses are unaligned not evenly, -- so that, actual loads and stores are always aligned. -- Large copies use the loops processing 64 bytes per iteration for -- unaligned case and 128 bytes per iteration for aligned ones. --*/ -- --#define MEMCPY_PREFETCH_LDR 640 -- -- .p2align 4 --ENTRY (MEMCPY) -- -- DELOUSE (0) -- DELOUSE (1) -- DELOUSE (2) -- -- add srcend, src, count -- cmp count, 16 -- b.ls L(memcopy16) -- add dstend, dstin, count -- cmp count, 96 -- b.hi L(memcopy_long) -- -- /* Medium copies: 17..96 bytes. */ -- ldr A_q, [src], #16 -- and tmp1, src, 15 -- ldr E_q, [srcend, -16] -- cmp count, 64 -- b.gt L(memcpy_copy96) -- cmp count, 48 -- b.le L(bytes_17_to_48) -- /* 49..64 bytes */ -- ldp B_q, C_q, [src] -- str E_q, [dstend, -16] -- stp A_q, B_q, [dstin] -- str C_q, [dstin, 32] -- ret -- --L(bytes_17_to_48): -- /* 17..48 bytes*/ -- cmp count, 32 -- b.gt L(bytes_32_to_48) -- /* 17..32 bytes*/ -- str A_q, [dstin] -- str E_q, [dstend, -16] -- ret -- --L(bytes_32_to_48): -- /* 32..48 */ -- ldr B_q, [src] -- str A_q, [dstin] -- str E_q, [dstend, -16] -- str B_q, [dstin, 16] -- ret -- -- .p2align 4 -- /* Small copies: 0..16 bytes. */ --L(memcopy16): -- cmp count, 8 -- b.lo L(bytes_0_to_8) -- ldr A_l, [src] -- ldr A_h, [srcend, -8] -- add dstend, dstin, count -- str A_l, [dstin] -- str A_h, [dstend, -8] -- ret -- .p2align 4 -- --L(bytes_0_to_8): -- tbz count, 2, L(bytes_0_to_3) -- ldr A_lw, [src] -- ldr A_hw, [srcend, -4] -- add dstend, dstin, count -- str A_lw, [dstin] -- str A_hw, [dstend, -4] -- ret -- -- /* Copy 0..3 bytes. Use a branchless sequence that copies the same -- byte 3 times if count==1, or the 2nd byte twice if count==2. */ --L(bytes_0_to_3): -- cbz count, 1f -- lsr tmp1, count, 1 -- ldrb A_lw, [src] -- ldrb A_hw, [srcend, -1] -- add dstend, dstin, count -- ldrb B_lw, [src, tmp1] -- strb B_lw, [dstin, tmp1] -- strb A_hw, [dstend, -1] -- strb A_lw, [dstin] --1: -- ret -- -- .p2align 4 -- --L(memcpy_copy96): -- /* Copying 65..96 bytes. A_q (first 16 bytes) and -- E_q(last 16 bytes) are already loaded. The size -- is large enough to benefit from aligned loads */ -- bic src, src, 15 -- ldp B_q, C_q, [src] -- /* Loaded 64 bytes, second 16-bytes chunk can be -- overlapping with the first chunk by tmp1 bytes. -- Stored 16 bytes. */ -- sub dst, dstin, tmp1 -- add count, count, tmp1 -- /* The range of count being [65..96] becomes [65..111] -- after tmp [0..15] gets added to it, -- count now is +48 */ -- cmp count, 80 -- b.gt L(copy96_medium) -- ldr D_q, [src, 32] -- stp B_q, C_q, [dst, 16] -- str D_q, [dst, 48] -- str A_q, [dstin] -- str E_q, [dstend, -16] -- ret -- -- .p2align 4 --L(copy96_medium): -- ldp D_q, G_q, [src, 32] -- cmp count, 96 -- b.gt L(copy96_large) -- stp B_q, C_q, [dst, 16] -- stp D_q, G_q, [dst, 48] -- str A_q, [dstin] -- str E_q, [dstend, -16] -- ret -- --L(copy96_large): -- ldr F_q, [src, 64] -- str B_q, [dst, 16] -- stp C_q, D_q, [dst, 32] -- stp G_q, F_q, [dst, 64] -- str A_q, [dstin] -- str E_q, [dstend, -16] -- ret -- -- .p2align 4 --L(memcopy_long): -- cmp count, 2048 -- b.ls L(copy2048_large) -- ldr A_q, [src], #16 -- and tmp1, src, 15 -- bic src, src, 15 -- ldp B_q, C_q, [src], #32 -- sub dst, dstin, tmp1 -- add count, count, tmp1 -- add dst, dst, 16 -- and tmp1, dst, 15 -- ldp D_q, E_q, [src], #32 -- str A_q, [dstin] -- -- /* Already loaded 64+16 bytes. Check if at -- least 64 more bytes left */ -- subs count, count, 64+64+16 -- b.lt L(loop128_exit0) -- cmp count, MEMCPY_PREFETCH_LDR + 64 + 32 -- b.lt L(loop128) -- cbnz tmp1, L(dst_unaligned) -- sub count, count, MEMCPY_PREFETCH_LDR + 64 + 32 -- -- .p2align 4 -- --L(loop128_prefetch): -- prfm pldl1strm, [src, MEMCPY_PREFETCH_LDR] -- ldp F_q, G_q, [src], #32 -- stp B_q, C_q, [dst], #32 -- ldp H_q, I_q, [src], #32 -- prfm pldl1strm, [src, MEMCPY_PREFETCH_LDR] -- ldp B_q, C_q, [src], #32 -- stp D_q, E_q, [dst], #32 -- ldp D_q, E_q, [src], #32 -- stp F_q, G_q, [dst], #32 -- stp H_q, I_q, [dst], #32 -- subs count, count, 128 -- b.ge L(loop128_prefetch) -- -- add count, count, MEMCPY_PREFETCH_LDR + 64 + 32 -- .p2align 4 --L(loop128): -- ldp F_q, G_q, [src], #32 -- ldp H_q, I_q, [src], #32 -- stp B_q, C_q, [dst], #32 -- stp D_q, E_q, [dst], #32 -- subs count, count, 64 -- b.lt L(loop128_exit1) -- ldp B_q, C_q, [src], #32 -- ldp D_q, E_q, [src], #32 -- stp F_q, G_q, [dst], #32 -- stp H_q, I_q, [dst], #32 -- subs count, count, 64 -- b.ge L(loop128) --L(loop128_exit0): -- ldp F_q, G_q, [srcend, -64] -- ldp H_q, I_q, [srcend, -32] -- stp B_q, C_q, [dst], #32 -- stp D_q, E_q, [dst] -- stp F_q, G_q, [dstend, -64] -- stp H_q, I_q, [dstend, -32] -- ret --L(loop128_exit1): -- ldp B_q, C_q, [srcend, -64] -- ldp D_q, E_q, [srcend, -32] -- stp F_q, G_q, [dst], #32 -- stp H_q, I_q, [dst] -- stp B_q, C_q, [dstend, -64] -- stp D_q, E_q, [dstend, -32] -- ret -- --L(copy2048_large): -- and tmp1, dstin, 15 -- bic dst, dstin, 15 -- ldp D_l, D_h, [src] -- sub src, src, tmp1 -- add count, count, tmp1 /* Count is now 16 too large. */ -- ldp A_l, A_h, [src, 16] -- stp D_l, D_h, [dstin] -- ldp B_l, B_h, [src, 32] -- ldp C_l, C_h, [src, 48] -- ldp D_l, D_h, [src, 64]! -- subs count, count, 128 + 16 /* Test and readjust count. */ -- b.ls L(last64) -- --L(loop64): -- stp A_l, A_h, [dst, 16] -- ldp A_l, A_h, [src, 16] -- stp B_l, B_h, [dst, 32] -- ldp B_l, B_h, [src, 32] -- stp C_l, C_h, [dst, 48] -- ldp C_l, C_h, [src, 48] -- stp D_l, D_h, [dst, 64] -- ldp D_l, D_h, [src, 64] -- add dst, dst, 64 -- add src, src, 64 -- subs count, count, 64 -- b.hi L(loop64) -- -- /* Write the last full set of 64 bytes. The remainder is at most 64 -- bytes, so it is safe to always copy 64 bytes from the end even if -- there is just 1 byte left. */ --L(last64): -- ldp E_l, E_h, [srcend, -64] -- stp A_l, A_h, [dst, 16] -- ldp A_l, A_h, [srcend, -48] -- stp B_l, B_h, [dst, 32] -- ldp B_l, B_h, [srcend, -32] -- stp C_l, C_h, [dst, 48] -- ldp C_l, C_h, [srcend, -16] -- stp D_l, D_h, [dst, 64] -- stp E_l, E_h, [dstend, -64] -- stp A_l, A_h, [dstend, -48] -- stp B_l, B_h, [dstend, -32] -- stp C_l, C_h, [dstend, -16] -- ret -- -- --L(dst_unaligned_tail): -- ldp C_q, D_q, [srcend, -64] -- ldp E_q, F_q, [srcend, -32] -- stp A_q, B_q, [dst], #32 -- stp H_q, I_q, [dst], #16 -- str G_q, [dst, tmp1] -- stp C_q, D_q, [dstend, -64] -- stp E_q, F_q, [dstend, -32] -- ret -- --L(dst_unaligned): -- /* For the unaligned store case the code loads two -- aligned chunks and then merges them using ext -- instruction. This can be up to 30% faster than -- the the simple unaligned store access. -- -- Current state: tmp1 = dst % 16; C_q, D_q, E_q -- contains data yet to be stored. src and dst points -- to next-to-be-processed data. A_q, B_q contains -- data already stored before, count = bytes left to -- be load decremented by 64. -- -- The control is passed here if at least 64 bytes left -- to be loaded. The code does two aligned loads and then -- extracts (16-tmp1) bytes from the first register and -- tmp1 bytes from the next register forming the value -- for the aligned store. -- -- As ext instruction can only have it's index encoded -- as immediate. 15 code chunks process each possible -- index value. Computed goto is used to reach the -- required code. */ -- -- /* Store the 16 bytes to dst and align dst for further -- operations, several bytes will be stored at this -- address once more */ -- -- ldp F_q, G_q, [src], #32 -- stp B_q, C_q, [dst], #32 -- bic dst, dst, 15 -- sub count, count, 32 -- adrp tmp2, L(ext_table) -- add tmp2, tmp2, :lo12:L(ext_table) -- add tmp2, tmp2, tmp1, LSL #2 -- ldr tmp3w, [tmp2] -- add tmp2, tmp2, tmp3w, SXTW -- br tmp2 -- --.p2align 4 -- /* to make the loop in each chunk 16-bytes aligned */ -- nop --#define EXT_CHUNK(shft) \ --L(ext_size_ ## shft):;\ -- ext A_v.16b, C_v.16b, D_v.16b, 16-shft;\ -- ext B_v.16b, D_v.16b, E_v.16b, 16-shft;\ -- ext H_v.16b, E_v.16b, F_v.16b, 16-shft;\ --1:;\ -- stp A_q, B_q, [dst], #32;\ -- prfm pldl1strm, [src, MEMCPY_PREFETCH_LDR];\ -- ldp C_q, D_q, [src], #32;\ -- ext I_v.16b, F_v.16b, G_v.16b, 16-shft;\ -- stp H_q, I_q, [dst], #32;\ -- ext A_v.16b, G_v.16b, C_v.16b, 16-shft;\ -- ext B_v.16b, C_v.16b, D_v.16b, 16-shft;\ -- ldp F_q, G_q, [src], #32;\ -- ext H_v.16b, D_v.16b, F_v.16b, 16-shft;\ -- subs count, count, 64;\ -- b.ge 1b;\ --2:;\ -- ext I_v.16b, F_v.16b, G_v.16b, 16-shft;\ -- b L(dst_unaligned_tail); -- --EXT_CHUNK(1) --EXT_CHUNK(2) --EXT_CHUNK(3) --EXT_CHUNK(4) --EXT_CHUNK(5) --EXT_CHUNK(6) --EXT_CHUNK(7) --EXT_CHUNK(8) --EXT_CHUNK(9) --EXT_CHUNK(10) --EXT_CHUNK(11) --EXT_CHUNK(12) --EXT_CHUNK(13) --EXT_CHUNK(14) --EXT_CHUNK(15) -- --.p2align 4 --L(move_long): --1: -- add srcend, src, count -- add dstend, dstin, count -- -- and tmp1, dstend, 15 -- ldr D_q, [srcend, -16] -- sub srcend, srcend, tmp1 -- sub count, count, tmp1 -- ldp A_q, B_q, [srcend, -32] -- str D_q, [dstend, -16] -- ldp C_q, D_q, [srcend, -64]! -- sub dstend, dstend, tmp1 -- subs count, count, 128 -- b.ls 2f -- --.p2align 4 --1: -- subs count, count, 64 -- stp A_q, B_q, [dstend, -32] -- ldp A_q, B_q, [srcend, -32] -- stp C_q, D_q, [dstend, -64]! -- ldp C_q, D_q, [srcend, -64]! -- b.hi 1b -- -- /* Write the last full set of 64 bytes. The remainder is at most 64 -- bytes, so it is safe to always copy 64 bytes from the start even if -- there is just 1 byte left. */ --2: -- ldp E_q, F_q, [src, 32] -- ldp G_q, H_q, [src] -- stp A_q, B_q, [dstend, -32] -- stp C_q, D_q, [dstend, -64] -- stp E_q, F_q, [dstin, 32] -- stp G_q, H_q, [dstin] --3: ret -- -- --.p2align 4 --L(move_middle): -- cbz tmp1, 3f -- add srcend, src, count -- prfm PLDL1STRM, [srcend, -64] -- add dstend, dstin, count -- and tmp1, dstend, 15 -- ldr D_q, [srcend, -16] -- sub srcend, srcend, tmp1 -- sub count, count, tmp1 -- ldr A_q, [srcend, -16] -- str D_q, [dstend, -16] -- ldr B_q, [srcend, -32] -- ldr C_q, [srcend, -48] -- ldr D_q, [srcend, -64]! -- sub dstend, dstend, tmp1 -- subs count, count, 128 -- b.ls 2f -- --1: -- str A_q, [dstend, -16] -- ldr A_q, [srcend, -16] -- str B_q, [dstend, -32] -- ldr B_q, [srcend, -32] -- str C_q, [dstend, -48] -- ldr C_q, [srcend, -48] -- str D_q, [dstend, -64]! -- ldr D_q, [srcend, -64]! -- subs count, count, 64 -- b.hi 1b -- -- /* Write the last full set of 64 bytes. The remainder is at most 64 -- bytes, so it is safe to always copy 64 bytes from the start even if -- there is just 1 byte left. */ --2: -- ldr G_q, [src, 48] -- str A_q, [dstend, -16] -- ldr A_q, [src, 32] -- str B_q, [dstend, -32] -- ldr B_q, [src, 16] -- str C_q, [dstend, -48] -- ldr C_q, [src] -- str D_q, [dstend, -64] -- str G_q, [dstin, 48] -- str A_q, [dstin, 32] -- str B_q, [dstin, 16] -- str C_q, [dstin] --3: ret -- -- --END (MEMCPY) -- .section .rodata -- .p2align 4 -- --L(ext_table): -- /* The first entry is for the alignment of 0 and is never -- actually used (could be any value). */ -- .word 0 -- .word L(ext_size_1) -. -- .word L(ext_size_2) -. -- .word L(ext_size_3) -. -- .word L(ext_size_4) -. -- .word L(ext_size_5) -. -- .word L(ext_size_6) -. -- .word L(ext_size_7) -. -- .word L(ext_size_8) -. -- .word L(ext_size_9) -. -- .word L(ext_size_10) -. -- .word L(ext_size_11) -. -- .word L(ext_size_12) -. -- .word L(ext_size_13) -. -- .word L(ext_size_14) -. -- .word L(ext_size_15) -. -- --libc_hidden_builtin_def (MEMCPY) --#endif -diff --git a/sysdeps/aarch64/multiarch/memmove.c b/sysdeps/aarch64/multiarch/memmove.c -index 0d8c85b4..e69d8162 100644 ---- a/sysdeps/aarch64/multiarch/memmove.c -+++ b/sysdeps/aarch64/multiarch/memmove.c -@@ -1,5 +1,5 @@ - /* Multiple versions of memmove. AARCH64 version. -- Copyright (C) 2017-2019 Free Software Foundation, Inc. -+ Copyright (C) 2017-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -@@ -31,16 +31,13 @@ extern __typeof (__redirect_memmove) __libc_memmove; - extern __typeof (__redirect_memmove) __memmove_generic attribute_hidden; - extern __typeof (__redirect_memmove) __memmove_thunderx attribute_hidden; - extern __typeof (__redirect_memmove) __memmove_falkor attribute_hidden; --extern __typeof (__redirect_memmove) __memmove_kunpeng attribute_hidden; -- -+ - libc_ifunc (__libc_memmove, -- (IS_KUNPENG920(midr) -- ?__memmove_kunpeng -- :(IS_THUNDERX (midr) -+ (IS_THUNDERX (midr) - ? __memmove_thunderx - : (IS_FALKOR (midr) || IS_PHECDA (midr) - ? __memmove_falkor -- : __memmove_generic)))); -+ : __memmove_generic))); - - # undef memmove - strong_alias (__libc_memmove, memmove); -diff --git a/sysdeps/aarch64/multiarch/memset.c b/sysdeps/aarch64/multiarch/memset.c -index 0f7ad0c8..f7ae291e 100644 ---- a/sysdeps/aarch64/multiarch/memset.c -+++ b/sysdeps/aarch64/multiarch/memset.c -@@ -1,5 +1,5 @@ - /* Multiple versions of memset. AARCH64 version. -- Copyright (C) 2017-2019 Free Software Foundation, Inc. -+ Copyright (C) 2017-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -@@ -29,15 +29,15 @@ - extern __typeof (__redirect_memset) __libc_memset; - - extern __typeof (__redirect_memset) __memset_falkor attribute_hidden; --extern __typeof (__redirect_memset) __memset_generic attribute_hidden; - extern __typeof (__redirect_memset) __memset_kunpeng attribute_hidden; -+extern __typeof (__redirect_memset) __memset_generic attribute_hidden; - - libc_ifunc (__libc_memset, -- IS_KUNPENG920(midr) -- ?__memset_kunpeng -- :((IS_FALKOR (midr) || IS_PHECDA (midr)) && zva_size == 64 -- ?__memset_falkor -- :__memset_generic)); -+ IS_KUNPENG920 (midr) -+ ?__memset_kunpeng -+ : ((IS_FALKOR (midr) || IS_PHECDA (midr)) && zva_size == 64 -+ ? __memset_falkor -+ : __memset_generic)); - - # undef memset - strong_alias (__libc_memset, memset); -diff --git a/sysdeps/aarch64/multiarch/memset_kunpeng.S b/sysdeps/aarch64/multiarch/memset_kunpeng.S -index 22a3d4a7..a03441ae 100644 ---- a/sysdeps/aarch64/multiarch/memset_kunpeng.S -+++ b/sysdeps/aarch64/multiarch/memset_kunpeng.S -@@ -1,4 +1,5 @@ --/* Copyright (C) 2012-2019 Free Software Foundation, Inc. -+/* Optimized memset for Huawei Kunpeng processor. -+ Copyright (C) 2012-2019 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - -@@ -14,7 +15,7 @@ - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see -- . */ -+ . */ - - #include - #include -@@ -35,7 +36,7 @@ ENTRY_ALIGN (MEMSET, 6) - - dup v0.16B, valw - add dstend, dstin, count -- -+ - cmp count, 128 - b.hs L(set_long) - -@@ -44,7 +45,7 @@ ENTRY_ALIGN (MEMSET, 6) - - /* Set 16..127 bytes. */ - str q0, [dstin] -- tbnz count, 6, L(set112) -+ tbnz count, 6, L(set127) - str q0, [dstend, -16] - tbz count, 5, 1f - str q0, [dstin, 16] -@@ -53,26 +54,14 @@ ENTRY_ALIGN (MEMSET, 6) - - .p2align 4 - /* Set 64..127 bytes. Write 64 bytes from the start and -- 32 bytes from the end. */ --L(set112): -- ands tmp1, dstin, 15 -- bne 2f -- str q0, [dstin, 16] -- stp q0, q0, [dstin, 32]//finish 64 -- tbz count, 5, 1f -- stp q0, q0, [dstin, 64] //大于96, finish 96 --1: stp q0, q0, [dstend, -32] -+ 64 bytes from the end. */ -+L(set127): -+ stp q0, q0, [dstin, 16] -+ str q0, [dstin, 48] -+ stp q0, q0, [dstend, -64] -+ stp q0, q0, [dstend, -32] - ret -- .p2align 4 --2: bic dst, dstin, 15//回退到16对齐 -- stp q0,q0, [dst, 16] -- str q0, [dst, 48] -- tbz count, 5, 3f //大于96 -- stp q0, q0, [dst, 64] --3: stp q0, q0, [dstend, -48]//finish 64~80 -- str q0, [dstend, -16]//finish 96 -- ret -- -+ - .p2align 4 - /* Set 0..15 bytes. */ - L(less16): -@@ -90,10 +79,9 @@ L(less8): - tbz count, 1, 3f - str h0, [dstend, -2] - 3: ret -- -+ - .p2align 4 --L(set_long): -- and valw, valw, 255 -+L(set_long): - bic dst, dstin, 15 - str q0, [dstin] - sub count, dstend, dst /* Count is 16 too large. */ -@@ -103,19 +91,21 @@ L(set_long): - stp q0, q0, [dst, 64]! - subs count, count, 64 - b.lo 1f -- stp q0, q0, [dst, 32] -+ stp q0, q0, [dst, 32] - stp q0, q0, [dst, 64]! - subs count, count, 64 - b.lo 1f -- stp q0, q0, [dst, 32] -+ stp q0, q0, [dst, 32] - stp q0, q0, [dst, 64]! - subs count, count, 64 -- b.hs 1b -- --1: tbz count, 5, 2f -- str q0, [dst, 32] -- str q0, [dst, 48] --2: stp q0, q0, [dstend, -32] -+ b.lo 1f -+ stp q0, q0, [dst, 32] -+ stp q0, q0, [dst, 64]! -+ subs count, count, 64 -+ b.hs 1b -+ -+1: stp q0, q0, [dstend, -64] -+ stp q0, q0, [dstend, -32] - ret - - END (MEMSET) -diff --git a/sysdeps/aarch64/strcpy.S b/sysdeps/aarch64/strcpy.S -index 290bcf8d..a64c5980 100644 ---- a/sysdeps/aarch64/strcpy.S -+++ b/sysdeps/aarch64/strcpy.S -@@ -1,5 +1,5 @@ - /* strcpy/stpcpy - copy a string returning pointer to start/end. -- Copyright (C) 2013-2019 Free Software Foundation, Inc. -+ Copyright (C) 2013-2018 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or -@@ -14,7 +14,7 @@ - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see -- . */ -+ . */ - - /* To build as stpcpy, define BUILD_STPCPY before compiling this file. - -@@ -232,7 +232,7 @@ L(entry_no_page_cross): - #ifdef __AARCH64EB__ - rev64 datav.16b, datav.16b - #endif -- /* loc */ -+ /* calculate the loc value */ - cmeq datav.16b, datav.16b, #0 - mov data1, datav.d[0] - mov data2, datav.d[1] -diff --git a/sysdeps/aarch64/strnlen.S b/sysdeps/aarch64/strnlen.S -index a57753b0..0a42f404 100644 ---- a/sysdeps/aarch64/strnlen.S -+++ b/sysdeps/aarch64/strnlen.S -@@ -1,6 +1,6 @@ - /* strnlen - calculate the length of a string with limit. - -- Copyright (C) 2013-2019 Free Software Foundation, Inc. -+ Copyright (C) 2013-2018 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - -@@ -16,7 +16,7 @@ - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see -- . */ -+ . */ - - #include - -diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c -index b152c4e3..e60485b0 100644 ---- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c -+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c -@@ -1,6 +1,6 @@ - /* Initialize CPU feature data. AArch64 version. - This file is part of the GNU C Library. -- Copyright (C) 2017-2019 Free Software Foundation, Inc. -+ Copyright (C) 2017-2018 Free Software Foundation, Inc. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -36,7 +36,7 @@ static struct cpu_list cpu_list[] = { - {"thunderx2t99", 0x431F0AF0}, - {"thunderx2t99p1", 0x420F5160}, - {"phecda", 0x680F0000}, -- {"kunpeng920", 0x481FD010}, -+ {"kunpeng920", 0x481FD010}, - {"generic", 0x0} - }; - -diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h -index 4faeed7a..ed77cde7 100644 ---- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h -+++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h -@@ -1,6 +1,6 @@ - /* Initialize CPU feature data. AArch64 version. - This file is part of the GNU C Library. -- Copyright (C) 2017-2019 Free Software Foundation, Inc. -+ Copyright (C) 2017-2018 Free Software Foundation, Inc. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public -@@ -51,8 +51,9 @@ - - #define IS_PHECDA(midr) (MIDR_IMPLEMENTOR(midr) == 'h' \ - && MIDR_PARTNUM(midr) == 0x000) --#define IS_KUNPENG920(midr) (MIDR_IMPLEMENTOR(midr) == 'H' \ -- && MIDR_PARTNUM(midr) == 0xd01) -+ -+#define IS_KUNPENG920(midr) (MIDR_IMPLEMENTOR(midr) == 'H' \ -+ && MIDR_PARTNUM(midr) == 0xd01) - - struct cpu_features - { --- -2.19.1 - diff --git a/build-locale-archive.c b/build-locale-archive.c deleted file mode 100644 index 9183972375dbd1e4239fc52c955d1c210de60d42..0000000000000000000000000000000000000000 --- a/build-locale-archive.c +++ /dev/null @@ -1,862 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../locale/hashval.h" -#define __LC_LAST 13 -#include "../locale/locarchive.h" -#include "../crypt/md5.h" - -const char *alias_file = DATADIR "/locale/locale.alias"; -const char *locar_file = PREFIX "/lib/locale/locale-archive"; -const char *tmpl_file = PREFIX "/lib/locale/locale-archive.tmpl"; -const char *loc_path = PREFIX "/lib/locale/"; -/* Flags set by `--verbose` option. */ -int be_quiet = 1; -int verbose = 0; -int max_locarchive_open_retry = 10; -const char *output_prefix; - -/* Endianness should have been taken care of by localedef. We don't need to do - additional swapping. We need this variable exported however, since - locarchive.c uses it to determine if it needs to swap endianness of a value - before writing to or reading from the archive. */ -bool swap_endianness_p = false; - -static const char *locnames[] = - { -#define DEFINE_CATEGORY(category, category_name, items, a) \ - [category] = category_name, -#include "../locale/categories.def" -#undef DEFINE_CATEGORY - }; - -static int -is_prime (unsigned long candidate) -{ - /* No even number and none less than 10 will be passed here. */ - unsigned long int divn = 3; - unsigned long int sq = divn * divn; - - while (sq < candidate && candidate % divn != 0) - { - ++divn; - sq += 4 * divn; - ++divn; - } - - return candidate % divn != 0; -} - -unsigned long -next_prime (unsigned long seed) -{ - /* Make it definitely odd. */ - seed |= 1; - - while (!is_prime (seed)) - seed += 2; - - return seed; -} - -void -error (int status, int errnum, const char *message, ...) -{ - va_list args; - - va_start (args, message); - fflush (stdout); - fprintf (stderr, "%s: ", program_invocation_name); - vfprintf (stderr, message, args); - va_end (args); - if (errnum) - fprintf (stderr, ": %s", strerror (errnum)); - putc ('\n', stderr); - fflush (stderr); - if (status) - exit (errnum == EROFS ? 0 : status); -} - -void * -xmalloc (size_t size) -{ - void *p = malloc (size); - if (p == NULL) - error (EXIT_FAILURE, errno, "could not allocate %zd bytes of memory", size); - return p; -} - -static void -open_tmpl_archive (struct locarhandle *ah) -{ - struct stat64 st; - int fd; - struct locarhead head; - const char *archivefname = ah->fname == NULL ? tmpl_file : ah->fname; - - /* Open the archive. We must have exclusive write access. */ - fd = open64 (archivefname, O_RDONLY); - if (fd == -1) - error (EXIT_FAILURE, errno, "cannot open locale archive template file \"%s\"", - archivefname); - - if (fstat64 (fd, &st) < 0) - error (EXIT_FAILURE, errno, "cannot stat locale archive template file \"%s\"", - archivefname); - - /* Read the header. */ - if (TEMP_FAILURE_RETRY (read (fd, &head, sizeof (head))) != sizeof (head)) - error (EXIT_FAILURE, errno, "cannot read archive header"); - - ah->fd = fd; - ah->mmaped = (head.sumhash_offset - + head.sumhash_size * sizeof (struct sumhashent)); - if (ah->mmaped > (unsigned long) st.st_size) - error (EXIT_FAILURE, 0, "locale archive template file truncated"); - ah->mmaped = st.st_size; - ah->reserved = st.st_size; - - /* Now we know how large the administrative information part is. - Map all of it. */ - ah->addr = mmap64 (NULL, ah->mmaped, PROT_READ, MAP_SHARED, fd, 0); - if (ah->addr == MAP_FAILED) - error (EXIT_FAILURE, errno, "cannot map archive header"); -} - -/* Open the locale archive. */ -extern void open_archive (struct locarhandle *ah, bool readonly); - -/* Close the locale archive. */ -extern void close_archive (struct locarhandle *ah); - -/* Add given locale data to the archive. */ -extern int add_locale_to_archive (struct locarhandle *ah, const char *name, - locale_data_t data, bool replace); - -extern void add_alias (struct locarhandle *ah, const char *alias, - bool replace, const char *oldname, - uint32_t *locrec_offset_p); - -extern struct namehashent * -insert_name (struct locarhandle *ah, - const char *name, size_t name_len, bool replace); - -struct nameent -{ - char *name; - struct locrecent *locrec; -}; - -struct dataent -{ - const unsigned char *sum; - uint32_t file_offset; -}; - -static int -nameentcmp (const void *a, const void *b) -{ - struct locrecent *la = ((const struct nameent *) a)->locrec; - struct locrecent *lb = ((const struct nameent *) b)->locrec; - uint32_t start_a = -1, end_a = 0; - uint32_t start_b = -1, end_b = 0; - int cnt; - - for (cnt = 0; cnt < __LC_LAST; ++cnt) - if (cnt != LC_ALL) - { - if (la->record[cnt].offset < start_a) - start_a = la->record[cnt].offset; - if (la->record[cnt].offset + la->record[cnt].len > end_a) - end_a = la->record[cnt].offset + la->record[cnt].len; - } - assert (start_a != (uint32_t)-1); - assert (end_a != 0); - - for (cnt = 0; cnt < __LC_LAST; ++cnt) - if (cnt != LC_ALL) - { - if (lb->record[cnt].offset < start_b) - start_b = lb->record[cnt].offset; - if (lb->record[cnt].offset + lb->record[cnt].len > end_b) - end_b = lb->record[cnt].offset + lb->record[cnt].len; - } - assert (start_b != (uint32_t)-1); - assert (end_b != 0); - - if (start_a != start_b) - return (int)start_a - (int)start_b; - return (int)end_a - (int)end_b; -} - -static int -dataentcmp (const void *a, const void *b) -{ - if (((const struct dataent *) a)->file_offset - < ((const struct dataent *) b)->file_offset) - return -1; - - if (((const struct dataent *) a)->file_offset - > ((const struct dataent *) b)->file_offset) - return 1; - - return 0; -} - -static int -sumsearchfn (const void *key, const void *ent) -{ - uint32_t keyn = *(uint32_t *)key; - uint32_t entn = ((struct dataent *)ent)->file_offset; - - if (keyn < entn) - return -1; - if (keyn > entn) - return 1; - return 0; -} - -static void -compute_data (struct locarhandle *ah, struct nameent *name, size_t sumused, - struct dataent *files, locale_data_t data) -{ - int cnt; - struct locrecent *locrec = name->locrec; - struct dataent *file; - data[LC_ALL].addr = ((char *) ah->addr) + locrec->record[LC_ALL].offset; - data[LC_ALL].size = locrec->record[LC_ALL].len; - for (cnt = 0; cnt < __LC_LAST; ++cnt) - if (cnt != LC_ALL) - { - data[cnt].addr = ((char *) ah->addr) + locrec->record[cnt].offset; - data[cnt].size = locrec->record[cnt].len; - if (data[cnt].addr >= data[LC_ALL].addr - && data[cnt].addr + data[cnt].size - <= data[LC_ALL].addr + data[LC_ALL].size) - __md5_buffer (data[cnt].addr, data[cnt].size, data[cnt].sum); - else - { - file = bsearch (&locrec->record[cnt].offset, files, sumused, - sizeof (*files), sumsearchfn); - if (file == NULL) - error (EXIT_FAILURE, 0, "inconsistent template file"); - memcpy (data[cnt].sum, file->sum, sizeof (data[cnt].sum)); - } - } -} - -static int -fill_archive (struct locarhandle *tmpl_ah, - const char *fname, - size_t install_langs_count, char *install_langs_list[], - size_t nlist, char *list[], - const char *primary) -{ - struct locarhandle ah; - struct locarhead *head; - int result = 0; - struct nameent *names; - struct namehashent *namehashtab; - size_t cnt, used; - struct dataent *files; - struct sumhashent *sumhashtab; - size_t sumused; - struct locrecent *primary_locrec = NULL; - struct nameent *primary_nameent = NULL; - - head = tmpl_ah->addr; - names = (struct nameent *) malloc (head->namehash_used - * sizeof (struct nameent)); - files = (struct dataent *) malloc (head->sumhash_used - * sizeof (struct dataent)); - if (names == NULL || files == NULL) - error (EXIT_FAILURE, errno, "could not allocate tables"); - - namehashtab = (struct namehashent *) ((char *) tmpl_ah->addr - + head->namehash_offset); - sumhashtab = (struct sumhashent *) ((char *) tmpl_ah->addr - + head->sumhash_offset); - - for (cnt = used = 0; cnt < head->namehash_size; ++cnt) - if (namehashtab[cnt].locrec_offset != 0) - { - char * name; - int i; - assert (used < head->namehash_used); - name = tmpl_ah->addr + namehashtab[cnt].name_offset; - if (install_langs_count == 0) - { - /* Always intstall the entry. */ - names[used].name = name; - names[used++].locrec - = (struct locrecent *) ((char *) tmpl_ah->addr + - namehashtab[cnt].locrec_offset); - } - else - { - /* Only install the entry if the user asked for it via - --install-langs. */ - for (i = 0; i < install_langs_count; i++) - { - /* Add one for "_" and one for the null terminator. */ - size_t len = strlen (install_langs_list[i]) + 2; - char *install_lang = (char *)xmalloc (len); - strcpy (install_lang, install_langs_list[i]); - if (strchr (install_lang, '_') == NULL) - strcat (install_lang, "_"); - if (strncmp (name, install_lang, strlen (install_lang)) == 0) - { - names[used].name = name; - names[used++].locrec - = (struct locrecent *) ((char *)tmpl_ah->addr - + namehashtab[cnt].locrec_offset); - } - free (install_lang); - } - } - } - - /* Sort the names. */ - qsort (names, used, sizeof (struct nameent), nameentcmp); - - for (cnt = sumused = 0; cnt < head->sumhash_size; ++cnt) - if (sumhashtab[cnt].file_offset != 0) - { - assert (sumused < head->sumhash_used); - files[sumused].sum = (const unsigned char *) sumhashtab[cnt].sum; - files[sumused++].file_offset = sumhashtab[cnt].file_offset; - } - - /* Sort by file locations. */ - qsort (files, sumused, sizeof (struct dataent), dataentcmp); - - /* Open the archive. This call never returns if we cannot - successfully open the archive. */ - ah.fname = NULL; - if (fname != NULL) - ah.fname = fname; - open_archive (&ah, false); - - if (primary != NULL) - { - for (cnt = 0; cnt < used; ++cnt) - if (strcmp (names[cnt].name, primary) == 0) - break; - if (cnt < used) - { - locale_data_t data; - - compute_data (tmpl_ah, &names[cnt], sumused, files, data); - result |= add_locale_to_archive (&ah, primary, data, 0); - primary_locrec = names[cnt].locrec; - primary_nameent = &names[cnt]; - } - } - - for (cnt = 0; cnt < used; ++cnt) - if (&names[cnt] == primary_nameent) - continue; - else if ((cnt > 0 && names[cnt - 1].locrec == names[cnt].locrec) - || names[cnt].locrec == primary_locrec) - { - const char *oldname; - struct namehashent *namehashent; - uint32_t locrec_offset; - - if (names[cnt].locrec == primary_locrec) - oldname = primary; - else - oldname = names[cnt - 1].name; - namehashent = insert_name (&ah, oldname, strlen (oldname), true); - assert (namehashent->name_offset != 0); - assert (namehashent->locrec_offset != 0); - locrec_offset = namehashent->locrec_offset; - add_alias (&ah, names[cnt].name, 0, oldname, &locrec_offset); - } - else - { - locale_data_t data; - - compute_data (tmpl_ah, &names[cnt], sumused, files, data); - result |= add_locale_to_archive (&ah, names[cnt].name, data, 0); - } - - while (nlist-- > 0) - { - const char *fname = *list++; - size_t fnamelen = strlen (fname); - struct stat64 st; - DIR *dirp; - struct dirent64 *d; - int seen; - locale_data_t data; - int cnt; - - /* First see whether this really is a directory and whether it - contains all the require locale category files. */ - if (stat64 (fname, &st) < 0) - { - error (0, 0, "stat of \"%s\" failed: %s: ignored", fname, - strerror (errno)); - continue; - } - if (!S_ISDIR (st.st_mode)) - { - error (0, 0, "\"%s\" is no directory; ignored", fname); - continue; - } - - dirp = opendir (fname); - if (dirp == NULL) - { - error (0, 0, "cannot open directory \"%s\": %s: ignored", - fname, strerror (errno)); - continue; - } - - seen = 0; - while ((d = readdir64 (dirp)) != NULL) - { - for (cnt = 0; cnt < __LC_LAST; ++cnt) - if (cnt != LC_ALL) - if (strcmp (d->d_name, locnames[cnt]) == 0) - { - unsigned char d_type; - - /* We have an object of the required name. If it's - a directory we have to look at a file with the - prefix "SYS_". Otherwise we have found what we - are looking for. */ -#ifdef _DIRENT_HAVE_D_TYPE - d_type = d->d_type; - - if (d_type != DT_REG) -#endif - { - char fullname[fnamelen + 2 * strlen (d->d_name) + 7]; - -#ifdef _DIRENT_HAVE_D_TYPE - if (d_type == DT_UNKNOWN) -#endif - { - strcpy (stpcpy (stpcpy (fullname, fname), "/"), - d->d_name); - - if (stat64 (fullname, &st) == -1) - /* We cannot stat the file, ignore it. */ - break; - - d_type = IFTODT (st.st_mode); - } - - if (d_type == DT_DIR) - { - /* We have to do more tests. The file is a - directory and it therefore must contain a - regular file with the same name except a - "SYS_" prefix. */ - char *t = stpcpy (stpcpy (fullname, fname), "/"); - strcpy (stpcpy (stpcpy (t, d->d_name), "/SYS_"), - d->d_name); - - if (stat64 (fullname, &st) == -1) - /* There is no SYS_* file or we cannot - access it. */ - break; - - d_type = IFTODT (st.st_mode); - } - } - - /* If we found a regular file (eventually after - following a symlink) we are successful. */ - if (d_type == DT_REG) - ++seen; - break; - } - } - - closedir (dirp); - - if (seen != __LC_LAST - 1) - { - /* We don't have all locale category files. Ignore the name. */ - error (0, 0, "incomplete set of locale files in \"%s\"", - fname); - continue; - } - - /* Add the files to the archive. To do this we first compute - sizes and the MD5 sums of all the files. */ - for (cnt = 0; cnt < __LC_LAST; ++cnt) - if (cnt != LC_ALL) - { - char fullname[fnamelen + 2 * strlen (locnames[cnt]) + 7]; - int fd; - - strcpy (stpcpy (stpcpy (fullname, fname), "/"), locnames[cnt]); - fd = open64 (fullname, O_RDONLY); - if (fd == -1 || fstat64 (fd, &st) == -1) - { - /* Cannot read the file. */ - if (fd != -1) - close (fd); - break; - } - - if (S_ISDIR (st.st_mode)) - { - char *t; - close (fd); - t = stpcpy (stpcpy (fullname, fname), "/"); - strcpy (stpcpy (stpcpy (t, locnames[cnt]), "/SYS_"), - locnames[cnt]); - - fd = open64 (fullname, O_RDONLY); - if (fd == -1 || fstat64 (fd, &st) == -1 - || !S_ISREG (st.st_mode)) - { - if (fd != -1) - close (fd); - break; - } - } - - /* Map the file. */ - data[cnt].addr = mmap64 (NULL, st.st_size, PROT_READ, MAP_SHARED, - fd, 0); - if (data[cnt].addr == MAP_FAILED) - { - /* Cannot map it. */ - close (fd); - break; - } - - data[cnt].size = st.st_size; - __md5_buffer (data[cnt].addr, st.st_size, data[cnt].sum); - - /* We don't need the file descriptor anymore. */ - close (fd); - } - - if (cnt != __LC_LAST) - { - while (cnt-- > 0) - if (cnt != LC_ALL) - munmap (data[cnt].addr, data[cnt].size); - - error (0, 0, "cannot read all files in \"%s\": ignored", fname); - - continue; - } - - result |= add_locale_to_archive (&ah, basename (fname), data, 0); - - for (cnt = 0; cnt < __LC_LAST; ++cnt) - if (cnt != LC_ALL) - munmap (data[cnt].addr, data[cnt].size); - } - - /* We are done. */ - close_archive (&ah); - - return result; -} - -void usage() -{ - printf ("\ -Usage: build-locale-archive [OPTION]... [TEMPLATE-FILE] [ARCHIVE-FILE]\n\ - Builds a locale archive from a template file.\n\ - Options:\n\ - -h, --help Print this usage message.\n\ - -v, --verbose Verbose execution.\n\ - -l, --install-langs=LIST Only include locales given in LIST into the \n\ - locale archive. LIST is a colon separated list\n\ - of locale prefixes, for example \"de:en:ja\".\n\ - The special argument \"all\" means to install\n\ - all languages and it must be present by itself.\n\ - If \"all\" is present with any other language it\n\ - will be treated as the name of a locale.\n\ - If the --install-langs option is missing, all\n\ - locales are installed. The colon separated list\n\ - can contain any strings matching the beginning of\n\ - locale names.\n\ - If a string does not contain a \"_\", it is added.\n\ - Examples:\n\ - --install-langs=\"en\"\n\ - installs en_US, en_US.iso88591,\n\ - en_US.iso885915, en_US.utf8,\n\ - en_GB ...\n\ - --install-langs=\"en_US.utf8\"\n\ - installs only en_US.utf8.\n\ - --install-langs=\"ko\"\n\ - installs ko_KR, ko_KR.euckr,\n\ - ko_KR.utf8 but *not* kok_IN\n\ - because \"ko\" does not contain\n\ - \"_\" and it is silently added\n\ - --install-langs\"ko:kok\"\n\ - installs ko_KR, ko_KR.euckr,\n\ - ko_KR.utf8, kok_IN, and\n\ - kok_IN.utf8.\n\ - --install-langs=\"POSIX\" will\n\ - installs *no* locales at all\n\ - because POSIX matches none of\n\ - the locales. Actually, any string\n\ - matching nothing will do that.\n\ - POSIX and C will always be\n\ - available because they are\n\ - builtin.\n\ - Aliases are installed as well,\n\ - i.e. --install-langs=\"de\"\n\ - will install not only every locale starting with\n\ - \"de\" but also the aliases \"deutsch\"\n\ - and and \"german\" although the latter does not\n\ - start with \"de\".\n\ -\n\ - If the arguments TEMPLATE-FILE and ARCHIVE-FILE are not given the locations\n\ - where the glibc used expects these files are used by default.\n\ -"); -} - -int main (int argc, char *argv[]) -{ - char path[4096]; - DIR *dirp; - struct dirent64 *d; - struct stat64 st; - char *list[16384], *primary; - char *lang; - int install_langs_count = 0; - int i; - char *install_langs_arg, *ila_start; - char **install_langs_list = NULL; - unsigned int cnt = 0; - struct locarhandle tmpl_ah; - char *new_locar_fname = NULL; - size_t loc_path_len = strlen (loc_path); - - while (1) - { - int c; - - static struct option long_options[] = - { - {"help", no_argument, 0, 'h'}, - {"verbose", no_argument, 0, 'v'}, - {"install-langs", required_argument, 0, 'l'}, - {0, 0, 0, 0} - }; - /* getopt_long stores the option index here. */ - int option_index = 0; - - c = getopt_long (argc, argv, "vhl:", - long_options, &option_index); - - /* Detect the end of the options. */ - if (c == -1) - break; - - switch (c) - { - case 0: - printf ("unknown option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf ("\n"); - usage (); - exit (1); - - case 'v': - verbose = 1; - be_quiet = 0; - break; - - case 'h': - usage (); - exit (0); - - case 'l': - install_langs_arg = ila_start = strdup (optarg); - /* If the argument to --install-lang is "all", do - not limit the list of languages to install and install - them all. We do not support installing a single locale - called "all". */ -#define MAGIC_INSTALL_ALL "all" - if (install_langs_arg != NULL - && install_langs_arg[0] != '\0' - && !(strncmp(install_langs_arg, MAGIC_INSTALL_ALL, - strlen(MAGIC_INSTALL_ALL)) == 0 - && strlen (install_langs_arg) == 3)) - { - /* Count the number of languages we will install. */ - while (true) - { - lang = strtok(install_langs_arg, ":;,"); - if (lang == NULL) - break; - install_langs_count++; - install_langs_arg = NULL; - } - free (ila_start); - - /* Reject an entire string made up of delimiters. */ - if (install_langs_count == 0) - break; - - /* Copy the list. */ - install_langs_list = (char **)xmalloc (sizeof(char *) * install_langs_count); - install_langs_arg = ila_start = strdup (optarg); - install_langs_count = 0; - while (true) - { - lang = strtok(install_langs_arg, ":;,"); - if (lang == NULL) - break; - install_langs_list[install_langs_count] = lang; - install_langs_count++; - install_langs_arg = NULL; - } - } - break; - - case '?': - /* getopt_long already printed an error message. */ - usage (); - exit (0); - - default: - abort (); - } - } - tmpl_ah.fname = NULL; - if (optind < argc) - tmpl_ah.fname = argv[optind]; - if (optind + 1 < argc) - new_locar_fname = argv[optind + 1]; - if (verbose) - { - if (tmpl_ah.fname) - printf("input archive file specified on command line: %s\n", - tmpl_ah.fname); - else - printf("using default input archive file.\n"); - if (new_locar_fname) - printf("output archive file specified on command line: %s\n", - new_locar_fname); - else - printf("using default output archive file.\n"); - } - - dirp = opendir (loc_path); - if (dirp == NULL) - error (EXIT_FAILURE, errno, "cannot open directory \"%s\"", loc_path); - - open_tmpl_archive (&tmpl_ah); - - if (new_locar_fname) - unlink (new_locar_fname); - else - unlink (locar_file); - primary = getenv ("LC_ALL"); - if (primary == NULL) - primary = getenv ("LANG"); - if (primary != NULL) - { - if (strncmp (primary, "ja", 2) != 0 - && strncmp (primary, "ko", 2) != 0 - && strncmp (primary, "zh", 2) != 0) - { - char *ptr = malloc (strlen (primary) + strlen (".utf8") + 1), *p, *q; - /* This leads to invalid locales sometimes: - de_DE.iso885915@euro -> de_DE.utf8@euro */ - if (ptr != NULL) - { - p = ptr; - q = primary; - while (*q && *q != '.' && *q != '@') - *p++ = *q++; - if (*q == '.') - while (*q && *q != '@') - q++; - p = stpcpy (p, ".utf8"); - strcpy (p, q); - primary = ptr; - } - else - primary = NULL; - } - } - - memcpy (path, loc_path, loc_path_len); - - while ((d = readdir64 (dirp)) != NULL) - { - if (strcmp (d->d_name, ".") == 0 || strcmp (d->d_name, "..") == 0) - continue; - if (strchr (d->d_name, '_') == NULL) - continue; - - size_t d_name_len = strlen (d->d_name); - if (loc_path_len + d_name_len + 1 > sizeof (path)) - { - error (0, 0, "too long filename \"%s\"", d->d_name); - continue; - } - - memcpy (path + loc_path_len, d->d_name, d_name_len + 1); - if (stat64 (path, &st) < 0) - { - error (0, errno, "cannot stat \"%s\"", path); - continue; - } - if (! S_ISDIR (st.st_mode)) - continue; - if (cnt == 16384) - { - error (0, 0, "too many directories in \"%s\"", loc_path); - break; - } - list[cnt] = strdup (path); - if (list[cnt] == NULL) - { - error (0, errno, "cannot add file to list \"%s\"", path); - continue; - } - if (primary != NULL && cnt > 0 && strcmp (primary, d->d_name) == 0) - { - char *p = list[0]; - list[0] = list[cnt]; - list[cnt] = p; - } - cnt++; - } - closedir (dirp); - /* Store the archive to the file specified as the second argument on the - command line or the default locale archive. */ - fill_archive (&tmpl_ah, new_locar_fname, - install_langs_count, install_langs_list, - cnt, list, primary); - close_archive (&tmpl_ah); - truncate (tmpl_file, 0); - if (install_langs_count > 0) - { - free (ila_start); - free (install_langs_list); - } - char *tz_argv[] = { "/usr/sbin/tzdata-update", NULL }; - execve (tz_argv[0], (char *const *)tz_argv, (char *const *)&tz_argv[1]); - exit (0); -} diff --git a/delete-no-hard-link-to-avoid-all_language-package-to.patch b/delete-no-hard-link-to-avoid-all_language-package-to.patch new file mode 100644 index 0000000000000000000000000000000000000000..1ccebcc7acf5de1724e075e2c12c47ce74523869 --- /dev/null +++ b/delete-no-hard-link-to-avoid-all_language-package-to.patch @@ -0,0 +1,26 @@ +From ba6891f0633d394a59d14f0a54090fa1b6260c16 Mon Sep 17 00:00:00 2001 +From: buque +Date: Wed, 15 Jul 2020 15:09:54 +0800 +Subject: [PATCH] delete --no-hard-link to avoid all_language package too + large. + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/localedata/Makefile b/localedata/Makefile +index b8a3b67..c78d0fe 100644 +--- a/localedata/Makefile ++++ b/localedata/Makefile +@@ -444,7 +444,7 @@ $(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir + $(build-one-locale) + + $(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir +- @flags="-c --no-archive --no-hard-links"; \ ++ @flags="-c --no-archive"; \ + $(build-one-locale) + + tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP +-- +2.25.1 + diff --git a/glibc-1070416.patch b/glibc-1070416.patch new file mode 100644 index 0000000000000000000000000000000000000000..0975e0fa98e39c499f61f933d5c2040c54d5835c --- /dev/null +++ b/glibc-1070416.patch @@ -0,0 +1,38 @@ +Short description: Add syslog.target dependency. +Author(s): Fedora glibc team +Origin: PATCH +Bug-Fedora: #1070416 +Upstream status: not-needed + +Fedora-specific changes to the nscd.service file. +See also: glibc-nscd-sysconfig.patch. + +--- a/nscd/nscd.service ++++ b/nscd/nscd.service +@@ -2,6 +2,7 @@ + + [Unit] + Description=Name Service Cache Daemon ++After=syslog.target + + [Service] + Type=forking +@@ -17,3 +18,4 @@ + + [Install] + WantedBy=multi-user.target ++Also=nscd.socket +diff --git a/nscd/nscd.socket b/nscd/nscd.socket +new file mode 100644 +index 0000000..7e512d5 +--- /dev/null ++++ b/nscd/nscd.socket +@@ -0,0 +1,8 @@ ++[Unit] ++Description=Name Service Cache Daemon Socket ++ ++[Socket] ++ListenDatagram=/var/run/nscd/socket ++ ++[Install] ++WantedBy=sockets.target diff --git a/glibc-2.28.tar.xz b/glibc-2.31.tar.xz similarity index 63% rename from glibc-2.28.tar.xz rename to glibc-2.31.tar.xz index ab67c77a436727f53dd5ff5e0c2b7d3a73eccd4a..366e70ca3f7be20a3ac4142c853a890d9eb296a8 100644 Binary files a/glibc-2.28.tar.xz and b/glibc-2.31.tar.xz differ diff --git a/glibc-c-utf8-locale.patch b/glibc-c-utf8-locale.patch new file mode 100644 index 0000000000000000000000000000000000000000..a4cf357a24cf0d111cb6ab2a812d1b4da9eb7878 --- /dev/null +++ b/glibc-c-utf8-locale.patch @@ -0,0 +1,286 @@ +Short description: Add C.UTF-8 support. +Author(s): Fedora glibc team +Origin: PATCH +Upstream status: not-submitted + +This patch needs to upstream as part of Carlos O'Donell +'s work on enabling upstream C.UTF-8 support. This +work is currently blocked on cleaning up the test results to prove that +full code-point sorting is working as intended. + +Note that this patch does not provide full code-point sorting as +expected. + +This patch needs to upstream as soon as possible since it would be nice +to have this in F29 and fixed. + +From 2eda7b462b415105f5a05c1323372d4e39d46439 Mon Sep 17 00:00:00 2001 +From: Mike FABIAN +Date: Mon, 10 Aug 2015 15:58:12 +0200 +Subject: [PATCH] Add a C.UTF-8 locale + +--- + localedata/SUPPORTED | 1 + + localedata/locales/C | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 239 insertions(+) + create mode 100644 localedata/locales/C + +diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED +index 8ca023e..2a78391 100644 +--- a/localedata/SUPPORTED ++++ b/localedata/SUPPORTED +@@ -1,6 +1,7 @@ + # This file names the currently supported and somewhat tested locales. + # If you have any additions please file a glibc bug report. + SUPPORTED-LOCALES=\ ++C.UTF-8/UTF-8 \ + aa_DJ.UTF-8/UTF-8 \ + aa_DJ/ISO-8859-1 \ + aa_ER/UTF-8 \ +diff --git a/localedata/locales/C b/localedata/locales/C +new file mode 100644 +index 0000000..fdf460e +--- /dev/null ++++ b/localedata/locales/C +@@ -0,0 +1,238 @@ ++escape_char / ++comment_char % ++% Locale for C locale in UTF-8 ++ ++LC_IDENTIFICATION ++title "C locale" ++source "" ++address "" ++contact "" ++email "mfabian@redhat.com" ++tel "" ++fax "" ++language "C" ++territory "" ++revision "1.0" ++date "2015-08-10" ++% ++category "i18n:2012";LC_IDENTIFICATION ++category "i18n:2012";LC_CTYPE ++category "i18n:2012";LC_COLLATE ++category "i18n:2012";LC_TIME ++category "i18n:2012";LC_NUMERIC ++category "i18n:2012";LC_MONETARY ++category "i18n:2012";LC_MESSAGES ++category "i18n:2012";LC_PAPER ++category "i18n:2012";LC_NAME ++category "i18n:2012";LC_ADDRESS ++category "i18n:2012";LC_TELEPHONE ++category "i18n:2012";LC_MEASUREMENT ++END LC_IDENTIFICATION ++ ++LC_CTYPE ++copy "i18n" ++ ++translit_start ++include "translit_combining";"" ++translit_end ++ ++END LC_CTYPE ++ ++LC_COLLATE ++order_start forward ++ ++.. ++ ++ ++.. ++ ++ ++.. ++ ++ ++.. ++ ++ ++.. ++ ++ ++.. ++ ++UNDEFINED ++order_end ++END LC_COLLATE ++ ++LC_MONETARY ++% This is the 14652 i18n fdcc-set definition for ++% the LC_MONETARY category ++% (except for the int_curr_symbol and currency_symbol, they are empty in ++% the 14652 i18n fdcc-set definition and also empty in ++% glibc/locale/C-monetary.c. But localedef complains in that case). ++% ++% Using "USD" for int_curr_symbol. But maybe "XXX" would be better? ++% XXX is "No currency" (https://en.wikipedia.org/wiki/ISO_4217) ++int_curr_symbol "" ++% Using "$" for currency_symbol. But maybe would be better? ++% U+00A4 is the "generic currency symbol" ++% (https://en.wikipedia.org/wiki/Currency_sign_%28typography%29) ++currency_symbol "" ++mon_decimal_point "" ++mon_thousands_sep "" ++mon_grouping -1 ++positive_sign "" ++negative_sign "" ++int_frac_digits -1 ++frac_digits -1 ++p_cs_precedes -1 ++int_p_sep_by_space -1 ++p_sep_by_space -1 ++n_cs_precedes -1 ++int_n_sep_by_space -1 ++n_sep_by_space -1 ++p_sign_posn -1 ++n_sign_posn -1 ++% ++END LC_MONETARY ++ ++LC_NUMERIC ++% This is the POSIX Locale definition for ++% the LC_NUMERIC category. ++% ++decimal_point "" ++thousands_sep "" ++grouping -1 ++END LC_NUMERIC ++ ++LC_TIME ++% This is the POSIX Locale definition for ++% the LC_TIME category. ++% ++% Abbreviated weekday names (%a) ++abday "";"";/ ++ "";"";/ ++ "";"";/ ++ "" ++ ++% Full weekday names (%A) ++day "";/ ++ "";/ ++ "";/ ++ "";/ ++ "";/ ++ "";/ ++ "" ++ ++% Abbreviated month names (%b) ++abmon "";"";/ ++ "";"";/ ++ "";"";/ ++ "";"";/ ++ "";"";/ ++ "";"" ++ ++% Full month names (%B) ++mon "";/ ++ "";/ ++ "";/ ++ "";/ ++ "";/ ++ "";/ ++ "";/ ++ "";/ ++ "";/ ++ "";/ ++ "";/ ++ "" ++ ++% Week description, consists of three fields: ++% 1. Number of days in a week. ++% 2. Gregorian date that is a first weekday (19971130 for Sunday, 19971201 for Monday). ++% 3. The weekday number to be contained in the first week of the year. ++% ++% ISO 8601 conforming applications should use the values 7, 19971201 (a ++% Monday), and 4 (Thursday), respectively. ++week 7;19971201;4 ++first_weekday 1 ++first_workday 1 ++ ++% Appropriate date and time representation (%c) ++% "%a %b %e %H:%M:%S %Y" ++d_t_fmt "" ++ ++% Appropriate date representation (%x) ++% "%m/%d/%y" ++d_fmt "" ++ ++% Appropriate time representation (%X) ++% "%H:%M:%S" ++t_fmt "" ++ ++% Appropriate AM/PM time representation (%r) ++% "%I:%M:%S %p" ++t_fmt_ampm "" ++ ++% Equivalent of AM/PM (%p) "AM"/"PM" ++% ++am_pm "";"" ++ ++% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y" ++date_fmt "" ++END LC_TIME ++ ++LC_MESSAGES ++% This is the POSIX Locale definition for ++% the LC_NUMERIC category. ++% ++yesexpr "" ++noexpr "" ++yesstr "" ++nostr "" ++END LC_MESSAGES ++ ++LC_PAPER ++% This is the ISO/IEC 14652 "i18n" definition for ++% the LC_PAPER category. ++% (A4 paper, this is also used in the built in C/POSIX ++% locale in glibc/locale/C-paper.c) ++height 297 ++width 210 ++END LC_PAPER ++ ++LC_NAME ++% This is the ISO/IEC 14652 "i18n" definition for ++% the LC_NAME category. ++% "%p%t%g%t%m%t%f" ++% (also used in the built in C/POSIX locale in glibc/locale/C-name.c) ++name_fmt "/ ++" ++END LC_NAME ++ ++LC_ADDRESS ++% This is the ISO/IEC 14652 "i18n" definition for ++% the LC_ADDRESS category. ++% "%a%N%f%N%d%N%b%N%s %h %e %r%N%C-%z %T%N%c%N" ++% (also used in the built in C/POSIX locale in glibc/locale/C-address.c) ++postal_fmt "/ ++/ ++/ ++/ ++" ++END LC_ADDRESS ++ ++LC_TELEPHONE ++% This is the ISO/IEC 14652 "i18n" definition for ++% the LC_TELEPHONE category. ++% "+%c %a %l" ++tel_int_fmt "/ ++" ++% (also used in the built in C/POSIX locale in glibc/locale/C-telephone.c) ++END LC_TELEPHONE ++ ++LC_MEASUREMENT ++% This is the ISO/IEC 14652 "i18n" definition for ++% the LC_MEASUREMENT category. ++% (same as in the built in C/POSIX locale in glibc/locale/C-measurement.c) ++%metric ++measurement 1 ++END LC_MEASUREMENT ++ +-- +2.4.3 + diff --git a/glibc.spec b/glibc.spec index e09acd1c6da4ad1365b32dd8c21d1f4a6b708130..7aa6d48a0aeca5d845c0cbfc1de67f44c26bc497 100644 --- a/glibc.spec +++ b/glibc.spec @@ -58,33 +58,34 @@ # glibc - The GNU C Library (glibc) core package. ############################################################################## Name: glibc -Version: 2.28 -Release: 45 +Version: 2.31 +Release: 1 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ Source0: https://ftp.gnu.org/gnu/glibc/%{name}-%{version}.tar.xz -Source1: build-locale-archive.c -Source2: nscd.conf -Source3: nsswitch.conf -Source4: bench.mk -Source5: glibc-bench-compare +Source1: nscd.conf +Source2: nsswitch.conf +Source3: bench.mk +Source4: glibc-bench-compare +Source5: LanguageList Source6: LicenseList -Source7: LanguageList - -Patch0: Fix-use-after-free-in-glob-when-expanding-user-bug-2.patch -Patch1: backport-Kunpeng-patches.patch -Patch2: Avoid-ldbl-96-stack-corruption-from-range-reduction-.patch -Patch3: backport-CVE-2020-1751-Fix-array-overflow-in-backtrace-on-PowerPC-bug-25423.patch -Patch4: Do-not-use-gettimeofday-in-random-id.patch -Patch5: Reset-converter-state-after-second-wchar_t-output-Bu.patch -Patch6: Fix-avx2-strncmp-offset-compare-condition-check-BZ-2.patch -Patch7: nptl-wait-for-pending-setxid-request-also-in-detache.patch -Patch8: x86-64-Use-RDX_LP-on-__x86_shared_non_temporal_thres.patch -Patch9: x86_64-Use-xmmN-with-vpxor-to-clear-a-vector-registe.patch -Patch10: nptl-Don-t-madvise-user-provided-stack.patch -Patch11: turn-REP_STOSB_THRESHOLD-from-2k-to-1M.patch + +Patch0: glibc-1070416.patch +Patch1: glibc-c-utf8-locale.patch + +Patch6000: Fix-use-after-free-in-glob-when-expanding-user-bug-2.patch +Patch6001: Avoid-ldbl-96-stack-corruption-from-range-reduction-.patch +Patch6002: Reset-converter-state-after-second-wchar_t-output-Bu.patch +Patch6003: Fix-avx2-strncmp-offset-compare-condition-check-BZ-2.patch +Patch6004: nptl-wait-for-pending-setxid-request-also-in-detache.patch +Patch6005: x86-64-Use-RDX_LP-on-__x86_shared_non_temporal_thres.patch +Patch6006: x86_64-Use-xmmN-with-vpxor-to-clear-a-vector-registe.patch +Patch6007: nptl-Don-t-madvise-user-provided-stack.patch +Patch6008: turn-REP_STOSB_THRESHOLD-from-2k-to-1M.patch + +Patch9000: delete-no-hard-link-to-avoid-all_language-package-to.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -121,7 +122,7 @@ BuildRequires: gcc-c++ libstdc++-static glibc-devel libidn2 Requires: glibc-common = %{version}-%{release} Requires: glibc-langpack = %{version}-%{release} -Requires(pre): basesystem +Requires: basesystem %description The GNU C Library project provides the core libraries for the GNU system and @@ -174,7 +175,7 @@ Obsoletes: %{name}-minimal-langpack = 2.28 %{lua: -- List the Symbol provided by all-langpacks lang_provides = {} -for line in io.lines(rpm.expand("%{SOURCE7}")) do +for line in io.lines(rpm.expand("%{SOURCE5}")) do print(rpm.expand([[ Provides:]]..line..[[ = %{version}-%{release} Obsoletes:]]..line..[[ = 2.28 @@ -208,7 +209,8 @@ Requires: %{name} = %{version}-%{release} Requires: libgcc%{_isa} Requires(pre): info Requires(pre): kernel-headers -Requires: kernel-headers >= 2.2.1 +Requires(pre): coreutils +Requires: kernel-headers >= 3.2 %if 0%{rpm_version_ge_412} Requires: libxcrypt-devel%{_isa} >= 4.0.0 Requires: libxcrypt-static%{?_isa} >= 4.0.0 @@ -380,7 +382,7 @@ touch locale/programs/*-kw.h ############################################################################## %build -BuildFlags="-O2 -g -Wno-error" +BuildFlags="-O2 -g" BuildFlags="$BuildFlags -DNDEBUG" reference=" \ "-Wp,-D_GLIBCXX_ASSERTIONS" \ @@ -390,6 +392,7 @@ reference=" \ "-m31" \ "-m32" \ "-m64" \ + "-march=haswell" \ "-march=i686" \ "-march=x86-64" \ "-march=z13" \ @@ -475,7 +478,7 @@ pushd build-%{target} # or create a hard link if there already has a output file who's input is the same, # so when we use parallel compilation, it will lead to different results, and this will cause BEP inconsistence. make -j1 install_root=$RPM_BUILD_ROOT \ - install-locales -C ../localedata objdir=`pwd` + install-locale-files -C ../localedata objdir=`pwd` popd rm -f $RPM_BUILD_ROOT/%{_libdir}/libNoVersion* @@ -513,16 +516,15 @@ rm -f locale-archive $olddir/build-%{target}/elf/ld.so \ --library-path $olddir/build-%{target}/ \ $olddir/build-%{target}/locale/localedef \ + --alias-file=$olddir/intl/locale.alias \ --prefix $RPM_BUILD_ROOT --add-to-archive \ - *_* -# Setup the locale-archive template for use by glibc-all-langpacks. -mv locale-archive{,.tmpl} + eo *_* %{find_lang} libc popd mv $RPM_BUILD_ROOT%{_prefix}/lib/locale/libc.lang . # Install configuration files for services -install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/nsswitch.conf +install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/nsswitch.conf mkdir -p $RPM_BUILD_ROOT/etc/default install -p -m 644 nis/nss $RPM_BUILD_ROOT/etc/default/nss @@ -530,7 +532,7 @@ install -p -m 644 nis/nss $RPM_BUILD_ROOT/etc/default/nss # This is for ncsd - in glibc 2.2 install -m 644 nscd/nscd.conf $RPM_BUILD_ROOT/etc mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir} -install -m 644 %{SOURCE2} %{buildroot}%{_tmpfilesdir} +install -m 644 %{SOURCE1} %{buildroot}%{_tmpfilesdir} mkdir -p $RPM_BUILD_ROOT/lib/systemd/system install -m 644 nscd/nscd.service nscd/nscd.socket $RPM_BUILD_ROOT/lib/systemd/system @@ -547,10 +549,6 @@ truncate -s 0 $RPM_BUILD_ROOT/etc/gai.conf truncate -s 0 $RPM_BUILD_ROOT%{_libdir}/gconv/gconv-modules.cache chmod 644 $RPM_BUILD_ROOT%{_libdir}/gconv/gconv-modules.cache -# Install the upgrade program -install -m 700 build-%{target}/elf/glibc_post_upgrade \ - $RPM_BUILD_ROOT%{_prefix}/sbin/glibc_post_upgrade.%{_target_cpu} - # Install debug copies of unstripped static libraries %if 0%{?_enable_debug_packages} mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/debug%{_libdir} @@ -565,20 +563,6 @@ rm -rf $RPM_BUILD_ROOT%{_prefix}/share/zoneinfo touch -r %{SOURCE0} $RPM_BUILD_ROOT/etc/ld.so.conf touch -r sunrpc/etc.rpc $RPM_BUILD_ROOT/etc/rpc -pushd build-%{target} -%GCC -Os -g -o build-locale-archive %{SOURCE1} \ - ../build-%{target}/locale/locarchive.o \ - ../build-%{target}/locale/md5.o \ - ../build-%{target}/locale/record-status.o \ - -I. -DDATADIR=\"%{_datadir}\" -DPREFIX=\"%{_prefix}\" \ - -L../build-%{target} \ - -B../build-%{target}/csu/ -lc -lc_nonshared \ - -Wl,-dynamic-linker=/lib64/ld-%{version}.so \ - -Wl,-rpath-link=.:./math:./elf:./dlfcn:./nss:./rt:./resolv:./mathvec:./support:./nptl libc.so.6 libc_nonshared.a \ - -Wl,--as-needed $olddir/build-%{target}/elf/ld.so -install -m 700 build-locale-archive $RPM_BUILD_ROOT%{_prefix}/sbin/build-locale-archive -popd - # Lastly copy some additional documentation for the packages. rm -rf documentation mkdir documentation @@ -596,7 +580,7 @@ mkdir -p $RPM_BUILD_ROOT%{_prefix}/libexec/glibc-benchtests cp $(find build-%{target}/benchtests -type f -executable) $RPM_BUILD_ROOT%{_prefix}/libexec/glibc-benchtests/ #makefile. -for b in %{SOURCE4} %{SOURCE5}; do +for b in %{SOURCE3} %{SOURCE4}; do cp $b $RPM_BUILD_ROOT%{_prefix}/libexec/glibc-benchtests/ done @@ -618,7 +602,6 @@ popd rm -f $RPM_BUILD_ROOT%{_infodir}/dir %endif -truncate -s 0 $RPM_BUILD_ROOT/%{_prefix}/lib/locale/locale-archive mkdir -p $RPM_BUILD_ROOT/var/{db,run}/nscd touch $RPM_BUILD_ROOT/var/{db,run}/nscd/{passwd,group,hosts,services} touch $RPM_BUILD_ROOT/var/run/nscd/{socket,nscd.pid} @@ -706,14 +689,13 @@ cat master.filelist \ -e 'nscd' \ -e '%{_prefix}/bin' \ -e '%{_prefix}/lib/locale' \ - -e '%{_prefix}/sbin/[^gi]' \ + -e '%{_prefix}/sbin/[^i]' \ -e '%{_prefix}/share' \ -e '/var/db/Makefile' \ -e '/libnss_.*\.so[0-9.]*$' \ -e '/libnsl' \ -e 'glibc-benchtests' \ -e 'aux-cache' \ - -e 'build-locale-archive' \ > glibc.filelist for module in compat files dns; do @@ -728,7 +710,8 @@ grep -e "libmemusage.so" -e "libpcprofile.so" master.filelist >> glibc.filelist # glibc "common" sub-package ############################################################################## grep '%{_prefix}/bin' master.filelist > common.filelist -grep '%{_prefix}/sbin/[^gi]' master.filelist \ +grep '%{_prefix}/sbin' master.filelist \ + | grep -v '%{_prefix}/sbin/iconvconfig' \ | grep -v 'nscd' >> common.filelist grep '%{_prefix}/share' master.filelist \ @@ -738,8 +721,6 @@ grep '%{_prefix}/share' master.filelist \ -e '%%dir %{prefix}/share' \ >> common.filelist -echo '%{_prefix}/sbin/build-locale-archive' >> common.filelist - ############################################################################### # glibc "devel" sub-package ############################################################################### @@ -808,7 +789,7 @@ find build-%{target}/benchtests -type f -executable | while read b; do echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)" done > benchtests.filelist # ... and the makefile. -for b in %{SOURCE4} %{SOURCE5}; do +for b in %{SOURCE3} %{SOURCE4}; do echo "%{_prefix}/libexec/glibc-benchtests/$(basename $b)" >> benchtests.filelist done # ... and finally, the comparison scripts. @@ -859,6 +840,7 @@ remove_dir="$remove_dir $(echo %{_prefix}/lib/debug%{_prefix}{,/%{_lib},/libexec for d in $(echo $remove_dir | sed 's/ /\n/g'); do sed -i "\|^%%dir $d/\?$|d" debuginfo.filelist done + %endif # %{with benchtests} ############################################################################## # Run the glibc testsuite @@ -933,20 +915,131 @@ if rpm.vercmp(rel, required) < 0 then error("FATAL: kernel too old", 0) end -%post -p %{_prefix}/sbin/glibc_post_upgrade.%{_target_cpu} - -%posttrans common -e -p -if posix.stat("%{_prefix}/lib/locale/locale-archive.tmpl", "size") > 0 then - pid = posix.fork() +%post -p +-- We use lua's posix.exec because there may be no shell that we can +-- run during glibc upgrade. +function post_exec (program, ...) + local pid = posix.fork () if pid == 0 then - posix.exec("%{_prefix}/sbin/build-locale-archive", "--install-langs", "%%{_install_langs}") + assert (posix.exec (program, ...)) elseif pid > 0 then - posix.wait(pid) + posix.wait (pid) + end +end + +-- (1) Remove multilib libraries from previous installs. +-- In order to support in-place upgrades, we must immediately remove +-- obsolete platform directories after installing a new glibc +-- version. RPM only deletes files removed by updates near the end +-- of the transaction. If we did not remove the obsolete platform +-- directories here, they may be preferred by the dynamic linker +-- during the execution of subsequent RPM scriptlets, likely +-- resulting in process startup failures. + +-- Full set of libraries glibc may install. +install_libs = { "anl", "BrokenLocale", "c", "dl", "m", "mvec", + "nss_compat", "nss_db", "nss_dns", "nss_files", + "nss_hesiod", "pthread", "resolv", "rt", "SegFault", + "thread_db", "util" } + +-- We are going to remove these libraries. Generally speaking we remove +-- all core libraries in the multilib directory. +-- We employ a tight match where X.Y is in [2.0,9.9*], so we would +-- match "libc-2.0.so" and so on up to "libc-9.9*". +remove_regexps = {} +for i = 1, #install_libs do + remove_regexps[i] = ("lib" .. install_libs[i] + .. "%%-[2-9]%%.[0-9]+%%.so$") +end + +-- Two exceptions: +remove_regexps[#install_libs + 1] = "libthread_db%%-1%%.0%%.so" +remove_regexps[#install_libs + 2] = "libSegFault%%.so" + +-- We are going to search these directories. +local remove_dirs = { "%{_libdir}/i686", + "%{_libdir}/i686/nosegneg" } + +-- Walk all the directories with files we need to remove... +for _, rdir in ipairs (remove_dirs) do + if posix.access (rdir) then + -- If the directory exists we look at all the files... + local remove_files = posix.files (rdir) + for rfile in remove_files do + for _, rregexp in ipairs (remove_regexps) do + -- Does it match the regexp? + local dso = string.match (rfile, rregexp) + if (dso ~= nil) then + -- Removing file... + os.remove (rdir .. '/' .. rfile) + end + end + end + end +end + +-- (2) Update /etc/ld.so.conf +-- Next we update /etc/ld.so.conf to ensure that it starts with +-- a literal "include ld.so.conf.d/*.conf". + +local ldsoconf = "/etc/ld.so.conf" +local ldsoconf_tmp = "/etc/glibc_post_upgrade.ld.so.conf" + +if posix.access (ldsoconf) then + + -- We must have a "include ld.so.conf.d/*.conf" line. + local have_include = false + for line in io.lines (ldsoconf) do + -- This must match, and we don't ignore whitespace. + if string.match (line, "^include ld.so.conf.d/%%*%%.conf$") ~= nil then + have_include = true + end + end + + if not have_include then + -- Insert "include ld.so.conf.d/*.conf" line at the start of the + -- file. We only support one of these post upgrades running at + -- a time (temporary file name is fixed). + local tmp_fd = io.open (ldsoconf_tmp, "w") + if tmp_fd ~= nil then + tmp_fd:write ("include ld.so.conf.d/*.conf\n") + for line in io.lines (ldsoconf) do + tmp_fd:write (line .. "\n") + end + tmp_fd:close () + local res = os.rename (ldsoconf_tmp, ldsoconf) + if res == nil then + io.stdout:write ("Error: Unable to update configuration file (rename).\n") + end + else + io.stdout:write ("Error: Unable to update configuration file (open).\n") + end end end -%postun common -p -os.remove("%{_prefix}/lib/locale/locale-archive") +-- (3) Rebuild ld.so.cache early. +-- If the format of the cache changes then we need to rebuild +-- the cache early to avoid any problems running binaries with +-- the new glibc. + +-- Note: We use _prefix because Fedora's UsrMove says so. +post_exec ("%{_prefix}/sbin/ldconfig") + +-- (4) Update gconv modules cache. +-- If the /usr/lib/gconv/gconv-modules.cache exists, then update it +-- with the latest set of modules that were just installed. +-- We assume that the cache is in _libdir/gconv and called +-- "gconv-modules.cache". +local iconv_dir = "%{_libdir}/gconv" +local iconv_cache = iconv_dir .. "/gconv-modules.cache" +if (posix.utime (iconv_cache) == 0) then + post_exec ("%{_prefix}/sbin/iconvconfig", + "-o", iconv_cache, + "--nostdlib", + iconv_dir) +else + io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n") +end %pre devel # this used to be a link and it is causing nightmares now @@ -954,16 +1047,6 @@ if [ -L %{_prefix}/include/scsi ] ; then rm -f %{_prefix}/include/scsi fi -%if %{with docs} -%post devel -/sbin/install-info %{_infodir}/libc.info.gz %{_infodir}/dir > /dev/null 2>&1 || : - -%preun devel -if [ "$1" = 0 ]; then - /sbin/install-info --delete %{_infodir}/libc.info.gz %{_infodir}/dir > /dev/null 2>&1 || : -fi -%endif - %pre -n nscd getent group nscd >/dev/null || /usr/sbin/groupadd -g 28 -r nscd getent passwd nscd >/dev/null || @@ -1001,7 +1084,6 @@ fi %license COPYING COPYING.LIB LICENSES %files -f common.filelist common -%attr(0644,root,root) %verify(not md5 size mtime) %{_prefix}/lib/locale/locale-archive.tmpl %attr(0644,root,root) %verify(not md5 size mtime mode) %ghost %config(missingok,noreplace) %{_prefix}/lib/locale/locale-archive %dir %{_prefix}/lib/locale %dir %{_prefix}/lib/locale/C.utf8 @@ -1016,7 +1098,6 @@ fi %files -f libc.lang all-langpacks %{_prefix}/lib/locale %exclude %{_prefix}/lib/locale/locale-archive -%exclude %{_prefix}/lib/locale/locale-archive.tmpl %exclude %{_prefix}/lib/locale/C.utf8 %exclude %{_prefix}/lib/locale/zh_CN.utf8 %exclude %{_prefix}/lib/locale/en_US.utf8 @@ -1066,10 +1147,11 @@ fi %if 0%{?_enable_debug_packages} %files -f debuginfo.filelist debuginfo - + %files debugsource %endif + %files help #Doc of glibc package %doc README NEWS INSTALL elf/rtld-debugger-interface.txt @@ -1080,6 +1162,14 @@ fi %doc hesiod/README.hesiod %changelog +* Thu Jul 9 2020 wuxu - 2.31-1 +- upgrade glibc to 2.31-1 +- delete build-locale-archive command +- delete nsswitch.conf file +- replace glibc_post_upgrade function with lua +- remove sys/sysctl.h header file +- delete stime, ftime function + * Tue Jul 7 2020 Wang Shuo - 2.28-45 - disable rpc, it has been splited to libnss and libtirpc - disable parallel compilation diff --git a/glibc.yaml b/glibc.yaml index 31a5cff5eda327683ba836ec7d01fe446cf3e862..f05a8d9682b0c7d61ca33dd21313d04ce9d59a22 100644 --- a/glibc.yaml +++ b/glibc.yaml @@ -1,4 +1,4 @@ version_control: git src_repo: git://sourceware.org/git/glibc.git -tag_prefix: "glibc-" +tag_prefix: glibc- seperator: "." diff --git a/nptl-Don-t-madvise-user-provided-stack.patch b/nptl-Don-t-madvise-user-provided-stack.patch index 777095ae004669dfc808ede56136aa7047438e98..41937de79ab7ad15cb30f6c6de0bfbc91a91fb28 100644 --- a/nptl-Don-t-madvise-user-provided-stack.patch +++ b/nptl-Don-t-madvise-user-provided-stack.patch @@ -24,7 +24,7 @@ diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 179f07a1..00931c19 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c -@@ -573,8 +573,9 @@ START_THREAD_DEFN +@@ -564,8 +564,9 @@ START_THREAD_DEFN } #endif diff --git a/nptl-wait-for-pending-setxid-request-also-in-detache.patch b/nptl-wait-for-pending-setxid-request-also-in-detache.patch index 750dadb7a84c855e26976db79d8e7e89c2199bb9..604e0b7d1eacb7aefcf304d717e36f2ad08f9fd8 100644 --- a/nptl-wait-for-pending-setxid-request-also-in-detache.patch +++ b/nptl-wait-for-pending-setxid-request-also-in-detache.patch @@ -22,7 +22,7 @@ diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index afd379e89a..a43089065c 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c -@@ -552,11 +552,7 @@ START_THREAD_DEFN +@@ -567,11 +567,7 @@ START_THREAD_DEFN advise_stack_range (pd->stackblock, pd->stackblock_size, (uintptr_t) pd, pd->guardsize); @@ -35,7 +35,7 @@ index afd379e89a..a43089065c 100644 { /* Some other thread might call any of the setXid functions and expect us to reply. In this case wait until we did that. */ -@@ -572,6 +568,11 @@ START_THREAD_DEFN +@@ -587,6 +583,11 @@ START_THREAD_DEFN pd->setxid_futex = 0; }