2.32 upgrade

This commit is contained in:
Alexander Stefanov 2020-09-14 19:56:04 +00:00
parent 95eba39da1
commit 645c59b3af
37 changed files with 15389 additions and 778 deletions

View file

@ -1,3 +1,3 @@
sources:
glibc-2.31.tar.xz: 55619672e5e13996e264d408949eb4aaa26e7ec8
glibc-2.32.tar.xz: 71ff0af28bdf4525d7b91ec5d82d1fc002000e91
glibc-manpages.tar.bz2: ca54bfb832b703c8e35170fcc1c1f5470b45ff0f

View file

@ -0,0 +1,95 @@
From 2efa9591e5e8a129e7b73ad0dad3eecbd69482ff Mon Sep 17 00:00:00 2001
From: "Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com>
Date: Tue, 30 Jul 2019 16:44:27 -0700
Subject: [PATCH] HACK: test app for pthread_mutex_lock_any(); should be
tst-mutex* something.
---
multimutextestapp/testapp.c | 78 +++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
create mode 100644 multimutextestapp/testapp.c
diff --git a/multimutextestapp/testapp.c b/multimutextestapp/testapp.c
new file mode 100644
index 0000000000..eecf842dbc
--- /dev/null
+++ b/multimutextestapp/testapp.c
@@ -0,0 +1,78 @@
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+static pthread_mutex_t m[3];
+
+
+static void *
+tf (void *arg)
+{
+ int out;
+ int ret = pthread_mutex_lock_any( m, 3, &out );
+
+ printf("new thread ret %i out %i!\n", ret, out );
+
+ sleep(5);
+ printf("new thread done sleeping!\n");
+
+ pthread_mutex_unlock( &m[out] );
+
+ return NULL;
+}
+
+
+int main(int ac, char**av)
+{
+ pthread_mutex_init (&m[0], NULL);
+ pthread_mutex_init (&m[1], NULL);
+ pthread_mutex_init (&m[2], NULL);
+
+ int out;
+
+ int ret = pthread_mutex_lock_any( m, 3, &out );
+
+ printf("main thread ret %i out %i!\n", ret, out );
+
+
+ pthread_t th;
+ if (pthread_create (&th, NULL, tf, NULL) != 0)
+ {
+ puts ("create failed");
+ return 1;
+ }
+
+ sleep(1);
+
+ ret = pthread_mutex_lock_any( m, 3, &out );
+
+ printf("main thread ret %i out %i!\n", ret, out );
+
+ sleep(1);
+
+ struct timespec timeoutTime;
+ clock_gettime(CLOCK_REALTIME, &timeoutTime);
+ timeoutTime.tv_sec += 1;
+
+ ret = pthread_mutex_timedlock_any( m, 3, &timeoutTime, &out );
+
+ printf("main thread ret %i out %i!\n", ret, out );
+
+ clock_gettime(CLOCK_REALTIME, &timeoutTime);
+ timeoutTime.tv_sec += 3;
+
+ ret = pthread_mutex_timedlock_any( m, 3, &timeoutTime, &out );
+
+ printf("main thread ret %i out %i!\n", ret, out );
+
+ pthread_mutex_unlock( &m[out] );
+ pthread_mutex_unlock( &m[0] );
+ pthread_mutex_unlock( &m[2] );
+
+ printf("DONE unlock!\n");
+
+ return 0;
+}

View file

@ -0,0 +1,382 @@
From 4483f2500825a84382c2a6a9ac60fc77954533d7 Mon Sep 17 00:00:00 2001
From: Mike Lothian <mike@fireburn.co.uk>
Date: Tue, 4 Feb 2020 11:04:42 +0000
Subject: [PATCH] Implement pthread_mutex_lock_any() and
pthread_mutex_timedlock_any().
On newer Linux kernels, futex supports a WAIT_MULTIPLE operation that can be
used to implement new locking functionality that allows a given application
thread to sleep while waiting for one of multiple given locks to become
available.
Patch-by: Pierre-Loup A. Griffais <pgriffais@valvesoftware.com>
Rebased-by: Mike Lothian <mike@fireburn.co.uk>
---
nptl/Makefile | 1 +
nptl/Versions | 2 +
nptl/pthreadP.h | 5 +
nptl/pthread_mutex_lock_any.c | 37 ++++
nptl/pthread_mutex_timedlock_any.c | 193 ++++++++++++++++++
sysdeps/nptl/lowlevellock-futex.h | 14 ++
sysdeps/nptl/pthread.h | 10 +
.../sysv/linux/x86_64/64/libpthread.abilist | 1 +
8 files changed, 263 insertions(+)
create mode 100644 nptl/pthread_mutex_lock_any.c
create mode 100644 nptl/pthread_mutex_timedlock_any.c
diff --git a/nptl/Makefile b/nptl/Makefile
index 89569c4f46..11368c93cb 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -97,6 +97,7 @@ libpthread-routines = nptl-init nptlfreeres vars events version pt-interp \
pthread_attr_getstack pthread_attr_setstack \
pthread_mutex_init pthread_mutex_destroy \
pthread_mutex_lock pthread_mutex_trylock \
+ pthread_mutex_lock_any pthread_mutex_timedlock_any \
pthread_mutex_timedlock pthread_mutex_unlock \
pthread_mutex_cond_lock \
pthread_mutexattr_init pthread_mutexattr_destroy \
diff --git a/nptl/Versions b/nptl/Versions
index aed118e717..df4a8313e2 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -285,6 +285,8 @@ libpthread {
mtx_init; mtx_lock; mtx_timedlock; mtx_trylock; mtx_unlock; mtx_destroy;
call_once; cnd_broadcast; cnd_destroy; cnd_init; cnd_signal;
cnd_timedwait; cnd_wait; tss_create; tss_delete; tss_get; tss_set;
+
+ pthread_mutex_lock_any; pthread_mutex_timedlock_any;
}
GLIBC_2.30 {
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 6f94d6be31..87f4afff30 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -395,6 +395,11 @@ extern int __pthread_mutex_trylock (pthread_mutex_t *_mutex);
extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex,
const struct timespec *__abstime);
+extern int __pthread_mutex_lock_any (pthread_mutex_t *__mutex, int mutexcount,
+ int *outlocked);
+extern int __pthread_mutex_timedlock_any (pthread_mutex_t *__mutex, int count,
+ const struct timespec *__abstime,
+ int *outlocked);
extern int __pthread_mutex_cond_lock (pthread_mutex_t *__mutex)
attribute_hidden;
extern void __pthread_mutex_cond_lock_adjust (pthread_mutex_t *__mutex)
diff --git a/nptl/pthread_mutex_lock_any.c b/nptl/pthread_mutex_lock_any.c
new file mode 100644
index 0000000000..485c213a17
--- /dev/null
+++ b/nptl/pthread_mutex_lock_any.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <not-cancel.h>
+#include "pthreadP.h"
+#include <atomic.h>
+#include <lowlevellock.h>
+#include <stap-probe.h>
+
+int
+__pthread_mutex_lock_any (pthread_mutex_t *mutexlist, int mutexcount,
+ int *outlocked)
+{
+ return __pthread_mutex_timedlock_any(mutexlist, mutexcount, NULL, outlocked);
+}
+
+weak_alias (__pthread_mutex_lock_any, pthread_mutex_lock_any)
diff --git a/nptl/pthread_mutex_timedlock_any.c b/nptl/pthread_mutex_timedlock_any.c
new file mode 100644
index 0000000000..a95687ce8e
--- /dev/null
+++ b/nptl/pthread_mutex_timedlock_any.c
@@ -0,0 +1,193 @@
+/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/param.h>
+#include <not-cancel.h>
+#include "pthreadP.h"
+#include <atomic.h>
+#include <lowlevellock.h>
+#include <stap-probe.h>
+
+/* TODO: this probably comes from a kernel header when upstream? */
+struct futex_wait_block {
+ int *uaddr;
+ int val;
+ int bitset;
+} __attribute__((packed));
+
+int
+__pthread_mutex_timedlock_any (pthread_mutex_t *mutexlist, int mutexcount,
+ const struct timespec *abstime, int *outlocked)
+{
+ /* This requires futex support */
+#ifndef __NR_futex
+ return ENOTSUP;
+#endif
+
+ if (mutexlist == NULL)
+ {
+ /* User is asking us if kernel supports the feature. */
+
+ /* TODO: how does one check if supported?
+ * I was thinking of trying the ioctl once and then returning the static
+ * cached value, is that OK?
+ */
+ return 0;
+ }
+
+ if (mutexlist != NULL && mutexcount <= 0)
+ return EINVAL;
+
+ if (outlocked == NULL)
+ return EINVAL;
+
+ int type = PTHREAD_MUTEX_TYPE (mutexlist);
+
+ for (int i = 1; i < mutexcount; i++)
+ {
+ /* Types have to match, since the PRIVATE flag is OP-global. */
+ if (PTHREAD_MUTEX_TYPE (&mutexlist[i]) != type)
+ return EINVAL;
+ }
+
+ int kind = type & PTHREAD_MUTEX_KIND_MASK_NP;
+
+ /* TODO: implement recursive, errorcheck and adaptive. */
+ if (kind != PTHREAD_MUTEX_NORMAL)
+ return EINVAL;
+
+ /* TODO: implement robust. */
+ if (type & PTHREAD_MUTEX_ROBUST_NORMAL_NP)
+ return EINVAL;
+
+ /* TODO: implement PI. */
+ if (type & PTHREAD_MUTEX_PRIO_INHERIT_NP)
+ return EINVAL;
+
+ /* TODO: implement PP. */
+ if (type & PTHREAD_MUTEX_PRIO_PROTECT_NP)
+ return EINVAL;
+
+ pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
+ int result;
+
+ result = -1;
+
+ for (int i = 0; i < mutexcount; i++)
+ {
+ if (__lll_trylock (&mutexlist[i].__data.__lock) == 0)
+ {
+ result = i;
+ break;
+ }
+ }
+
+ while (result == -1)
+ {
+ for (int i = 0; i < mutexcount; i++)
+ {
+ int oldval = atomic_exchange_acq (&mutexlist[i].__data.__lock, 2);
+
+ if (oldval == 0)
+ {
+ result = i;
+ break;
+ }
+ }
+
+ if (result == -1)
+ {
+ /* Couldn't get one of the locks immediately, we have to sleep now. */
+ struct timespec *timeout = NULL;
+ struct timespec rt;
+
+ if (abstime != NULL)
+ {
+ /* Reject invalid timeouts. */
+ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
+ return EINVAL;
+
+ struct timeval tv;
+
+ /* Get the current time. */
+ (void) __gettimeofday (&tv, NULL);
+
+ /* Compute relative timeout. */
+ rt.tv_sec = abstime->tv_sec - tv.tv_sec;
+ rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000;
+ if (rt.tv_nsec < 0)
+ {
+ rt.tv_nsec += 1000000000;
+ --rt.tv_sec;
+ }
+
+ if (rt.tv_sec < 0)
+ return ETIMEDOUT;
+
+ timeout = &rt;
+ }
+
+ struct futex_wait_block waitblock[mutexcount];
+
+ for (int i = 0; i < mutexcount; i++)
+ {
+ waitblock[i].uaddr = &mutexlist[i].__data.__lock;
+ waitblock[i].val = 2;
+ waitblock[i].bitset = ~0;
+ }
+
+ long int __ret;
+
+ /* Safe to use the flag for the first one, since all their types match. */
+ int private_flag = PTHREAD_MUTEX_PSHARED (&mutexlist[0]);
+
+ __ret = lll_futex_timed_wait_multiple (waitblock, mutexcount, timeout,
+ private_flag);
+
+ if (__ret < 0)
+ return -__ret; /* TODO is this correct? */
+
+ /* Have slept, try grabbing the one that woke us up? */
+ if (atomic_exchange_acq (&mutexlist[__ret].__data.__lock, 2) == 0)
+ {
+ /* We got it, done, loop will end below. */
+ result = __ret;
+ }
+ }
+ }
+
+ if (result != -1)
+ {
+ /* Record the ownership. */
+ mutexlist[result].__data.__owner = id;
+ ++mutexlist[result].__data.__nusers;
+
+ /* Let the user know which mutex is now locked. */
+ *outlocked = result;
+
+ result = 0;
+ }
+
+ return result;
+}
+
+weak_alias (__pthread_mutex_timedlock_any, pthread_mutex_timedlock_any)
diff --git a/sysdeps/nptl/lowlevellock-futex.h b/sysdeps/nptl/lowlevellock-futex.h
index 2209ca76a1..83f32bc8e8 100644
--- a/sysdeps/nptl/lowlevellock-futex.h
+++ b/sysdeps/nptl/lowlevellock-futex.h
@@ -38,6 +38,7 @@
#define FUTEX_WAKE_BITSET 10
#define FUTEX_WAIT_REQUEUE_PI 11
#define FUTEX_CMP_REQUEUE_PI 12
+#define FUTEX_WAIT_MULTIPLE 13
#define FUTEX_PRIVATE_FLAG 128
#define FUTEX_CLOCK_REALTIME 256
@@ -73,6 +74,14 @@
? -INTERNAL_SYSCALL_ERRNO (__ret) : 0); \
})
+# define lll_futex_syscall_ret(nargs, futexp, op, ...) \
+ ({ \
+ long int __ret = INTERNAL_SYSCALL (futex, nargs, futexp, op, \
+ __VA_ARGS__); \
+ (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__ret)) \
+ ? -INTERNAL_SYSCALL_ERRNO (__ret) : __ret); \
+ })
+
/* For most of these macros, the return value is never really used.
Nevertheless, the protocol is that each one returns a negated errno
code for failure or zero for success. (Note that the corresponding
@@ -89,6 +98,11 @@
__lll_private_flag (FUTEX_WAIT, private), \
val, timeout)
+# define lll_futex_timed_wait_multiple(futexp, val, timeout, private) \
+ lll_futex_syscall_ret (4, futexp, \
+ __lll_private_flag (FUTEX_WAIT_MULTIPLE, private), \
+ val, timeout)
+
/* Verify whether the supplied clockid is supported by
lll_futex_clock_wait_bitset. */
# define lll_futex_supported_clockid(clockid) \
diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
index 8a403cbf36..f1f7332472 100644
--- a/sysdeps/nptl/pthread.h
+++ b/sysdeps/nptl/pthread.h
@@ -753,7 +753,17 @@ extern int pthread_mutex_trylock (pthread_mutex_t *__mutex)
extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
__THROWNL __nonnull ((1));
+/* Lock any one of several mutexes. */
+extern int pthread_mutex_lock_any (pthread_mutex_t *__mutexlist,
+ int mutexcount, int *outlocked);
+
#ifdef __USE_XOPEN2K
+/* Lock any one of several mutexes, with timeout. */
+extern int pthread_mutex_timedlock_any (pthread_mutex_t *__mutexlist,
+ int mutexcount,
+ const struct timespec *__restrict
+ __abstime, int *outlocked);
+
/* Wait until lock becomes available, or specified time passes. */
extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
index 971269d2ef..54d966516c 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libpthread.abilist
@@ -105,6 +105,7 @@ GLIBC_2.2.5 pthread_kill_other_threads_np F
GLIBC_2.2.5 pthread_mutex_destroy F
GLIBC_2.2.5 pthread_mutex_init F
GLIBC_2.2.5 pthread_mutex_lock F
+GLIBC_2.2.5 pthread_mutex_lock_any F
GLIBC_2.2.5 pthread_mutex_timedlock F
GLIBC_2.2.5 pthread_mutex_trylock F
GLIBC_2.2.5 pthread_mutex_unlock F

View file

@ -0,0 +1,76 @@
--- libc/elf/Makefile.aliasing~ 2012-12-02 22:11:45.000000000 +0100
+++ libc/elf/Makefile 2012-12-27 19:46:13.396658450 +0100
@@ -53,6 +53,7 @@ CFLAGS-dl-iterate-phdr.c = $(uses-callba
ifeq ($(unwind-find-fde),yes)
routines += unwind-dw2-fde-glibc
shared-only-routines += unwind-dw2-fde-glibc
+CFLAGS-unwind-dw2-fde-glibc.c += -fno-strict-aliasing
endif
before-compile = $(objpfx)trusted-dirs.h
--- libc/inet/Makefile.aliasing~ 2012-08-28 16:14:43.000000000 +0200
+++ libc/inet/Makefile 2012-12-27 19:48:23.933089723 +0100
@@ -62,6 +62,8 @@ tests-$(OPTION_EGLIBC_ADVANCED_INET6) +=
include ../Rules
+CFLAGS-tst-inet6_rth.c += -fno-strict-aliasing
+
ifeq ($(have-thread-library),yes)
CFLAGS-gethstbyad_r.c = -fexceptions
--- libc/nis/Makefile.aliasing~ 2012-05-12 17:44:41.000000000 +0200
+++ libc/nis/Makefile 2012-12-27 19:46:13.396658450 +0100
@@ -80,6 +80,8 @@ libnss_nisplus-inhibit-o = $(filter-out
include ../Rules
+CFLAGS-nis_findserv.c += -fno-strict-aliasing
+CFLAGS-ypclnt.c += -fno-strict-aliasing
$(objpfx)libnss_compat.so: $(objpfx)libnsl.so$(libnsl.so-version)
$(objpfx)libnss_nis.so: $(objpfx)libnsl.so$(libnsl.so-version) \
--- libc/nss/Makefile.aliasing~ 2012-10-10 17:35:46.000000000 +0200
+++ libc/nss/Makefile 2012-12-27 19:46:13.396658450 +0100
@@ -147,6 +147,7 @@ $(libnss_db-dbs:%=$(objpfx)%.c): $(objpf
echo '#include "$<"') > $@.new
mv -f $@.new $@
+CFLAGS-files-hosts.c += -fno-strict-aliasing
$(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
--- libc/resolv/Makefile.aliasing~ 2012-10-25 19:18:12.000000000 +0200
+++ libc/resolv/Makefile 2012-12-27 19:46:13.396658450 +0100
@@ -83,6 +83,7 @@ ifeq (yes,$(have-ssp))
CFLAGS-libresolv += -fstack-protector
endif
CFLAGS-res_hconf.c = -fexceptions
+CFLAGS-res_send.c += -fno-strict-aliasing
# The BIND code elicits some harmless warnings.
+cflags += -Wno-strict-prototypes -Wno-write-strings
--- libc/sunrpc/Makefile.aliasing~ 2012-05-26 19:46:57.000000000 +0200
+++ libc/sunrpc/Makefile 2012-12-27 19:46:13.397658439 +0100
@@ -164,6 +164,10 @@ sunrpc-CPPFLAGS = -D_RPC_THREAD_SAFE_
CPPFLAGS += $(sunrpc-CPPFLAGS)
BUILD_CPPFLAGS += $(sunrpc-CPPFLAGS)
+CFLAGS-clnt_tcp.c += -fno-strict-aliasing
+CFLAGS-clnt_udp.c += -fno-strict-aliasing
+CFLAGS-clnt_unix.c += -fno-strict-aliasing
+
$(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
--- libc/sysdeps/powerpc/powerpc64/Makefile.aliasing~ 2012-12-27 19:46:13.392658496 +0100
+++ libc/sysdeps/powerpc/powerpc64/Makefile 2012-12-27 19:46:13.397658439 +0100
@@ -37,6 +37,8 @@ CFLAGS-rtld-strnlen.os = $(no-special-re
CFLAGS-libc-start.c += -fno-asynchronous-unwind-tables
+CFLAGS-gmon-start.c += -fno-strict-aliasing
+
ifeq ($(subdir),csu)
sysdep_routines += hp-timing
elide-routines.os += hp-timing

View file

@ -1,8 +1,9 @@
--- glibc-2.20/po/fr.po.ENOTTYfr~ 2014-09-08 21:27:29.600168512 +0200
+++ glibc-2.20/po/fr.po 2014-09-08 21:28:29.519419418 +0200
@@ -6029,7 +6029,7 @@ msgstr "Trop de fichiers ouverts dans le
diff -up glibc-2.32/po/fr.po.44~ glibc-2.32/po/fr.po
--- glibc-2.32/po/fr.po.44~ 2020-08-08 02:26:17.393947894 +0200
+++ glibc-2.32/po/fr.po 2020-08-08 02:26:49.631443164 +0200
@@ -5655,7 +5655,7 @@ msgstr "Trop de fichiers ouverts dans le
#. TRANS modes on an ordinary file.
#: sysdeps/gnu/errlist.c:286
#: sysdeps/gnu/errlist.h:173
msgid "Inappropriate ioctl for device"
-msgstr "Ioctl() inappropré pour un périphérique"
+msgstr "Ioctl() inapproprié pour un périphérique"

View file

@ -1,17 +0,0 @@
2004-01-23 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
* Makeconfig (%.v.i): Make sure to define __$(base-machine)__ for
biarch asm headers.
diff -p -up glibc-2.10.1/Makeconfig.orig glibc-2.10.1/Makeconfig
--- glibc-2.10.1/Makeconfig.orig 2009-05-26 23:40:06.000000000 -0300
+++ glibc-2.10.1/Makeconfig 2009-05-26 23:41:42.000000000 -0300
@@ -795,7 +795,7 @@ ifeq (yes, $(build-shared))
%.v.i: $(common-objpfx)config.h $(..)Makeconfig
sed '/^[ ]*%/!s/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \
$(filter-out FORCE %.h $(..)Makeconfig,$^) \
- | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - \
+ | $(CC) -E -undef $(CPPFLAGS) -D__$(base-machine)__ -x assembler-with-cpp - \
> $@T
mv -f $@T $@
%.v: %.v.i

View file

@ -1,57 +0,0 @@
2005-08-29 Gwenole Beauchesne <gbeauchesne@mandriva.com>
* debug/xtrace.sh: Make it biarch capable on 64-bit Linux platforms.
* malloc/memusage.sh: Likewise.
--- glibc-2.3.5/debug/xtrace.sh.biarch-utils 2005-08-29 12:48:24.000000000 -0400
+++ glibc-2.3.5/debug/xtrace.sh 2005-08-29 16:58:02.000000000 -0400
@@ -151,6 +151,23 @@ if test ! -x "$program"; then
help_info
fi
+# Biarch transmutation.
+host_os=`uname -o`
+host_cpu=`uname -m`
+case $host_os in
+*Linux*)
+ # test if the binary is 32-bit
+ elf32=no
+ if file -L `which $program` | grep -q "ELF 32"; then
+ elf32=yes
+ fi
+esac
+case $host_cpu:$elf32 in
+powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
+ pcprofileso=`echo $pcprofileso | sed -e "s,/lib64/,/lib/,"`
+ ;;
+esac
+
# We have two modes. If a data file is given simply print the included data.
printf "%-20s %-*s %6s\n" Function $(expr $COLUMNS - 30) File Line
for i in $(seq 1 $COLUMNS); do printf -; done; printf '\n'
--- glibc-2.3.5/malloc/memusage.sh.biarch-utils 2005-03-07 18:44:10.000000000 -0500
+++ glibc-2.3.5/malloc/memusage.sh 2005-08-29 16:25:12.000000000 -0400
@@ -205,6 +205,23 @@ if test $# -eq 0; then
do_usage
fi
+# Biarch transmutation.
+host_os=`uname -o`
+host_cpu=`uname -m`
+case $host_os in
+*Linux*)
+ # test if the binary is 32-bit
+ elf32=no
+ if file -L `which $1` | grep -q "ELF 32"; then
+ elf32=yes
+ fi
+esac
+case $host_cpu:$elf32 in
+powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
+ memusageso=`echo $memusageso | sed -e "s,/lib64/,/lib/,"`
+ ;;
+esac
+
# This will be in the environment.
add_env="LD_PRELOAD=$memusageso"

View file

@ -1,12 +0,0 @@
--- glibc-2.15-a316c1f/sysdeps/unix/sysv/linux/check_pf.c.orig 2012-02-11 15:25:40.066658360 -0200
+++ glibc-2.15-a316c1f/sysdeps/unix/sysv/linux/check_pf.c 2012-02-11 15:25:53.953718622 -0200
@@ -209,7 +209,8 @@ make_request (int fd, pid_t pid)
}
else
{
- if (!IN6_IS_ADDR_LOOPBACK (address))
+ if (!IN6_IS_ADDR_LOOPBACK (address) &&
+ !IN6_IS_ADDR_LINKLOCAL (address))
seen_ipv6 = true;
}
}

View file

@ -1,11 +0,0 @@
--- glibc-2.3.3/nscd/nscd.init.nscd-enable 2004-08-24 10:31:20.000000000 -0400
+++ glibc-2.3.3/nscd/nscd.init 2004-08-25 04:41:47.571810880 -0400
@@ -2,7 +2,7 @@
#
# nscd: Starts the Name Switch Cache Daemon
#
-# chkconfig: - 30 74
+# chkconfig: 345 30 74
# description: This is a daemon which handles passwd and group lookups \
# for running programs and cache the results for the next \
# query. You should start this daemon if you use \

View file

@ -1,12 +0,0 @@
https://qa.mandriva.com/show_bug.cgi?id=41055
--- glibc-2.8/nscd/nscd.init.orig 2008-05-26 10:33:11.000000000 -0400
+++ glibc-2.8/nscd/nscd.init 2008-05-26 10:36:56.000000000 -0400
@@ -13,6 +13,7 @@
### BEGIN INIT INFO
# Provides: nscd
# Required-Start: $syslog
+# Should-Start: $network ldap mysqld ypbind
# Default-Stop: 0 1 6
# Short-Description: Starts the Name Switch Cache Daemon
# Description: This is a daemon which handles passwd and group lookups \

View file

@ -0,0 +1,44 @@
--- glibc-2.16.90-97bc38d7/misc/tst-error1.c.orig 2012-09-26 15:21:29.672179348 -0300
+++ glibc-2.16.90-97bc38d7/misc/tst-error1.c 2012-09-26 15:21:59.422180301 -0300
@@ -16,8 +16,8 @@ do_test (int argc, char *argv[])
for (int i = 0; i < 1000; ++i)
memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str));
error (0, 0, str);
- error (0, 0, buf);
- error (0, 0, buf);
+ error (0, 0, "%s", buf);
+ error (0, 0, "%s", buf);
error (0, 0, str);
return 0;
}
--- glibc-2.16.90-97bc38d7/posix/regexbug1.c.orig 2012-09-26 15:23:13.175182590 -0300
+++ glibc-2.16.90-97bc38d7/posix/regexbug1.c 2012-09-26 15:23:32.198183235 -0300
@@ -18,7 +18,7 @@ main (void)
{
char buf[100];
regerror (reerr, &re, buf, sizeof buf);
- error (EXIT_FAILURE, 0, buf);
+ error (EXIT_FAILURE, 0, "%s", buf);
}
if (regexec (&re, "002", 2, ma, 0) != 0)
@@ -35,7 +35,7 @@ main (void)
{
char buf[100];
regerror (reerr, &re, buf, sizeof buf);
- error (EXIT_FAILURE, 0, buf);
+ error (EXIT_FAILURE, 0, "%s", buf);
}
if (regexec (&re, "002", 2, ma, 0) != 0)
--- glibc-2.16.90-97bc38d7/stdio-common/test-vfprintf.c.orig 2012-09-26 15:23:52.887183970 -0300
+++ glibc-2.16.90-97bc38d7/stdio-common/test-vfprintf.c 2012-09-26 15:24:13.870184603 -0300
@@ -92,7 +92,7 @@ main (void)
fprintf (fp, "%s", large);
fprintf (fp, "%.*s", 30000, large);
large[20000] = '\0';
- fprintf (fp, large);
+ fprintf (fp, "%s", large);
fprintf (fp, "%-1.300000000s", "hello");
if (fflush (fp) != 0 || ferror (fp) != 0 || fclose (fp) != 0)

View file

@ -1,28 +0,0 @@
Subject: [PATCH] Replace strncpy with memccpy to fix -Wstringop-truncation
From : https://patchwork.sourceware.org/patch/26437/
---
diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c
index 8dc021e73d..b53284f889 100644
--- a/nis/nss_nisplus/nisplus-parser.c
+++ b/nis/nss_nisplus/nisplus-parser.c
@@ -87,7 +87,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
if (len >= room_left)
goto no_more_room;
- strncpy (first_unused, numstr, len);
+ memcpy (first_unused, numstr, len);
first_unused[len] = '\0';
numstr = first_unused;
}
@@ -103,7 +103,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
if (len >= room_left)
goto no_more_room;
- strncpy (first_unused, numstr, len);
+ memcpy (first_unused, numstr, len);
first_unused[len] = '\0';
numstr = first_unused;
}

View file

@ -1,11 +0,0 @@
--- glibc-2.26/misc/sys/cdefs.h.omv~ 2018-01-24 11:32:15.276543892 +0100
+++ glibc-2.26/misc/sys/cdefs.h 2018-01-24 11:32:47.208618287 +0100
@@ -38,7 +38,7 @@
/* All functions, except those with callbacks or those that
synchronize memory, are leaf functions. */
-# if __GNUC_PREREQ (4, 6) && !defined _LIBC
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC && (!defined(__clang__) || __has_attribute(leaf))
# define __LEAF , __leaf__
# define __LEAF_ATTR __attribute__ ((__leaf__))
# else

View file

@ -1,81 +0,0 @@
--- glibc-2.27/bits/floatn-common.h.0134~ 2018-02-01 17:17:18.000000000 +0100
+++ glibc-2.27/bits/floatn-common.h 2018-03-03 02:32:16.924822310 +0100
@@ -28,6 +28,7 @@
where the same definitions, or definitions based only on the macros
in bits/floatn.h, are appropriate for all glibc configurations. */
+#ifndef __clang__ /* FIXME reinvestigate with clang 7 */
/* Defined to 1 if the current compiler invocation provides a
floating-point type with the right format for this type, and this
glibc includes corresponding *fN or *fNx interfaces for it. */
@@ -36,6 +37,7 @@
#define __HAVE_FLOAT64 1
#define __HAVE_FLOAT32X 1
#define __HAVE_FLOAT128X 0
+#endif
/* Defined to 1 if the corresponding __HAVE_<type> macro is 1 and the
type is the first with its format in the sequence of (the default
--- glibc-2.27/sysdeps/ieee754/ldbl-128/bits/floatn.h.0134~ 2018-02-01 17:17:18.000000000 +0100
+++ glibc-2.27/sysdeps/ieee754/ldbl-128/bits/floatn.h 2018-03-03 02:32:16.924822310 +0100
@@ -26,7 +26,11 @@
floating-point type with the IEEE 754 binary128 format, and this
glibc includes corresponding *f128 interfaces for it. */
#ifndef __NO_LONG_DOUBLE_MATH
-# define __HAVE_FLOAT128 1
+# if defined(__clang__)
+# define __HAVE_FLOAT128 0
+# else
+# define __HAVE_FLOAT128 1
+# endif
#else
/* glibc does not support _Float128 for platforms where long double is
normally binary128 when building with long double as binary64.
--- glibc-2.27/sysdeps/x86/bits/floatn.h.0134~ 2018-02-01 17:17:18.000000000 +0100
+++ glibc-2.27/sysdeps/x86/bits/floatn.h 2018-03-03 02:34:50.472771373 +0100
@@ -26,9 +26,9 @@
glibc includes corresponding *f128 interfaces for it. The required
libgcc support was added some time after the basic compiler
support, for x86_64 and x86. */
-#if (defined __x86_64__ \
+#if (!defined(__clang__) && (defined __x86_64__ \
? __GNUC_PREREQ (4, 3) \
- : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4)))
+ : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))))
# define __HAVE_FLOAT128 1
#else
# define __HAVE_FLOAT128 0
@@ -42,6 +42,7 @@
# define __HAVE_DISTINCT_FLOAT128 0
#endif
+#ifndef __clang__ /* FIXME reinvestigate with clang 7 */
/* Defined to 1 if the current compiler invocation provides a
floating-point type with the right format for _Float64x, and this
glibc includes corresponding *f64x interfaces for it. */
@@ -52,6 +53,7 @@
the format of _Float128, which must be different from that of long
double. */
#define __HAVE_FLOAT64X_LONG_DOUBLE 1
+#endif
#ifndef __ASSEMBLER__
@@ -68,7 +70,7 @@
/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */
# if __HAVE_FLOAT128
-# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
/* Add a typedef for older GCC compilers which don't natively support
_Complex _Float128. */
typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
@@ -82,7 +84,7 @@ typedef _Complex float __cfloat128 __att
# if __HAVE_FLOAT128
/* The type _Float128 exists only since GCC 7.0. */
-# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
typedef __float128 _Float128;
# endif

View file

@ -1,6 +1,6 @@
diff -up glibc-2.31/csu/Makefile.59~ glibc-2.31/csu/Makefile
--- glibc-2.31/csu/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/csu/Makefile 2020-02-04 02:34:09.646778297 +0100
diff -up glibc-2.31.20200715/csu/Makefile.54~ glibc-2.31.20200715/csu/Makefile
--- glibc-2.31.20200715/csu/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/csu/Makefile 2020-07-15 23:58:52.458734215 +0200
@@ -114,7 +114,7 @@ endif
asm-CPPFLAGS += -I$(objpfx).
@ -10,9 +10,9 @@ diff -up glibc-2.31/csu/Makefile.59~ glibc-2.31/csu/Makefile
include ../Rules
diff -up glibc-2.31/debug/Makefile.59~ glibc-2.31/debug/Makefile
--- glibc-2.31/debug/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/debug/Makefile 2020-02-04 02:34:09.646778297 +0100
diff -up glibc-2.31.20200715/debug/Makefile.54~ glibc-2.31.20200715/debug/Makefile
--- glibc-2.31.20200715/debug/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/debug/Makefile 2020-07-15 23:58:52.458734215 +0200
@@ -109,6 +109,8 @@ CPPFLAGS-tst-longjmp_chk2.c += -D_FORTIF
CFLAGS-tst-longjmp_chk3.c += -fexceptions -fasynchronous-unwind-tables
CPPFLAGS-tst-longjmp_chk3.c += -D_FORTIFY_SOURCE=1
@ -22,10 +22,10 @@ diff -up glibc-2.31/debug/Makefile.59~ glibc-2.31/debug/Makefile
# We know these tests have problems with format strings, this is what
# we are testing. Disable that warning. They are also testing
# deprecated functions (notably gets) so disable that warning as well.
diff -up glibc-2.31/inet/Makefile.59~ glibc-2.31/inet/Makefile
--- glibc-2.31/inet/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/inet/Makefile 2020-02-04 02:34:09.646778297 +0100
@@ -106,6 +106,20 @@ CFLAGS-getnetgrent_r.c += -fexceptions
diff -up glibc-2.31.20200715/inet/Makefile.54~ glibc-2.31.20200715/inet/Makefile
--- glibc-2.31.20200715/inet/Makefile.54~ 2020-07-15 23:58:52.458734215 +0200
+++ glibc-2.31.20200715/inet/Makefile 2020-07-15 23:59:22.037104247 +0200
@@ -109,6 +109,20 @@ CFLAGS-getnetgrent_r.c += -fexceptions
CFLAGS-tst-checks-posix.c += -std=c99
CFLAGS-tst-sockaddr.c += -fno-strict-aliasing
@ -45,10 +45,10 @@ diff -up glibc-2.31/inet/Makefile.59~ glibc-2.31/inet/Makefile
+
endif
ifeq ($(build-static-nss),yes)
diff -up glibc-2.31/libio/libioP.h.59~ glibc-2.31/libio/libioP.h
--- glibc-2.31/libio/libioP.h.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/libio/libioP.h 2020-02-04 02:34:09.648778297 +0100
# Install the rpc database file.
diff -up glibc-2.31.20200715/libio/libioP.h.54~ glibc-2.31.20200715/libio/libioP.h
--- glibc-2.31.20200715/libio/libioP.h.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/libio/libioP.h 2020-07-15 23:58:52.458734215 +0200
@@ -842,8 +842,8 @@ extern struct _IO_FILE_plus _IO_stderr_;
static inline bool
_IO_legacy_file (FILE *fp)
@ -71,9 +71,9 @@ diff -up glibc-2.31/libio/libioP.h.59~ glibc-2.31/libio/libioP.h
return;
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
if (_IO_legacy_file (fp))
diff -up glibc-2.31/libio/Makefile.59~ glibc-2.31/libio/Makefile
--- glibc-2.31/libio/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/libio/Makefile 2020-02-04 02:34:09.646778297 +0100
diff -up glibc-2.31.20200715/libio/Makefile.54~ glibc-2.31.20200715/libio/Makefile
--- glibc-2.31.20200715/libio/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/libio/Makefile 2020-07-15 23:58:52.458734215 +0200
@@ -154,6 +154,19 @@ CFLAGS-iofopen.c += -fexceptions
CFLAGS-iofopen64.c += -fexceptions
CFLAGS-oldtmpfile.c += -fexceptions
@ -94,10 +94,10 @@ diff -up glibc-2.31/libio/Makefile.59~ glibc-2.31/libio/Makefile
CFLAGS-tst_putwc.c += -DOBJPFX=\"$(objpfx)\"
diff -up glibc-2.31/locale/Makefile.59~ glibc-2.31/locale/Makefile
--- glibc-2.31/locale/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/locale/Makefile 2020-02-04 02:34:09.646778297 +0100
@@ -105,6 +105,7 @@ CPPFLAGS-locale-programs = -DLOCALE_PATH
diff -up glibc-2.31.20200715/locale/Makefile.54~ glibc-2.31.20200715/locale/Makefile
--- glibc-2.31.20200715/locale/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/locale/Makefile 2020-07-15 23:58:52.458734215 +0200
@@ -106,6 +106,7 @@ CPPFLAGS-locale-programs = -DLOCALE_PATH
CFLAGS-charmap.c += -Wno-write-strings -Wno-char-subscripts
CFLAGS-locfile.c += -Wno-write-strings -Wno-char-subscripts
CFLAGS-charmap-dir.c += -Wno-write-strings
@ -105,10 +105,10 @@ diff -up glibc-2.31/locale/Makefile.59~ glibc-2.31/locale/Makefile
# Set libof-* for each routine.
cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \
diff -up glibc-2.31/misc/Makefile.59~ glibc-2.31/misc/Makefile
--- glibc-2.31/misc/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/misc/Makefile 2020-02-04 02:34:09.646778297 +0100
@@ -137,6 +137,8 @@ CFLAGS-sbrk.op = $(no-stack-protector)
diff -up glibc-2.31.20200715/misc/Makefile.54~ glibc-2.31.20200715/misc/Makefile
--- glibc-2.31.20200715/misc/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/misc/Makefile 2020-07-15 23:58:52.458734215 +0200
@@ -142,6 +142,8 @@ CFLAGS-sbrk.op = $(no-stack-protector)
CFLAGS-brk.o = $(no-stack-protector)
CFLAGS-brk.op = $(no-stack-protector)
@ -117,21 +117,21 @@ diff -up glibc-2.31/misc/Makefile.59~ glibc-2.31/misc/Makefile
include ../Rules
$(objpfx)libg.a: $(dep-dummy-lib); $(make-dummy-lib)
diff -up glibc-2.31/nis/Makefile.59~ glibc-2.31/nis/Makefile
--- glibc-2.31/nis/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/nis/Makefile 2020-02-04 02:34:09.646778297 +0100
@@ -92,6 +92,7 @@ endif # have-GLIBC_2.28
diff -up glibc-2.31.20200715/nis/Makefile.54~ glibc-2.31.20200715/nis/Makefile
--- glibc-2.31.20200715/nis/Makefile.54~ 2020-07-15 23:58:52.458734215 +0200
+++ glibc-2.31.20200715/nis/Makefile 2020-07-15 23:59:49.717449495 +0200
@@ -52,6 +52,7 @@ endif # have-GLIBC_2.28
include ../Rules
+CFLAGS-nis_callback.c += -fno-strict-aliasing
ifeq ($(build-obsolete-nsl),yes)
$(objpfx)libnss_nis.so: $(objpfx)libnsl.so$(libnsl.so-version) \
diff -up glibc-2.31/nptl/Makefile.59~ glibc-2.31/nptl/Makefile
--- glibc-2.31/nptl/Makefile.59~ 2020-02-04 02:34:09.591778295 +0100
+++ glibc-2.31/nptl/Makefile 2020-02-04 02:34:09.646778297 +0100
@@ -231,6 +231,19 @@ CFLAGS-fsync.c += -fexceptions -fasynchr
libnsl-libc = $(common-objpfx)linkobj/libc.so
# Target-specific variable setting to link objects using deprecated
diff -up glibc-2.31.20200715/nptl/Makefile.54~ glibc-2.31.20200715/nptl/Makefile
--- glibc-2.31.20200715/nptl/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/nptl/Makefile 2020-07-15 23:58:52.459734227 +0200
@@ -254,6 +254,22 @@ CFLAGS-fsync.c += -fexceptions -fasynchr
CFLAGS-pt-system.c += -fexceptions
@ -142,18 +142,21 @@ diff -up glibc-2.31/nptl/Makefile.59~ glibc-2.31/nptl/Makefile
+CFLAGS-sem_timedwait.c += -fno-strict-aliasing
+CFLAGS-sem_post.c += -fno-strict-aliasing
+CFLAGS-unwind.c += -fno-strict-aliasing
+CFLAGS-pthread_attr_copy.c += -fno-strict-aliasing
+CFLAGS-pthread_cond_common.c += -fno-strict-aliasing
+CFLAGS-pthread_cond_destroy.c += -fno-strict-aliasing
+CFLAGS-pthread_cond_wait.c += -fno-strict-aliasing
+CFLAGS-pthread_cond_signal.c += -fno-strict-aliasing
+CFLAGS-pthread_cond_broadcast.c += -fno-strict-aliasing
+CFLAGS-pthread_setattr_default_np.c += -fno-strict-aliasing
+CFLAGS-pthread_getattr_default_np.c += -fno-strict-aliasing
+
LDLIBS-tst-once5 = -lstdc++
CFLAGS-tst-thread_local1.o = -std=gnu++11
LDLIBS-tst-thread_local1 = -lstdc++
diff -up glibc-2.31/nscd/Makefile.59~ glibc-2.31/nscd/Makefile
--- glibc-2.31/nscd/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/nscd/Makefile 2020-02-04 02:34:09.646778297 +0100
diff -up glibc-2.31.20200715/nscd/Makefile.54~ glibc-2.31.20200715/nscd/Makefile
--- glibc-2.31.20200715/nscd/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/nscd/Makefile 2020-07-15 23:58:52.459734227 +0200
@@ -79,6 +79,14 @@ CFLAGS-nscd_gethst_r.c += -fexceptions
CFLAGS-nscd_getai.c += -fexceptions
CFLAGS-nscd_initgroups.c += -fexceptions
@ -169,20 +172,20 @@ diff -up glibc-2.31/nscd/Makefile.59~ glibc-2.31/nscd/Makefile
CPPFLAGS-nscd += -D_FORTIFY_SOURCE=2
ifeq (yesyes,$(have-fpie)$(build-shared))
diff -up glibc-2.31/nss/Makefile.59~ glibc-2.31/nss/Makefile
--- glibc-2.31/nss/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/nss/Makefile 2020-02-04 02:34:09.647778297 +0100
@@ -182,3 +182,6 @@ $(objpfx)tst-nss-files-alias-leak: $(lib
diff -up glibc-2.31.20200715/nss/Makefile.54~ glibc-2.31.20200715/nss/Makefile
--- glibc-2.31.20200715/nss/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/nss/Makefile 2020-07-15 23:58:52.459734227 +0200
@@ -183,3 +183,6 @@ $(objpfx)tst-nss-files-alias-leak: $(lib
$(objpfx)tst-nss-files-alias-leak.out: $(objpfx)/libnss_files.so
$(objpfx)tst-nss-files-alias-truncated: $(libdl)
$(objpfx)tst-nss-files-alias-truncated.out: $(objpfx)/libnss_files.so
+
+CFLAGS-getnssent_r.c += -fno-strict-aliasing
+CFLAGS-digits_dots.c += -fno-strict-aliasing
diff -up glibc-2.31/posix/Makefile.59~ glibc-2.31/posix/Makefile
--- glibc-2.31/posix/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/posix/Makefile 2020-02-04 02:34:09.647778297 +0100
@@ -248,6 +248,13 @@ CFLAGS-execvp.os = -fomit-frame-pointer
diff -up glibc-2.31.20200715/posix/Makefile.54~ glibc-2.31.20200715/posix/Makefile
--- glibc-2.31.20200715/posix/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/posix/Makefile 2020-07-15 23:58:52.459734227 +0200
@@ -249,6 +249,13 @@ CFLAGS-execvp.os = -fomit-frame-pointer
CFLAGS-execlp.os = -fomit-frame-pointer
CFLAGS-nanosleep.c += -fexceptions -fasynchronous-unwind-tables
@ -196,9 +199,9 @@ diff -up glibc-2.31/posix/Makefile.59~ glibc-2.31/posix/Makefile
tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
--none random --col --color --colour
diff -up glibc-2.31/resolv/Makefile.59~ glibc-2.31/resolv/Makefile
--- glibc-2.31/resolv/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/resolv/Makefile 2020-02-04 02:34:09.647778297 +0100
diff -up glibc-2.31.20200715/resolv/Makefile.54~ glibc-2.31.20200715/resolv/Makefile
--- glibc-2.31.20200715/resolv/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/resolv/Makefile 2020-07-15 23:58:52.459734227 +0200
@@ -144,6 +144,19 @@ include ../gen-locales.mk
CFLAGS-res_hconf.c += -fexceptions
@ -219,10 +222,10 @@ diff -up glibc-2.31/resolv/Makefile.59~ glibc-2.31/resolv/Makefile
# The DNS NSS modules needs the resolver.
$(objpfx)libnss_dns.so: $(objpfx)libresolv.so
diff -up glibc-2.31/rt/Makefile.59~ glibc-2.31/rt/Makefile
--- glibc-2.31/rt/Makefile.59~ 2020-02-04 02:34:09.647778297 +0100
+++ glibc-2.31/rt/Makefile 2020-02-04 02:34:42.832779760 +0100
@@ -58,6 +58,8 @@ CFLAGS-mq_timedreceive.c += -fexceptions
diff -up glibc-2.31.20200715/rt/Makefile.54~ glibc-2.31.20200715/rt/Makefile
--- glibc-2.31.20200715/rt/Makefile.54~ 2020-07-15 23:58:52.453734152 +0200
+++ glibc-2.31.20200715/rt/Makefile 2020-07-15 23:58:52.459734227 +0200
@@ -59,6 +59,8 @@ CFLAGS-mq_timedreceive.c += -fexceptions
CFLAGS-mq_timedsend.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-librt-cancellation.c += -fasynchronous-unwind-tables
@ -231,9 +234,9 @@ diff -up glibc-2.31/rt/Makefile.59~ glibc-2.31/rt/Makefile
LDFLAGS-rt.so = -Wl,--enable-new-dtags,-z,nodelete
$(objpfx)librt.so: $(shared-thread-library)
diff -up glibc-2.31/setjmp/Makefile.59~ glibc-2.31/setjmp/Makefile
--- glibc-2.31/setjmp/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/setjmp/Makefile 2020-02-04 02:34:09.647778297 +0100
diff -up glibc-2.31.20200715/setjmp/Makefile.54~ glibc-2.31.20200715/setjmp/Makefile
--- glibc-2.31.20200715/setjmp/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/setjmp/Makefile 2020-07-15 23:58:52.459734227 +0200
@@ -31,6 +31,9 @@ tests := tst-setjmp jmpbug bug269-setjm
tst-sigsetjmp tst-setjmp-static
tests-static := tst-setjmp-static
@ -244,10 +247,10 @@ diff -up glibc-2.31/setjmp/Makefile.59~ glibc-2.31/setjmp/Makefile
include ../Rules
diff -up glibc-2.31/stdio-common/Makefile.59~ glibc-2.31/stdio-common/Makefile
--- glibc-2.31/stdio-common/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/stdio-common/Makefile 2020-02-04 02:34:09.647778297 +0100
@@ -125,6 +125,10 @@ $(objpfx)tst-%-mem.out: $(objpfx)tst-%.o
diff -up glibc-2.31.20200715/stdio-common/Makefile.54~ glibc-2.31.20200715/stdio-common/Makefile
--- glibc-2.31.20200715/stdio-common/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/stdio-common/Makefile 2020-07-15 23:58:52.459734227 +0200
@@ -152,6 +152,10 @@ $(objpfx)tst-errno-manual.out: tst-errno
CFLAGS-vfprintf.c += -Wno-uninitialized
CFLAGS-vfwprintf.c += -Wno-uninitialized
@ -258,10 +261,10 @@ diff -up glibc-2.31/stdio-common/Makefile.59~ glibc-2.31/stdio-common/Makefile
CFLAGS-tmpfile.c += -fexceptions
CFLAGS-tmpfile64.c += -fexceptions
diff -up glibc-2.31/sunrpc/Makefile.59~ glibc-2.31/sunrpc/Makefile
--- glibc-2.31/sunrpc/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/sunrpc/Makefile 2020-02-04 02:34:09.647778297 +0100
@@ -156,6 +156,21 @@ CFLAGS-pmap_rmt.c += -fexceptions
diff -up glibc-2.31.20200715/sunrpc/Makefile.54~ glibc-2.31.20200715/sunrpc/Makefile
--- glibc-2.31.20200715/sunrpc/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/sunrpc/Makefile 2020-07-15 23:58:52.459734227 +0200
@@ -97,6 +97,21 @@ CFLAGS-pmap_rmt.c += -fexceptions
CFLAGS-clnt_perr.c += -fexceptions
CFLAGS-openchild.c += -fexceptions
@ -283,15 +286,27 @@ diff -up glibc-2.31/sunrpc/Makefile.59~ glibc-2.31/sunrpc/Makefile
$(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
diff -up glibc-2.31/support/Makefile.59~ glibc-2.31/support/Makefile
--- glibc-2.31/support/Makefile.59~ 2020-02-01 12:52:50.000000000 +0100
+++ glibc-2.31/support/Makefile 2020-02-04 02:34:09.647778297 +0100
@@ -188,6 +188,8 @@ CFLAGS-support_paths.c = \
-DSBINDIR_PATH=\"$(sbindir)\" \
-DROOTSBINDIR_PATH=\"$(rootsbindir)\"
diff -up glibc-2.31.20200715/support/Makefile.54~ glibc-2.31.20200715/support/Makefile
--- glibc-2.31.20200715/support/Makefile.54~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/support/Makefile 2020-07-15 23:58:52.459734227 +0200
@@ -185,6 +185,8 @@ ifeq ($(build-shared),yes)
libsupport-inhibit-o += .o
endif
+CFLAGS-resolv_test.c = -fno-strict-aliasing
+
ifeq (,$(CXX))
LINKS_DSO_PROGRAM = links-dso-program-c
else
CFLAGS-support_paths.c = \
-DSRCDIR_PATH=\"`cd .. ; pwd`\" \
-DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \
diff -up glibc-2.32/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h.omv~ glibc-2.32/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
--- glibc-2.32/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h.omv~ 2020-08-10 05:01:38.876042446 +0200
+++ glibc-2.32/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h 2020-08-10 05:06:11.774020733 +0200
@@ -17,6 +17,8 @@
#include <ldsodefs.h>
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
+
/* The code checks if _rtld_global_ro was realocated before trying to access
the dl_hwcap field. The assembly is to make the compiler not optimize the
test (&_rtld_global_ro != NULL), which is always true in ISO C (but not

View file

@ -0,0 +1,11 @@
diff -up glibc-2.31.20200621/iconv/Makefile.omv~ glibc-2.31.20200621/iconv/Makefile
--- glibc-2.31.20200621/iconv/Makefile.omv~ 2020-06-27 03:39:53.689509570 +0200
+++ glibc-2.31.20200621/iconv/Makefile 2020-06-27 03:41:42.958406000 +0200
@@ -53,6 +53,7 @@ install-sbin = iconvconfig
CFLAGS-gconv_cache.c += -DGCONV_DIR='"$(gconvdir)"'
CFLAGS-gconv_conf.c += -DGCONV_PATH='"$(gconvdir)"'
CFLAGS-iconvconfig.c += -DGCONV_PATH='"$(gconvdir)"' -DGCONV_DIR='"$(gconvdir)"'
+CFLAGS-gconv_simple.c += -Wno-error=stringop-overflow
# Set libof-* for each routine.
cpp-srcs-left := $(iconv_prog-modules) $(iconvconfig-modules)

41
glibc-bench-build.patch Normal file
View file

@ -0,0 +1,41 @@
diff --git a/Makefile.in b/Makefile.in
index 710ce7e..3fe9e73 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -12,7 +12,7 @@ install:
LC_ALL=C; export LC_ALL; \
$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
-bench bench-clean:
+bench bench-clean bench-build:
$(MAKE) -C $(srcdir)/benchtests $(PARALLELMFLAGS) objdir=`pwd` $@
# Convenience target to rebuild ULPs for all math tests.
diff --git a/Rules b/Rules
index 4f9cdf3..42d0368 100644
--- a/Rules
+++ b/Rules
@@ -83,7 +83,7 @@ common-generated += dummy.o dummy.c
# This makes all the auxiliary and test programs.
-.PHONY: others tests bench
+.PHONY: others tests bench bench-build
ifeq ($(build-programs),yes)
others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
diff --git a/benchtests/Makefile b/benchtests/Makefile
index fd3036d..7cbceaa 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -103,6 +103,10 @@ bench-clean:
bench: $(timing-type) $(gen-locales) bench-set bench-func bench-malloc
+bench-build: bench-set-build bench-func-build
+bench-set-build: $(binaries-benchset)
+bench-func-build: $(binaries-bench) $(binaries-bench-malloc)
+
bench-set: $(binaries-benchset)
for run in $^; do \
echo "Running $${run}"; \

754
glibc-c_stubs.patch Normal file
View file

@ -0,0 +1,754 @@
diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/Banner glibc-2.17-931-g30bbc0c.new/c_stubs/Banner
--- glibc-2.17-931-g30bbc0c/c_stubs/Banner 1970-01-01 05:30:00.000000000 +0530
+++ glibc-2.17-931-g30bbc0c.new/c_stubs/Banner 2011-10-19 16:34:41.000000000 +0530
@@ -0,0 +1 @@
+The C stubs add-on version 2.1.2.
diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/ChangeLog glibc-2.17-931-g30bbc0c.new/c_stubs/ChangeLog
--- glibc-2.17-931-g30bbc0c/c_stubs/ChangeLog 1970-01-01 05:30:00.000000000 +0530
+++ glibc-2.17-931-g30bbc0c.new/c_stubs/ChangeLog 2011-10-19 16:34:41.000000000 +0530
@@ -0,0 +1,46 @@
+2006-03-01 Jakub Jelinek <jakub@redhat.com>
+
+ * configure (libc_add_on_canonical, libc_add_on_subdir): Set.
+
+2001-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ * gconv_stubs.c (__gconv_lookup_alias): Remove.
+ (__gconv_NOOP, __gconv_compare_alias, __gconv_release_cache,
+ __gconv_release_step): New.
+
+2001-06-07 Jakub Jelinek <jakub@redhat.com>
+
+ * gconv_stubs.c (__gconv_lookup_alias): New.
+
+2000-02-27 Cristian Gafton <gafton@redhat.com>
+
+ * gconv_stubs.c: Return __gconv_OK for:
+ __gconv_transform_ascii_internal
+ __gconv_transform_ucs2little_internal
+ __gconv_transform_utf16_internal
+ __gconv_transform_utf8_internal
+ __gconv_transform_ucs2_internal
+
+2000-02-25 Cristian Gafton <gafton@redhat.com>
+
+ * gconv_stubs.c: add __c_stubs_is_compiled_in so we can detect when
+ the library is linked in.
+
+Wed Dec 8 13:47:25 1999 Ivan Brunello <ivan.brunello@tiscalinet.it>
+
+ * Makefile (extra-objs): Changed stubs.o to gconv_stubs.o.
+
+Sun Dec 5 11:32:17 1999 H.J. Lu <hjl@gnu.org>
+
+ * gconv_stubs.c: Renamed from stubs.c.
+ Support glibc 2.1.x.
+
+Mon Aug 23 16:42:05 1999 H.J. Lu <hjl@gnu.org>
+
+ * Banner: New.
+ * COPYING.LIB: Likewise.
+ * Makefile: Likewise.
+ * README: Likewise.
+ * configure: Likewise.
+ * stubs.c: Likewise.
+ * test-stdio.c: Likewise.
diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/configure glibc-2.17-931-g30bbc0c.new/c_stubs/configure
--- glibc-2.17-931-g30bbc0c/c_stubs/configure 1970-01-01 05:30:00.000000000 +0530
+++ glibc-2.17-931-g30bbc0c.new/c_stubs/configure 2013-08-16 16:26:11.637020805 +0530
@@ -0,0 +1,5 @@
+# This is only to keep the GNU C library configure mechanism happy.
+# This is a shell script fragment sourced by the main configure script.
+
+libc_add_on_canonical=
+libc_add_on_subdirs=.
diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/COPYING.LIB glibc-2.17-931-g30bbc0c.new/c_stubs/COPYING.LIB
--- glibc-2.17-931-g30bbc0c/c_stubs/COPYING.LIB 1970-01-01 05:30:00.000000000 +0530
+++ glibc-2.17-931-g30bbc0c.new/c_stubs/COPYING.LIB 2011-10-19 16:34:41.000000000 +0530
@@ -0,0 +1,482 @@
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL. It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it. You can use it for
+your libraries, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library. If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software. To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+ Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs. This
+license, the GNU Library General Public License, applies to certain
+designated libraries. This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+ The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it. Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program. However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+ Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries. We
+concluded that weaker conditions might promote sharing better.
+
+ However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves. This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them. (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.) The hope is that this
+will lead to faster development of free libraries.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+ Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+ GNU LIBRARY GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License"). Each licensee is
+addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ c) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ d) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ MA 02111-1307, USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/gconv_stubs.c glibc-2.17-931-g30bbc0c.new/c_stubs/gconv_stubs.c
--- glibc-2.17-931-g30bbc0c/c_stubs/gconv_stubs.c 1970-01-01 05:30:00.000000000 +0530
+++ glibc-2.17-931-g30bbc0c.new/c_stubs/gconv_stubs.c 2011-10-19 16:34:41.000000000 +0530
@@ -0,0 +1,126 @@
+/* Provide gconv stub functions for the minimum static binaries.
+ Copyright (C) 1999, 2001, 2003, 2004 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <features.h>
+#include <string.h>
+#include <wchar.h>
+#include <bits/libc-lock.h>
+#if __GNUC_PREREQ(3, 3)
+# include <gconv_int.h>
+#else
+# include <gconv.h>
+#endif
+
+__libc_lock_define_initialized (, __gconv_lock)
+
+/* hack for self identification */
+int __c_stubs_is_compiled_in;
+
+/* Don't drag in the dynamic linker. */
+void *__libc_stack_end;
+
+int attribute_hidden
+__gconv_OK (void)
+{
+#if __GLIBC__ > 2 || __GLIBC_MINOR__ > 1
+ return __GCONV_OK;
+#else
+ return GCONV_OK;
+#endif
+}
+
+int attribute_hidden
+__gconv_NOCONV (void)
+{
+#if __GLIBC__ > 2 || __GLIBC_MINOR__ > 1
+ return __GCONV_NOCONV;
+#else
+ return GCONV_NOCONV;
+#endif
+}
+
+void attribute_hidden
+__gconv_NOOP (void)
+{
+}
+
+int
+internal_function
+__gconv_compare_alias (const char *name1, const char *name2)
+{
+ return strcmp (name1, name2);
+}
+
+wint_t
+__gconv_btwoc_ascii (struct __gconv_step *step, unsigned char c)
+{
+ if (c < 0x80)
+ return c;
+ else
+ return WEOF;
+}
+
+
+#if __GNUC_PREREQ(3, 3)
+# undef strong_alias
+# define strong_alias(impl, name) \
+ __typeof (name) name __attribute__ ((alias (#impl)))
+#endif
+
+strong_alias (__gconv_OK,
+ __gconv_close_transform);
+strong_alias (__gconv_OK,
+ __gconv_close);
+
+strong_alias (__gconv_NOCONV,
+ __gconv);
+strong_alias (__gconv_NOCONV,
+ __gconv_find_transform);
+strong_alias (__gconv_NOCONV,
+ __gconv_open);
+
+/* These transformations should not fail in normal conditions */
+strong_alias (__gconv_OK,
+ __gconv_transform_ascii_internal);
+strong_alias (__gconv_OK,
+ __gconv_transform_utf16_internal);
+strong_alias (__gconv_OK,
+ __gconv_transform_utf8_internal);
+strong_alias (__gconv_OK,
+ __gconv_transform_ucs2_internal);
+
+/* We can assume no conversion for these ones */
+strong_alias (__gconv_NOCONV,
+ __gconv_transform_internal_ascii);
+strong_alias (__gconv_NOCONV,
+ __gconv_transform_internal_ucs2);
+strong_alias (__gconv_NOCONV,
+ __gconv_transform_internal_ucs4);
+strong_alias (__gconv_NOCONV,
+ __gconv_transform_internal_utf16);
+strong_alias (__gconv_NOCONV,
+ __gconv_transform_internal_utf8);
+
+strong_alias (__gconv_NOCONV,
+ __gconv_transliterate);
+
+strong_alias (__gconv_NOOP,
+ __gconv_release_cache);
+strong_alias (__gconv_NOOP,
+ __gconv_release_step);
diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/Makefile glibc-2.17-931-g30bbc0c.new/c_stubs/Makefile
--- glibc-2.17-931-g30bbc0c/c_stubs/Makefile 1970-01-01 05:30:00.000000000 +0530
+++ glibc-2.17-931-g30bbc0c.new/c_stubs/Makefile 2011-10-19 16:34:41.000000000 +0530
@@ -0,0 +1,46 @@
+# Copyright (C) 1999 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 Library General Public License as
+# published by the Free Software Foundation; either version 2 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
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+#
+# Sub-makefile for the C stub add-on library.
+#
+subdir := c_stubs
+
+tests-static := test-stdio
+tests := $(tests-static)
+
+libc_stubs-objs := gconv_stubs.o
+
+install-lib := libc_stubs.a
+non-lib.a := libc_stubs.a
+
+extra-objs := gconv_stubs.o libc_stubs.a
+
+include ../Makeconfig
+
+CPPFLAGS += -I../iconv
+
+include ../Rules
+
+$(objpfx)libc_stubs.a: $(addprefix $(objpfx), $(libc_stubs-objs))
+ -rm -f $@
+ $(CC) -nostdlib -nostartfiles -r -o $@ $^
+
+lib: $(objpfx)libc_stubs.a
+
+$(objpfx)test-stdio: $(objpfx)libc_stubs.a
diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/README glibc-2.17-931-g30bbc0c.new/c_stubs/README
--- glibc-2.17-931-g30bbc0c/c_stubs/README 1970-01-01 05:30:00.000000000 +0530
+++ glibc-2.17-931-g30bbc0c.new/c_stubs/README 2011-10-19 16:34:41.000000000 +0530
@@ -0,0 +1,8 @@
+This is a stub add-on library for the GNU C library version 2.1.2 and
+above. It is used to create the smaller static binaries by stubbing
+out the gconv related functions. The resulting binaries may not have
+all the functionalities.
+
+H.J. Lu
+hjl@gnu.org
+12/05/1999
diff -pruN glibc-2.17-931-g30bbc0c/c_stubs/test-stdio.c glibc-2.17-931-g30bbc0c.new/c_stubs/test-stdio.c
--- glibc-2.17-931-g30bbc0c/c_stubs/test-stdio.c 1970-01-01 05:30:00.000000000 +0530
+++ glibc-2.17-931-g30bbc0c.new/c_stubs/test-stdio.c 2011-10-19 16:34:41.000000000 +0530
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int
+main (void)
+{
+ printf ("Hello world\n");
+ return 0;
+}

View file

@ -0,0 +1,22 @@
diff -urN glibc-2.20.mod/sysdeps/unix/sysv/linux/x86/elision-conf.c glibc-2.20/sysdeps/unix/sysv/linux/x86/elision-conf.c
--- glibc-2.20.mod/sysdeps/unix/sysv/linux/x86/elision-conf.c 2014-09-27 00:25:46.443462345 -0400
+++ glibc-2.20/sysdeps/unix/sysv/linux/x86/elision-conf.c 2014-09-27 00:29:53.586615813 -0400
@@ -62,12 +62,16 @@
char **argv __attribute__ ((unused)),
char **environ)
{
- __elision_available = HAS_RTM;
#ifdef ENABLE_LOCK_ELISION
+ __elision_available = HAS_RTM;
__pthread_force_elision = __libc_enable_secure ? 0 : __elision_available;
-#endif
if (!HAS_RTM)
__elision_aconf.retry_try_xbegin = 0; /* Disable elision on rwlocks */
+#else
+ __elision_available = 0;
+ __pthread_force_elision = 0;
+ __elision_aconf.retry_try_xbegin = 0;
+#endif
}
#ifdef SHARED

View file

@ -1,6 +1,7 @@
--- glibc-2.25.51/elf/dl-init.c.0044~ 2017-07-11 16:44:14.000000000 +0200
+++ glibc-2.25.51/elf/dl-init.c 2017-07-11 18:44:49.173115475 +0200
@@ -119,8 +119,6 @@ _dl_init (struct link_map *main_map, int
diff -up glibc-2.31.20200715/elf/dl-init.c.13~ glibc-2.31.20200715/elf/dl-init.c
--- glibc-2.31.20200715/elf/dl-init.c.13~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/elf/dl-init.c 2020-07-15 23:52:46.296238095 +0200
@@ -120,8 +120,6 @@ _dl_init (struct link_map *main_map, int
while (i-- > 0)
call_init (main_map->l_initfini[i], argc, argv, env);
@ -9,9 +10,10 @@
_dl_starting_up = 0;
-#endif
}
--- glibc-2.25.51/elf/dl-support.c.0044~ 2017-07-11 16:44:14.000000000 +0200
+++ glibc-2.25.51/elf/dl-support.c 2017-07-11 18:44:49.173115475 +0200
@@ -117,10 +117,8 @@ struct r_scope_elem _dl_initial_searchli
diff -up glibc-2.31.20200715/elf/dl-support.c.13~ glibc-2.31.20200715/elf/dl-support.c
--- glibc-2.31.20200715/elf/dl-support.c.13~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/elf/dl-support.c 2020-07-15 23:52:46.296238095 +0200
@@ -120,10 +120,8 @@ struct r_scope_elem _dl_initial_searchli
.r_nlist = 1,
};
@ -22,17 +24,18 @@
/* Random data provided by the kernel. */
void *_dl_random;
--- glibc-2.25.51/elf/rtld.c.0044~ 2017-07-11 16:44:14.000000000 +0200
+++ glibc-2.25.51/elf/rtld.c 2017-07-11 18:45:48.606706875 +0200
@@ -214,7 +214,6 @@ audit_list_iter_next (struct audit_list_
return iter->previous->name;
diff -up glibc-2.31.20200715/elf/rtld.c.13~ glibc-2.31.20200715/elf/rtld.c
--- glibc-2.31.20200715/elf/rtld.c.13~ 2020-07-15 17:58:07.000000000 +0200
+++ glibc-2.31.20200715/elf/rtld.c 2020-07-15 23:57:44.187875422 +0200
@@ -316,7 +316,6 @@ audit_list_count (struct audit_list *lis
return naudit;
}
-#ifndef HAVE_INLINED_SYSCALLS
/* Set nonzero during loading and initialization of executable and
libraries, cleared before the executable's entry point runs. This
must not be initialized to nonzero, because the unused dynamic
@@ -224,7 +223,6 @@ audit_list_iter_next (struct audit_list_
@@ -326,7 +325,6 @@ audit_list_count (struct audit_list *lis
never be called. */
int _dl_starting_up = 0;
rtld_hidden_def (_dl_starting_up)
@ -40,9 +43,9 @@
/* This is the structure which defines all variables global to ld.so
(except those which cannot be added for some reason). */
@@ -898,10 +896,8 @@ dl_main (const ElfW(Phdr) *phdr,
@@ -1178,10 +1176,8 @@ dl_main (const ElfW(Phdr) *phdr,
/* Process the environment variable which control the behaviour. */
process_envvars (&mode);
process_envvars (&mode, &audit_list);
-#ifndef HAVE_INLINED_SYSCALLS
/* Set up a flag which tells we are just starting. */

View file

@ -0,0 +1,45 @@
From 70d0a630700f602a457832383161d261fe222db5 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Thu, 1 Jul 2010 13:14:26 +0200
Subject: [PATCH] Fix PLT reference
* include/sys/resource.h (__getrlimit): Add hidden proto.
* sysdeps/unix/sysv/linux/i386/getrlimit.c: Add libc_hidden_weak.
* sysdeps/mach/hurd/getrlimit.c: Add libc_hidden_def.
* resource/getrlimit.c: Likewise.
---
ChangeLog | 7 +++++++
include/sys/resource.h | 1 +
resource/getrlimit.c | 1 +
sysdeps/mach/hurd/getrlimit.c | 1 +
sysdeps/unix/sysv/linux/i386/getrlimit.c | 1 +
5 files changed, 11 insertions(+), 0 deletions(-)
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -14,5 +14,6 @@ extern int __getrusage (enum __rusage_who __who, struct rusage *__usage)
extern int __setrlimit (enum __rlimit_resource __resource,
const struct rlimit *__rlimits);
+libc_hidden_proto (__getrlimit)
#endif
#endif
--- a/resource/getrlimit.c
+++ b/resource/getrlimit.c
@@ -27,6 +27,7 @@ __getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
__set_errno (ENOSYS);
return -1;
}
+libc_hidden_def (__getrlimit)
weak_alias (__getrlimit, getrlimit)
stub_warning (getrlimit)
--- a/sysdeps/mach/hurd/getrlimit.c
+++ b/sysdeps/mach/hurd/getrlimit.c
@@ -43,4 +43,5 @@ __getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)
return 0;
}
+libc_hidden_def (__getrlimit)
weak_alias (__getrlimit, getrlimit)

View file

@ -1,18 +0,0 @@
diff -Nrup a/sysdeps/i386/Makefile b/sysdeps/i386/Makefile
--- a/sysdeps/i386/Makefile 2012-06-05 07:42:49.000000000 -0600
+++ b/sysdeps/i386/Makefile 2012-06-07 12:15:21.826318641 -0600
@@ -62,6 +64,14 @@ endif
ifneq (,$(filter -mno-tls-direct-seg-refs,$(CFLAGS)))
defines += -DNO_TLS_DIRECT_SEG_REFS
+else
+# .a libraries are not performance critical and so we
+# build them without direct TLS segment references
+# always.
+CPPFLAGS-.o += -DNO_TLS_DIRECT_SEG_REFS
+CFLAGS-.o += -mno-tls-direct-seg-refs
+CPPFLAGS-.oS += -DNO_TLS_DIRECT_SEG_REFS
+CFLAGS-.oS += -mno-tls-direct-seg-refs
endif
ifeq ($(subdir),elf)

View file

@ -1,25 +0,0 @@
diff -up glibc-2.27.20180720/nptl/Makefile.0034~ glibc-2.27.20180720/nptl/Makefile
--- glibc-2.27.20180720/nptl/Makefile.0034~ 2018-07-20 02:29:28.763982849 +0200
+++ glibc-2.27.20180720/nptl/Makefile 2018-07-20 02:33:04.128058315 +0200
@@ -623,14 +623,18 @@ $(addprefix $(objpfx), \
$(tests) $(tests-internal) $(xtests) $(test-srcs))): \
$(objpfx)libpthread.so
$(objpfx)tst-unload: $(libdl)
-# $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
+# $(objpfx)linklibc.so is used instead of $(common-objpfx)libc.so,
# since otherwise libpthread.so comes before libc.so when linking.
$(addprefix $(objpfx), $(tests-reverse)): \
- $(objpfx)../libc.so $(objpfx)libpthread.so
-$(objpfx)../libc.so: $(common-objpfx)libc.so ;
+ $(objpfx)linklibc.so $(objpfx)libpthread.so
+$(objpfx)linklibc.so: $(common-objpfx)libc.so ;
$(addprefix $(objpfx),$(tests-static) $(xtests-static)): $(objpfx)libpthread.a
$(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so
+
+$(objpfx)linklibc.so: $(common-objpfx)libc.so
+ ln -s ../libc.so $@
+generated += libclink.so
else
$(addprefix $(objpfx),$(tests) $(test-srcs)): $(objpfx)libpthread.a
endif

View file

@ -0,0 +1,28 @@
This is part of commit glibc-2.3.3-1564-gd0b6ac6
* Fri Mar 14 2008 Jakub Jelinek <jakub@redhat.com> 2.7.90-11
- remove <stropts.h>, define _XOPEN_STREAMS -1 (#436349)
diff -Nrup a/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h b/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h
--- a/sysdeps/unix/sysv/linux/bits/posix_opt.h 2012-06-05 07:42:49.000000000 -0600
+++ b/sysdeps/unix/sysv/linux/bits/posix_opt.h 2012-06-07 12:15:21.817318674 -0600
@@ -188,4 +188,7 @@
/* Typed memory objects are not available. */
#define _POSIX_TYPED_MEMORY_OBJECTS -1
+/* Streams are not available. */
+#define _XOPEN_STREAMS -1
+
#endif /* bits/posix_opt.h */
diff -Nrup a/streams/Makefile b/streams/Makefile
--- a/streams/Makefile 2012-06-05 07:42:49.000000000 -0600
+++ b/streams/Makefile 2012-06-07 12:15:21.824318649 -0600
@@ -20,7 +20,7 @@
include ../Makeconfig
-headers = stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
+#headers = stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
routines = isastream getmsg getpmsg putmsg putpmsg fattach fdetach
include ../Rules

View file

@ -0,0 +1,50 @@
From cde99cd2b7b16a6113acb054e89d490047932a9f Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Thu, 8 Apr 2010 11:18:26 +0200
Subject: [PATCH] Don't call uname or getrlimit in libpthread init function
* sysdeps/unix/sysv/linux/i386/Versions: Export __uname under
GLIBC_PRIVATE.
* nptl/Versions: Export __getrlimit under GLIBC_PRIVATE.
* sysdeps/unix/sysv/linux/i386/smp.h: Call __uname instead of uname.
* nptl/nptl-init.c: Call __getrlimit instead of getrlimit.
---
ChangeLog | 8 ++++++++
nptl/Versions | 1 +
nptl/nptl-init.c | 2 +-
sysdeps/unix/sysv/linux/i386/Versions | 6 ++++++
sysdeps/unix/sysv/linux/i386/smp.h | 2 +-
5 files changed, 17 insertions(+), 2 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/i386/Versions
--- a/nptl/Version
+++ b/nptl/Versions
@@ -30,6 +30,7 @@ libc {
__libc_pthread_init;
__libc_current_sigrtmin_private; __libc_current_sigrtmax_private;
__libc_allocate_rtsig_private;
+ __getrlimit;
}
}
--- a/sysdeps/unix/sysv/linux/i386/Versions
+++ b/sysdeps/unix/sysv/linux/i386/Versions
@@ -53,5 +53,6 @@
}
GLIBC_PRIVATE {
__modify_ldt;
+ __uname;
}
}
--- a/sysdeps/unix/sysv/linux/i386/smp.h
+++ b/sysdeps/unix/sysv/linux/i386/smp.h
@@ -36,7 +36,7 @@ is_smp_system (void)
char *cp;
/* Try reading the number using `sysctl' first. */
- if (uname (&u.uts) == 0)
+ if (__uname (&u.uts) == 0)
cp = u.uts.version;
else
{

6264
glibc-new-condvar.patch Normal file

File diff suppressed because it is too large Load diff

1946
glibc-rh1315108.patch Normal file

File diff suppressed because it is too large Load diff

176
glibc-rh1335011.patch Normal file
View file

@ -0,0 +1,176 @@
Revert these two upstream commits, to unbreak ASAN:
commit e91bd7465816f474617dcb4bbfe72f3594c5783c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.com>
Date: Thu Mar 31 10:51:51 2016 -0300
Fix tst-dlsym-error build
This patch fixes the new test tst-dlsym-error build on aarch64
(and possible other architectures as well) due missing strchrnul
definition.
* elf/tst-dlsym-error.c: Include <string.h> for strchrnul.
commit 7d45c163d00c88d5875a112343c4ea3e61349e6b
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Mar 31 11:26:55 2016 +0200
Report dlsym, dlvsym lookup errors using dlerror [BZ #19509]
* elf/dl-lookup.c (_dl_lookup_symbol_x): Report error even if
skip_map != NULL.
* elf/tst-dlsym-error.c: New file.
* elf/Makefile (tests): Add tst-dlsym-error.
(tst-dlsym-error): Link against libdl.
Index: b/elf/Makefile
===================================================================
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -149,7 +149,7 @@ tests += loadtest restest1 preloadtest l
tst-nodelete) \
tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
- tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error
+ tst-nodelete2 tst-audit11 tst-audit12
# reldep9
ifeq ($(build-hardcoded-path-in-tests),yes)
tests += tst-dlopen-aout
@@ -1258,5 +1258,3 @@ $(objpfx)tst-prelink-cmp.out: tst-prelin
$(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
$(SHELL) $< '$(common-objpfx)' '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
$(evaluate-test)
-
-$(objpfx)tst-dlsym-error: $(libdl)
Index: b/elf/dl-lookup.c
===================================================================
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -858,6 +858,7 @@ _dl_lookup_symbol_x (const char *undef_n
if (__glibc_unlikely (current_value.s == NULL))
{
if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
+ && skip_map == NULL
&& !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
{
/* We could find no value for a strong reference. */
Index: b/elf/tst-dlsym-error.c
===================================================================
--- a/elf/tst-dlsym-error.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Test error reporting for dlsym, dlvsym failures.
- Copyright (C) 2016 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
- <http://www.gnu.org/licenses/>. */
-
-#include <dlfcn.h>
-#include <gnu/lib-names.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Used to disambiguate symbol names. */
-static int counter;
-
-static void
-test_one (void *handle, const char *name, void *(func) (void *, const char *),
- const char *suffix)
-{
- ++counter;
- char symbol[32];
- snprintf (symbol, sizeof (symbol), "no_such_symbol_%d", counter);
- char *expected_message;
- if (asprintf (&expected_message, ": undefined symbol: %s%s",
- symbol, suffix) < 0)
- {
- printf ("error: asprintf: %m\n");
- abort ();
- }
-
- void *addr = func (handle, symbol);
- if (addr != NULL)
- {
- printf ("error: %s: found symbol \"no_such_symbol\"\n", name);
- abort ();
- }
- const char *message = dlerror ();
- if (message == NULL)
- {
- printf ("error: %s: missing error message\n", name);
- abort ();
- }
- const char *message_without_path = strchrnul (message, ':');
- if (strcmp (message_without_path, expected_message) != 0)
- {
- printf ("error: %s: unexpected error message: %s\n", name, message);
- abort ();
- }
- free (expected_message);
-
- message = dlerror ();
- if (message != NULL)
- {
- printf ("error: %s: unexpected error message: %s\n", name, message);
- abort ();
- }
-}
-
-static void
-test_handles (const char *name, void *(func) (void *, const char *),
- const char *suffix)
-{
- test_one (RTLD_DEFAULT, name, func, suffix);
- test_one (RTLD_NEXT, name, func, suffix);
-
- void *handle = dlopen (LIBC_SO, RTLD_LAZY);
- if (handle == NULL)
- {
- printf ("error: cannot dlopen %s: %s\n", LIBC_SO, dlerror ());
- abort ();
- }
- test_one (handle, name, func, suffix);
- dlclose (handle);
-}
-
-static void *
-dlvsym_no_such_version (void *handle, const char *name)
-{
- return dlvsym (handle, name, "NO_SUCH_VERSION");
-}
-
-static void *
-dlvsym_glibc_private (void *handle, const char *name)
-{
- return dlvsym (handle, name, "GLIBC_PRIVATE");
-}
-
-static int
-do_test (void)
-{
- test_handles ("dlsym", dlsym, "");
- test_handles ("dlvsym", dlvsym_no_such_version,
- ", version NO_SUCH_VERSION");
- test_handles ("dlvsym", dlvsym_glibc_private,
- ", version GLIBC_PRIVATE");
-
- return 0;
-}
-
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"

102
glibc-rtkaio-clock.patch Normal file
View file

@ -0,0 +1,102 @@
#
# Based on the following upstream commit:
#
# commit 6e6249d0b461b952d0f544792372663feb6d792a
# Author: Roland McGrath <roland@hack.frob.com>
# Date: Wed Oct 24 14:50:46 2012 -0700
#
# BZ#14743: Move clock_* symbols from librt to libc.
#
# We remove the clock* functions from librtkaio.so.1 and
# use those provided in libc.so.6, matching librt.so.
#
--- glibc-2.21-63-gebf27d1.mod/rtkaio/clock-compat.c 1969-12-31 19:00:00.000000000 -0500
+++ glibc-2.21-63-gebf27d1/rtkaio/clock-compat.c 2015-02-12 01:28:59.615026597 -0500
@@ -0,0 +1,2 @@
+#define librt librtkaio
+#include <rt/clock-compat.c>
diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_getcpuclockid.c glibc-2.21-59-gd35273f/rtkaio/kaio_clock_getcpuclockid.c
--- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_getcpuclockid.c 2015-02-11 13:00:55.105400863 -0500
+++ glibc-2.21-59-gd35273f/rtkaio/kaio_clock_getcpuclockid.c 1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-#include <clock_getcpuclockid.c>
diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_getres.c glibc-2.21-59-gd35273f/rtkaio/kaio_clock_getres.c
--- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_getres.c 2015-02-11 13:00:55.105400863 -0500
+++ glibc-2.21-59-gd35273f/rtkaio/kaio_clock_getres.c 1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-#include <clock_getres.c>
diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_gettime.c glibc-2.21-59-gd35273f/rtkaio/kaio_clock_gettime.c
--- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_gettime.c 2015-02-11 13:00:55.109400738 -0500
+++ glibc-2.21-59-gd35273f/rtkaio/kaio_clock_gettime.c 1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-#include <clock_gettime.c>
diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_nanosleep.c glibc-2.21-59-gd35273f/rtkaio/kaio_clock_nanosleep.c
--- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_nanosleep.c 2015-02-11 13:00:55.115400552 -0500
+++ glibc-2.21-59-gd35273f/rtkaio/kaio_clock_nanosleep.c 1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-#include <clock_nanosleep.c>
diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_settime.c glibc-2.21-59-gd35273f/rtkaio/kaio_clock_settime.c
--- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_clock_settime.c 2015-02-11 13:00:55.110400708 -0500
+++ glibc-2.21-59-gd35273f/rtkaio/kaio_clock_settime.c 1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-#include <clock_settime.c>
diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/kaio_get_clockfreq.c glibc-2.21-59-gd35273f/rtkaio/kaio_get_clockfreq.c
--- glibc-2.21-59-gd35273f.mod/rtkaio/kaio_get_clockfreq.c 2015-02-11 13:00:55.118400459 -0500
+++ glibc-2.21-59-gd35273f/rtkaio/kaio_get_clockfreq.c 1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-#include <get_clockfreq.c>
diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/Makefile glibc-2.21-59-gd35273f/rtkaio/Makefile
--- glibc-2.21-59-gd35273f.mod/rtkaio/Makefile 2015-02-11 13:00:55.107400801 -0500
+++ glibc-2.21-59-gd35273f/rtkaio/Makefile 2015-02-11 22:46:46.930374298 -0500
@@ -25,9 +25,6 @@
aio_read64 aio_return aio_suspend aio_write \
aio_write64 lio_listio lio_listio64 aio_sigqueue \
aio_notify
-clock-routines := get_clockfreq clock_getcpuclockid \
- clock_getres clock_gettime clock_settime \
- clock_nanosleep
timer-routines := timer_create timer_delete timer_getoverr \
timer_gettime timer_settime
shm-routines := shm_open shm_unlink
@@ -36,8 +33,9 @@
mq_timedreceive
librtkaio-routines = $(patsubst %,k%,$(aio-routines)) \
- $(patsubst %,kaio_%,$(clock-routines) $(timer-routines) \
- $(shm-routines) $(mq-routines))
+ $(patsubst %,kaio_%,$(timer-routines) \
+ $(shm-routines) $(mq-routines)) \
+ clock-compat
tests := tst-shm tst-clock tst-clock_nanosleep tst-timer tst-timer2 \
tst-aio tst-aio64 tst-aio2 tst-aio3 tst-aio4 tst-aio5 tst-aio6 \
@@ -64,7 +62,6 @@
include $(..)Rules
CFLAGS-kaio_suspend.c = -fexceptions
-CFLAGS-kaio_clock_nanosleep.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-kaio_librt-cancellation.c = -fasynchronous-unwind-tables
LDFLAGS-rtkaio.so = -Wl,-soname=lib$(libprefix)rt.so$(librt.so-version) \
@@ -88,9 +85,6 @@
else
$(addprefix $(objpfx),$(tests)): $(objpfx)librtkaio.a $(static-thread-library)
endif
-ifeq (yes,$(build-bounded))
-$(tests:%=$(objpfx)%-bp): $(objpfx)librtkaio_b.a $(bounded-thread-library)
-endif
tst-mqueue7-ARGS = -- $(built-program-file)
diff -urN glibc-2.21-59-gd35273f.mod/rtkaio/Versions glibc-2.21-59-gd35273f/rtkaio/Versions
--- glibc-2.21-59-gd35273f.mod/rtkaio/Versions 2015-02-11 13:00:55.118400459 -0500
+++ glibc-2.21-59-gd35273f/rtkaio/Versions 2015-02-11 22:36:11.974051389 -0500
@@ -6,7 +6,7 @@
aio_suspend64; aio_write; aio_write64; lio_listio; lio_listio64;
}
GLIBC_2.2 {
- # c*
+ # These have moved to libc and are still here only for compatibility.
clock_getres; clock_gettime; clock_settime; clock_getcpuclockid;
clock_nanosleep;

26
glibc-rtkaio-libof.patch Normal file
View file

@ -0,0 +1,26 @@
diff -pruN glibc-2.21-649-gae5eae7/rtkaio/Makefile glibc-2.21-649-gae5eae7.new/rtkaio/Makefile
--- glibc-2.21-649-gae5eae7/rtkaio/Makefile 2015-07-27 22:57:05.742601066 +0530
+++ glibc-2.21-649-gae5eae7.new/rtkaio/Makefile 2015-07-27 23:33:09.892874337 +0530
@@ -66,7 +66,9 @@ CFLAGS-kaio_librt-cancellation.c = -fasy
LDFLAGS-rtkaio.so = -Wl,-soname=lib$(libprefix)rt.so$(librt.so-version) \
-Wl,--enable-new-dtags,-z,nodelete
-CPPFLAGS-librtkaio += -DIS_IN_librt=1 -I$(..)rt
+# Resort to this ugliness of undefining and defining MODULE_NAME because
+# setting libof-<> to librt has many more side-effects that we want to avoid.
+CPPFLAGS-librtkaio += -I$(..)rt -UMODULE_NAME -DMODULE_NAME=librt
rpath-dirs := $(patsubst rt,rtkaio,$(rpath-dirs))
diff -pruN glibc-2.21-649-gae5eae7/rtkaio/sysdeps/unix/sysv/linux/syscalls.list glibc-2.21-649-gae5eae7.new/rtkaio/sysdeps/unix/sysv/linux/syscalls.list
--- glibc-2.21-649-gae5eae7/rtkaio/sysdeps/unix/sysv/linux/syscalls.list 2015-07-27 22:47:23.073776396 +0530
+++ glibc-2.21-649-gae5eae7.new/rtkaio/sysdeps/unix/sysv/linux/syscalls.list 2015-07-27 23:33:09.892874337 +0530
@@ -1,5 +1,5 @@
# File name Caller Syscall name Args Strong name Weak names
-kaio_mq_timedsend - mq_timedsend Ci:ipiip __GI_mq_timedsend mq_timedsend
-kaio_mq_timedreceive - mq_timedreceive Ci:ipipp __GI_mq_timedreceive mq_timedreceive
-kaio_mq_setattr - mq_getsetattr i:ipp __GI_mq_setattr mq_setattr
+kaio_mq_timedsend - mq_timedsend Ci:ipiip __mq_timedsend mq_timedsend
+kaio_mq_timedreceive - mq_timedreceive Ci:ipipp __mq_timedreceive mq_timedreceive
+kaio_mq_setattr - mq_getsetattr i:ipp mq_setattr

5015
glibc-rtkaio.patch Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
%bcond_with crosscompilers
%bcond_without crosscompilers
%ifarch %{ix86} %{arm}
# FIXME add riscv32-linux when glibc starts supporting it
# FIXME Determine why (and fix) 32-bit platform to x86_64-linux crosscompilers
@ -19,18 +19,12 @@
%define _libdir32 %{_prefix}/lib
%define _libdirn32 %{_prefix}/lib32
%define ver 2.31
%define linaro %{nil}
%define ver 2.32
%define fullver 2.32
%define oname glibc
%define major 6
%if "%{linaro}" != ""
%define fullver %{ver}-%{linaro}
%define source_dir glibc-linaro-%{fullver}
%else
%define fullver %{ver}
%define source_dir %{oname}-%{ver}
%endif
%define checklist %{_builddir}/%{source_dir}/Check.list
%define libc %mklibname c %{major}
%define devname %mklibname -d c
@ -38,15 +32,14 @@
%define multilibc libc%{major}
%define _disable_rebuild_configure 1
%bcond_with lto
%if !%{with lto}
# (tpg) 2020-08-20 by default glibc is not designed to make use of LTO
%define _disable_lto 1
%endif
%define _disable_ld_no_undefined 1
# (tpg) optimize it a bit
%global optflags %{optflags} -O3
%global optflags %{optflags} -O3 -Wno-error=stringop-overflow -fno-strict-aliasing
%global platform %{_target_vendor}-%{_target_os}%{?_gnu}
%global target_cpu %{_target_cpu}
@ -73,11 +66,12 @@
%ifarch %{aarch64}
# Before increasing, please make sure all
# boxes we support can be updated:
# As of 2018/06/08:
# Opteron server boxes have 4.4.x
# As of 2020/07/15:
# Synquacer, Macchiatobin and friends have mainline
# Rockchip 3399 has 4.4.x
# Gemini PDA has 3.18.x
%define enablekernel 3.18.0
# Nexus 5X has 3.10.x
%define enablekernel 3.10.0
%else
# (tpg) some popular clouds will fail with error "FATAL: kernel too old"
# when running our docker or building it. Let's be safe and pretend it's 2015.
@ -107,38 +101,26 @@
%endif
# build documentation by default
%bcond_with doc
%bcond_without doc
%bcond_with pdf
# enable utils by default
%bcond_without utils
# If devel-rpm-generators is used, explicitly
# force it to automatically detect bitness of ELF
# executable despite system-wide value of this macro,
# because here in glibc 32 and 64 bit *.so are mixed
%global __develgen_auto_bitness 1
#-----------------------------------------------------------------------
Summary: The GNU libc libraries
Name: %{cross_prefix}%{oname}
Epoch: 6
%if "%{linaro}" != ""
Version: %{ver}_%{linaro}
Source0: http://cbuild.validation.linaro.org/snapshots/glibc-linaro-%{fullver}.tar.xz
%else
Version: %{ver}
Source0: http://ftp.gnu.org/gnu/glibc/%{oname}-%{ver}.tar.xz
#if %(test $(echo %{version}.0 |cut -d. -f3) -lt 90 && echo 1 || echo 0)
#Source1: http://ftp.gnu.org/gnu/glibc/%{oname}-%{ver}.tar.xz.sig
#endif
%endif
Release: 7
Release: 2
License: LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Group: System/Libraries
Url: http://www.gnu.org/software/libc/
# From Fedora
Source2: glibc_post_upgrade.c
Source3: glibc-manpages.tar.bz2
Source5: glibc-check.sh
Source10: libc-lock.h
@ -153,7 +135,6 @@ Source1003: locales.sysconfig
#-----------------------------------------------------------------------
# fedora patches
Patch21: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-i386-tls-direct-seg-refs.patch
Patch25: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-linux-tcsetattr.patch
Patch26: eglibc-fedora-locale-euro.patch
Patch27: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-localedata-rh61908.patch
@ -164,7 +145,6 @@ Patch30: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-lo
Patch31: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-locarchive.patch
Patch32: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-manual-dircategory.patch
Patch33: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-nis-rh188246.patch
Patch34: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-nptl-linklibc.patch
Patch35: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-ppc-unwind.patch
Patch36: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-aarch64-tls-fixes.patch
Patch38: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-arm-hardfloat-3.patch
@ -194,14 +174,9 @@ Patch85: https://github.com/clearlinux-pkgs/glibc/blob/master/spinaphore.patch
Patch86: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/large-page-huge-page.patch
Patch87: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/use_madv_free.patch
Patch88: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/malloc_tune.patch
Patch89: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/ldconfig-format-new.patch
# (tpg) CLR disabled this patch
#Patch90: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/ldconfig-Os.patch
%if %{with lto}
Patch91: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/mathlto.patch
%endif
Patch92: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/pause.patch
Patch99: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/gcc-8-fix.patch
Patch100: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/spin-smarter.patch
Patch101: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/nostackshrink.patch
@ -214,34 +189,27 @@ Patch101: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/nostack
#-----------------------------------------------------------------------
# OpenMandriva patches
Patch1000: eglibc-mandriva-localedef-archive-follow-symlinks.patch
Patch1001: eglibc-mandriva-fix-dns-with-broken-routers.patch
Patch1002: eglibc-mandriva-nss-upgrade.patch
Patch1003: eglibc-mandriva-share-locale.patch
Patch1004: eglibc-mandriva-nsswitch.conf.patch
Patch1005: eglibc-mandriva-xterm-xvt.patch
Patch1006: eglibc-mandriva-nscd-enable.patch
Patch1007: eglibc-mandriva-nscd-no-host-cache.patch
Patch1009: eglibc-mandriva-nscd-init-should-start.patch
Patch1010: eglibc-mandriva-timezone.patch
Patch1011: eglibc-mandriva-biarch-cpp-defines.patch
Patch1012: eglibc-mandriva-ENOTTY-fr-translation.patch
Patch1013: eglibc-mandriva-biarch-utils.patch
Patch1015: glibc-2.26-no-attribute-leaf-for-clang.patch
Patch1018: eglibc-mandriva-testsuite-ldbl-bits.patch
Patch1019: eglibc-mandriva-testsuite-rt-notparallel.patch
Patch1020: glibc-2.19-no-__builtin_va_arg_pack-with-clang.patch
#Patch1021: eglibc-mandriva-no-leaf-attribute.patch
# http://sourceware.org/bugzilla/show_bug.cgi?id=14995
# http://sourceware.org/bugzilla/attachment.cgi?id=6795
Patch1029: glibc-2.19-nscd-socket-and-pid-moved-from-varrun-to-run.patch
Patch1033: glibc-2.25-force-use-ld-bfd.patch
Patch1034: glibc-2.27-clang-_Float.patch
Patch1035: glibc-2.29-aarch64-buildfix.patch
Patch1036: glibc-2.29-strict-aliasing.patch
Patch1037: glibc-2.29-SIG_BLOCK.patch
Patch1038: glibc-2.31.9000-aarch64-compile.patch
Patch1039: https://github.com/FireBurn/glibc/commit/4483f2500825a84382c2a6a9ac60fc77954533d7.patch
Patch1040: https://github.com/FireBurn/glibc/commit/2efa9591e5e8a129e7b73ad0dad3eecbd69482ff.patch
# do not remove this BR - it helps to bootstrap the generator
BuildRequires: devel-rpm-generators
BuildRequires: autoconf2.5
BuildRequires: %{cross_prefix}binutils >= 2.30-7
BuildRequires: %{cross_prefix}gcc
@ -314,11 +282,138 @@ Linux system will not function.
required = '%{enablekernel}'
rel = posix.uname("%r")
if rpm.vercmp(rel, required) < 0 then
error("FATAL: kernel too old", 0)
error("FATAL: installed kernel is too old for glibc", 0)
end
%post -p <lua>
os.execute("/usr/sbin/glibc_post_upgrade")
-- 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
assert (posix.exec (program, ...))
elseif pid > 0 then
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",
"%{_libdir}/power6",
"%{_libdir}/power7",
"%{_libdir}/power8" }
-- 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
-- (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 ("/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 ("%{_sbindir}/iconvconfig",
"-o", iconv_cache,
"--nostdlib",
iconv_dir)
else
io.stdout:write ("Error: Missing " .. iconv_cache .. " file.\n")
end
%transfiletriggerin -p <lua> -- /lib/ /lib64/ /usr/lib/ /usr/lib64/ /etc/ld.so.conf.d/
os.execute("/sbin/ldconfig -X")
@ -376,6 +471,7 @@ LANG variable to their preferred language in their
%{expand:%(sh %{S:1000} "Catalan" "ca" "ca_AD" "ca_ES" "ca_FR" "ca_IT")}
%{expand:%(sh %{S:1000} "Chechen" "ce" "ce_RU")}
%{expand:%(sh %{S:1000} "Cherokee" "chr" "chr_US")}
%{expand:%(sh %{S:1000} "Central Kurdish" "ckb" "ckb_IQ")}
%{expand:%(sh %{S:1000} "Crimean Tatar" "crh" "crh_UA")}
%{expand:%(sh %{S:1000} "Czech" "cs" "cs_CZ")}
%{expand:%(sh %{S:1000} "Chuvash" "cv" "cv_RU")}
@ -552,9 +648,6 @@ LANG variable to their preferred language in their
%doc %{_docdir}/glibc/gai.conf
%doc %{_docdir}/glibc/COPYING
%doc %{_docdir}/glibc/COPYING.LIB
%{_mandir}/man1/*
%{_mandir}/man8/rpcinfo.8*
%{_mandir}/man8/ld.so*
%{_localedir}/locale.alias
/sbin/sln
%{_prefix}/libexec/getconf
@ -567,7 +660,7 @@ LANG variable to their preferred language in their
%exclude %{_prefix}/libexec/getconf/XBS5_ILP32_OFF32
%exclude %{_prefix}/libexec/getconf/XBS5_ILP32_OFFBIG
%endif
%{_slibdir}/ld-%{fullver}.so
%{_slibdir}/ld-[0-9]*.so
%if %isarch %{ix86}
%{_slibdir}/ld-linux.so.2
%endif
@ -620,9 +713,7 @@ LANG variable to their preferred language in their
%{_bindir}/sprof
%{_bindir}/tzselect
%{_sbindir}/iconvconfig
%{_sbindir}/glibc_post_upgrade
/sbin/ldconfig
%{_mandir}/man8/ldconfig*
%ghost %{_sysconfdir}/ld.so.cache
%dir %{_var}/cache/ldconfig
%ghost %{_var}/cache/ldconfig/aux-cache
@ -630,7 +721,7 @@ LANG variable to their preferred language in their
%else
%if %isarch mips mipsel
%if %{build_biarch}
%{_slibdir32}/ld-%{fullver}.so
%{_slibdir32}/ld-[0-9]*.so
%{_slibdir32}/ld.so.1
%{_slibdir32}/lib*-[.0-9]*.so
%{_slibdir32}/lib*.so.[0-9]*
@ -667,7 +758,7 @@ library and the standard math library. Without these two libraries, a
Linux system will not function.
%files -n %{multilibc}
%{_slibdir32}/ld-%{fullver}.so
%{_slibdir32}/ld-[0-9]*.so
%{_slibdir32}/ld-linux*.so.2
%{_slibdir32}/lib*-[.0-9]*.so
%{_slibdir32}/lib*.so.[0-9]*
@ -789,7 +880,7 @@ library.
%{_libdir}/libdl.a
%{_libdir}/libm.a
# Versioned libm.a seems to be generated only on x86_64
%optional %{_libdir}/libm-%{version}.a
%optional %{_libdir}/libm-[0-9]*.a
%{_libdir}/libpthread.a
%{_libdir}/libresolv.a
%{_libdir}/librt.a
@ -1031,11 +1122,7 @@ function BuildGlibc() {
BuildCompFlags=""
# -Wall is just added to get conditionally %%optflags printed...
# cut -flto flag
%if %{with lto}
BuildFlags="$(rpm --target ${arch}-%{_target_os} -D '%__common_cflags_with_ssp -Wall' -E %%{optflags} | sed -e 's# -fPIC##g' -e 's#-m64##' -e 's#-gdwarf-4##;s#-g1##;s#-g##' -e 's#-m[36][24]##' -e 's#-O[s2]#-O3#')"
%else
BuildFlags="$(rpm --target ${arch}-%{_target_os} -D '%__common_cflags_with_ssp -Wall' -E %%{optflags} | sed -e 's# -fPIC##g' -e 's#-m64##' -e 's#-gdwarf-4##;s#-g1##;s#-g##' -e 's#-flto##' -e 's#-m[36][24]##' -e 's#-O[s2]#-O3#')"
%endif
case $arch in
i[3-6]86)
%ifarch %{x86_64}
@ -1119,9 +1206,7 @@ function BuildGlibc() {
# undefined reference to __aeabi_unwind_cpp_pr0
BuildFlags="-funwind-tables -fasynchronous-unwind-tables $BuildFlags"
%endif
%if !%{with lto}
BuildFlags="$BuildFlags -fno-lto"
%endif
if [ "$arch" = 'i586' ] || [ "$arch" = 'i686' ]; then
# Work around https://sourceware.org/ml/libc-alpha/2015-10/msg00745.html
@ -1205,6 +1290,7 @@ echo CC="$BuildCC" CXX="$BuildCXX" CFLAGS="$BuildFlags -Wno-error" ARFLAGS="$ARF
--disable-profile \
--enable-static \
--disable-nss-crypt \
--disable-crypt \
$(WithSelinux) \
%if !%{with nscd}
--disable-build-nscd \
@ -1273,17 +1359,10 @@ for i in %{targets}; do
esac
mkdir -p obj-${TRIPLET}
cd obj-${TRIPLET}
%if %{with lto}
CFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-Werror[^ ]*,,g')" \
CXXFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-Werror[^ ]*,,g')" \
ASFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-Werror[^ ]*,,g')" \
LDFLAGS="$(rpm --target ${i} --eval '%%{ldflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,')" \
%else
CFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g;s,-Werror[^ ]*,,g')" \
CXXFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g;s,-Werror[^ ]*,,g')" \
ASFLAGS="$(rpm --target ${i} --eval '%%{optflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g;s,-Werror[^ ]*,,g')" \
LDFLAGS="$(rpm --target ${i} --eval '%%{ldflags} -fuse-ld=bfd -fno-strict-aliasing -Wno-error' |sed -e 's,-m[36][24],,;s,-flto,,g')" \
%endif
CC="${TRIPLET}-gcc ${CFLAGS}" \
../configure \
--prefix=%{_prefix}/${TRIPLET} \
@ -1294,7 +1373,11 @@ for i in %{targets}; do
# We set CXX to empty to prevent links-dso-program from being built
# (it may not work -- if we're using a bootstrap version of gcc,
# there's no libstdc++ or libgcc_s)
%make_build CXX="" LIBGD=no
# the " || make ..." part is a workaround for the build failing on
# aarch64 boxes with lots of cores while building the iconv converters
# for the i686 crosscompiler. This should be fixed properly at some
# point.
%make_build CXX="" LIBGD=no || make CXX="" LIBGD=no
cd ..
done
%endif
@ -1335,16 +1418,6 @@ export BIARCH_BUILDING=1
esac
%endif
%if "%{name}" == "glibc"
# post install wrapper
gcc -static -Lbuild-%{target_cpu}-linux %{optflags} -Os %{SOURCE2} -o build-%{target_cpu}-linux/glibc_post_upgrade \
'-DLIBTLS="/%{_lib}/tls/"' \
'-DGCONV_MODULES_DIR="%{_libdir}/gconv"' \
'-DLD_SO_CONF="/etc/ld.so.conf"' \
'-DICONVCONFIG="%{_sbindir}/iconvconfig"'
%endif
#-----------------------------------------------------------------------
%if "%{target_cpu}" != "i686"
@ -1384,6 +1457,10 @@ for i in %{long_targets}; do
cd ..
# We don't need all the bits and pieces with a crosscompiler
rm -rf %{buildroot}%{_prefix}/$i/bin %{buildroot}%{_prefix}/$i/sbin %{buildroot}%{_prefix}/$i/var %{buildroot}%{_prefix}/$i/share %{buildroot}%{_prefix}/$i/etc
# We need to get rid of this hardcode at some point so the sysroot can
# double as a chroot... But we probably can't do this before the FS
# changes, it breaks second stage gcc crosscompilers
# sed -i -e "s,%{_prefix}/$i,,g" %{buildroot}%{_prefix}/$i/lib/libc.so
done
%endif
@ -1437,11 +1514,6 @@ make install_root=%{buildroot} install -C build-%{target_cpu}-linux
done
%endif
%if "%{name}" == "glibc"
install -m700 build-%{target_cpu}-linux/glibc_post_upgrade -D %{buildroot}%{_sbindir}/glibc_post_upgrade
sh manpages/Script.sh
%endif
# Install extra glibc libraries
function InstallGlibc() {
local BuildDir="$1"

View file

@ -1,310 +0,0 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/time.h>
#include <dirent.h>
#include <stddef.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <elf.h>
#define LD_SO_CONF "/etc/ld.so.conf"
#define ICONVCONFIG "/usr/sbin/iconvconfig"
#define verbose_exec(failcode, path...) \
do \
{ \
char *const arr[] = { path, NULL }; \
vexec (failcode, arr); \
} while (0)
__attribute__((noinline)) void vexec (int failcode, char *const path[]);
__attribute__((noinline)) void says (const char *str);
__attribute__((noinline)) void sayn (long num);
__attribute__((noinline)) void message (char *const path[]);
__attribute__((noinline)) int check_elf (const char *name);
int
main (void)
{
struct stat statbuf;
char initpath[256];
char buffer[4096];
struct pref {
char *p;
int len;
} prefix[] = { { "libc-", 5 }, { "libm-", 5 },
{ "librt-", 6 }, { "libpthread-", 11 },
{ "librtkaio-", 10 }, { "libthread_db-", 13 } };
int i, j, fd;
off_t base;
ssize_t ret;
/* 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 would be preferred by the dynamic linker
during the execution of subsequent RPM scriptlets, likely
resulting in process startup failures. */
const char *remove_dirs[] =
{
#if defined (__i386__)
"/lib/i686",
"/lib/i686/nosegneg",
#elif defined (__powerpc64__) && _CALL_ELF != 2
"/lib64/power6",
#endif
};
for (j = 0; j < sizeof (remove_dirs) / sizeof (remove_dirs[0]); ++j)
{
size_t rmlen = strlen (remove_dirs[j]);
fd = open (remove_dirs[j], O_RDONLY);
if (fd >= 0
&& (ret = getdirentries (fd, buffer, sizeof (buffer), &base))
>= (ssize_t) offsetof (struct dirent, d_name))
{
for (base = 0; base + offsetof (struct dirent, d_name) < ret; )
{
struct dirent *d = (struct dirent *) (buffer + base);
for (i = 0; i < sizeof (prefix) / sizeof (prefix[0]); i++)
if (! strncmp (d->d_name, prefix[i].p, prefix[i].len))
{
char *p = d->d_name + prefix[i].len;
while (*p == '.' || (*p >= '0' && *p <= '9')) p++;
if (p[0] == 's' && p[1] == 'o' && p[2] == '\0'
&& p + 3 - d->d_name
< sizeof (initpath) - rmlen - 1)
{
memcpy (initpath, remove_dirs[j], rmlen);
initpath[rmlen] = '/';
strcpy (initpath + rmlen + 1, d->d_name);
unlink (initpath);
break;
}
}
base += d->d_reclen;
}
close (fd);
}
}
int ldsocfd = open (LD_SO_CONF, O_RDONLY);
struct stat ldsocst;
if (ldsocfd >= 0 && fstat (ldsocfd, &ldsocst) >= 0)
{
char p[ldsocst.st_size + 1];
if (read (ldsocfd, p, ldsocst.st_size) == ldsocst.st_size)
{
p[ldsocst.st_size] = '\0';
if (strstr (p, "include ld.so.conf.d/*.conf") == NULL)
{
close (ldsocfd);
ldsocfd = open (LD_SO_CONF, O_WRONLY | O_TRUNC);
if (ldsocfd >= 0)
{
size_t slen = strlen ("include ld.so.conf.d/*.conf\n");
if (write (ldsocfd, "include ld.so.conf.d/*.conf\n", slen)
!= slen
|| write (ldsocfd, p, ldsocst.st_size) != ldsocst.st_size)
_exit (109);
}
}
}
if (ldsocfd >= 0)
close (ldsocfd);
}
/* If installing bi-arch glibc, rpm sometimes doesn't unpack all files
before running one of the lib's %post scriptlet. /sbin/ldconfig will
then be run by the other arch's %post. */
if (! access ("/sbin/ldconfig", X_OK))
verbose_exec (110, "/sbin/ldconfig", "/sbin/ldconfig", "-X");
if (! utimes (GCONV_MODULES_DIR "/gconv-modules.cache", NULL))
{
char *iconv_cache = GCONV_MODULES_DIR"/gconv-modules.cache";
char *iconv_dir = GCONV_MODULES_DIR;
verbose_exec (113, ICONVCONFIG, "/usr/sbin/iconvconfig",
"-o", iconv_cache,
"--nostdlib", iconv_dir);
}
/* Check if systemctl is available for further systemd deamon restart*/
if (access ("/bin/systemctl", X_OK))
_exit (0);
/* Check if we are not inside of some chroot, because we'd just
timeout and leave /etc/initrunlvl.
On more modern systems this test is not sufficient to detect
if we're in a chroot. */
if (readlink ("/proc/1/exe", initpath, 256) <= 0 ||
readlink ("/proc/1/root", initpath, 256) <= 0)
_exit (0);
/* Here's another well known way to detect chroot, at least on an
ext and xfs filesystems and assuming nothing mounted on the chroot's
root.
# (tpg) Possible 2017 solutions
# 1. check if inode for "/" is in 0 between 4096 range,
# as this may get into account almost all firesystems?
# 2. check if /proc/1/cgroup output does contain word docker or lxc
#
if (stat ("/", &statbuf) != 0
|| (statbuf.st_ino != 2
&& statbuf.st_ino != 128))
_exit (0); */
if (check_elf ("/proc/1/exe"))
verbose_exec (116, "/bin/systemctl", "/bin/systemctl", "daemon-reexec");
/* Check if we can safely condrestart sshd. */
if (access ("/bin/systemctl", X_OK) == 0
&& access ("/usr/sbin/sshd", X_OK) == 0
&& access ("/bin/sh", F_OK) == 0)
{
if (check_elf ("/usr/sbin/sshd"))
verbose_exec (-121, "/bin/systemctl", "/bin/systemctl", "-q", "try-restart", "sshd.service");
}
_exit(0);
}
void
vexec (int failcode, char *const path[])
{
pid_t pid;
int status, save_errno;
int devnull = 0;
if (failcode < 0)
{
devnull = 1;
failcode = -failcode;
}
pid = vfork ();
if (pid == 0)
{
int fd;
if (devnull && (fd = open ("/dev/null", O_WRONLY)) >= 0)
{
dup2 (fd, 1);
dup2 (fd, 2);
close (fd);
}
execv (path[0], path + 1);
save_errno = errno;
message (path);
says (" exec failed with errno ");
sayn (save_errno);
says ("\n");
_exit (failcode);
}
else if (pid < 0)
{
save_errno = errno;
message (path);
says (" fork failed with errno ");
sayn (save_errno);
says ("\n");
_exit (failcode + 1);
}
if (waitpid (0, &status, 0) != pid || !WIFEXITED (status))
{
message (path);
says (" child terminated abnormally\n");
_exit (failcode + 2);
}
if (WEXITSTATUS (status))
{
message (path);
says (" child exited with exit code ");
sayn (WEXITSTATUS (status));
says ("\n");
_exit (WEXITSTATUS (status));
}
}
void
says (const char *str)
{
write (1, str, strlen (str));
}
void
sayn (long num)
{
char string[sizeof (long) * 3 + 1];
char *p = string + sizeof (string) - 1;
*p = '\0';
if (num == 0)
*--p = '0';
else
while (num)
{
*--p = '0' + num % 10;
num = num / 10;
}
says (p);
}
void
message (char *const path[])
{
says ("/usr/sbin/glibc_post_upgrade: While trying to execute ");
says (path[0]);
}
int
check_elf (const char *name)
{
/* Play safe, if we can't open or read, assume it might be
ELF for the current arch. */
int ret = 1;
int fd = open (name, O_RDONLY);
if (fd >= 0)
{
Elf32_Ehdr ehdr;
if (read (fd, &ehdr, offsetof (Elf32_Ehdr, e_version))
== offsetof (Elf32_Ehdr, e_version))
{
ret = 0;
if (ehdr.e_ident[EI_CLASS]
== (sizeof (long) == 8 ? ELFCLASS64 : ELFCLASS32))
{
#if defined __i386__
ret = ehdr.e_machine == EM_386;
#elif defined __x86_64__
ret = ehdr.e_machine == EM_X86_64;
#elif defined __powerpc64__
ret = ehdr.e_machine == EM_PPC64;
#elif defined __powerpc__
ret = ehdr.e_machine == EM_PPC;
#elif defined __s390__ || defined __s390x__
ret = ehdr.e_machine == EM_S390;
#elif defined __x86_64__
ret = ehdr.e_machine == EM_X86_64;
#elif defined __sparc__
if (sizeof (long) == 8)
ret = ehdr.e_machine == EM_SPARCV9;
else
ret = (ehdr.e_machine == EM_SPARC
|| ehdr.e_machine == EM_SPARC32PLUS);
#else
ret = 1;
#endif
}
}
close (fd);
}
return ret;
}

31
ldconfig-Os.patch Normal file
View file

@ -0,0 +1,31 @@
--- glibc-2.27/elf/Makefile.0092~ 2018-02-01 17:17:18.000000000 +0100
+++ glibc-2.27/elf/Makefile 2018-02-02 20:23:42.959165917 +0100
@@ -74,9 +74,9 @@ define elide-stack-protector
$(if $(filter $(@F),$(patsubst %,%$(1),$(2))), $(no-stack-protector))
endef
-CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os))
-CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
-CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
+CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os)) -Os
+CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os)) -Os
+CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines)) -Os
ifeq ($(unwind-find-fde),yes)
routines += unwind-dw2-fde-glibc
@@ -561,11 +561,11 @@ $(objpfx)ldconfig: $(ldconfig-modules:%=
SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
CFLAGS-ldconfig.c += $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
- -D'SLIBDIR="$(slibdir)"'
+ -D'SLIBDIR="$(slibdir)"' -Os
libof-ldconfig = ldconfig
-CFLAGS-dl-cache.c += $(SYSCONF-FLAGS)
-CFLAGS-cache.c += $(SYSCONF-FLAGS)
-CFLAGS-rtld.c += $(SYSCONF-FLAGS)
+CFLAGS-dl-cache.c += $(SYSCONF-FLAGS) -Os
+CFLAGS-cache.c += $(SYSCONF-FLAGS) -Os
+CFLAGS-rtld.c += $(SYSCONF-FLAGS) -Os
cpp-srcs-left := $(all-rtld-routines:=.os)
lib := rtld

View file

@ -1,14 +0,0 @@
Subject: Make ldconfig default to "new" cache format.
Index: glibc-2.21/elf/ldconfig.c
===================================================================
--- glibc-2.21.orig/elf/ldconfig.c 2015-03-03 14:53:52.206995018 +0000
+++ glibc-2.21/elf/ldconfig.c 2015-03-03 14:54:00.094995204 +0000
@@ -95,7 +95,7 @@
/* Format to support. */
/* 0: only libc5/glibc2; 1: both; 2: only glibc 2.2. */
-int opt_format = 1;
+int opt_format = 2;
/* Build cache. */
static int opt_build_cache = 1;

View file

@ -0,0 +1,11 @@
--- libc/nptl/nptl-init.c.bero~ 2012-12-01 23:55:26.722754391 +0100
+++ libc/nptl/nptl-init.c 2012-12-01 23:55:42.725950817 +0100
@@ -414,7 +414,7 @@ __pthread_initialize_minimal_internal (v
/* Determine the default allowed stack size. This is the size used
in case the user does not specify one. */
struct rlimit limit;
- if (__getrlimit (RLIMIT_STACK, &limit) != 0
+ if (getrlimit (RLIMIT_STACK, &limit) != 0
|| limit.rlim_cur == RLIM_INFINITY)
/* The system limit is not usable. Use an architecture-specific
default. */

View file

@ -46,10 +46,7 @@ passwd: files systemd
shadow: files systemd
group: files systemd
# If you want to give systemd-resolved a try (and don't mind it
# changing your hostname while X is running...), add
# resolve [!UNAVAIL=return] after files.
hosts: files dns myhostname nis wins mdns4_minimal
hosts: files resolve [!UNAVAIL=return] dns myhostname nis wins mdns4_minimal
networks: files
services: files