Auto-sync with upstream branch master

Upstream commit: dd45734e322a03287d34d8af9b7da7b35cfddb8e

- nptl: Add glibc.pthread.stack_cache_size tunable
- nptl: Export libthread_db-used symbols under GLIBC_PRIVATE
- nptl: Rename nptl_version to __nptl_version
- nptl_db: Clean up main/rtld variable handling
- arm: align stack in clone [BZ 28020]
- Linux: Cleanups after librt move
- Linux: Move timer_settime, __timer_settime64 from librt to libc
- Linux: Move timer_gettime, __timer_gettime64 from librt to libc
- Linux: Move timer_getoverrun from librt to libc
- Linux: Move timer_create, timer_delete from librt to libc
- Linux: Define TIMER_T_WAS_INT_COMPAT in kernel-posix-timers.h
- Install shared objects under their ABI names
- elf: Generalize name-based DSO recognition in ldconfig
- Makerules: Remove lib-version, $(subdir-version)
- nptl_db: Install libthread_db under a regular implementation name
- iconvconfig: Fix multiple issues
- wordexp: handle overflow in positional parameter number (bug 28011)
- Update math: redirect roundeven function
- Use GCC builtins for roundeven functions if desired.
- x86_64: roundeven with sse4.1 support
- math: redirect roundeven function
This commit is contained in:
Florian Weimer 2021-06-28 19:45:06 +02:00
parent d3fad65ba1
commit 21ebc4cbaa
10 changed files with 104 additions and 808 deletions

View File

@ -1,107 +0,0 @@
Emergency patch from libc-alpha.
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Subject: [PATCH v2] iconvconfig: Fix multiple issues
To: libc-alpha@sourceware.org
Cc: schwab@linux-m68k.org, fweimer@redhat.com
Date: Fri, 25 Jun 2021 14:31:28 +0530
Message-Id: <20210625090128.316837-1-siddhesh@sourceware.org>
It was noticed on big-endian systems that msgfmt would fail with the
following error:
msgfmt: gconv_builtin.c:70: __gconv_get_builtin_trans: Assertion `cnt < sizeof (map) / sizeof (map[0])' failed.
Aborted (core dumped)
This is only seen on installed systems because it was due to a
corrupted gconv-modules.cache. iconvconfig had the following issues
(it was specifically freeing fulldir that caused this issue, but other
cleanups are also needed) that this patch fixes.
- Add prefix only if dir starts with '/'
- Use asprintf instead of mempcpy so that the directory string is NULL
terminated
- Make a copy of the directory reference in new_module so that fulldir
can be freed within the same scope in handle_dir.
---
iconv/Makefile | 2 +-
iconv/iconvconfig.c | 24 +++++++++---------------
2 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/iconv/Makefile b/iconv/Makefile
index a9b267c851..07d77c9eca 100644
--- a/iconv/Makefile
+++ b/iconv/Makefile
@@ -33,7 +33,7 @@ vpath %.c ../locale/programs ../intl
iconv_prog-modules = iconv_charmap charmap charmap-dir linereader \
dummy-repertoire simple-hash xstrdup xmalloc \
record-status
-iconvconfig-modules = strtab xmalloc hash-string
+iconvconfig-modules = strtab xmalloc xasprintf xstrdup hash-string
extra-objs = $(iconv_prog-modules:=.o) $(iconvconfig-modules:=.o)
CFLAGS-iconv_prog.c += -I../locale/programs
CFLAGS-iconv_charmap.c += -I../locale/programs
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
index e69334d71c..783b2bbdbb 100644
--- a/iconv/iconvconfig.c
+++ b/iconv/iconvconfig.c
@@ -250,6 +250,7 @@ static const char gconv_module_ext[] = MODULE_EXT;
#include <programs/xmalloc.h>
+#include <programs/xasprintf.h>
/* C string table handling. */
@@ -519,11 +520,12 @@ module_compare (const void *p1, const void *p2)
/* Create new module record. */
static void
new_module (const char *fromname, size_t fromlen, const char *toname,
- size_t tolen, const char *directory,
+ size_t tolen, const char *dir_in,
const char *filename, size_t filelen, int cost, size_t need_ext)
{
struct module *new_module;
- size_t dirlen = strlen (directory) + 1;
+ size_t dirlen = strlen (dir_in) + 1;
+ const char *directory = xstrdup (dir_in);
char *tmp;
void **inserted;
@@ -654,20 +656,10 @@ handle_dir (const char *dir)
size_t dirlen = strlen (dir);
bool found = false;
- /* Add the prefix before sending it off to the parser. */
- char *fulldir = xmalloc (prefix_len + dirlen + 2);
- char *cp = mempcpy (mempcpy (fulldir, prefix, prefix_len), dir, dirlen);
+ char *fulldir = xasprintf ("%s%s%s", dir[0] == '/' ? prefix : "",
+ dir, dir[dirlen - 1] != '/' ? "/" : "");
- if (dir[dirlen - 1] != '/')
- {
- *cp++ = '/';
- *cp = '\0';
- dirlen++;
- }
-
- found = gconv_parseconfdir (fulldir, dirlen + prefix_len);
-
- free (fulldir);
+ found = gconv_parseconfdir (fulldir, strlen (fulldir));
if (!found)
{
@@ -679,6 +671,8 @@ handle_dir (const char *dir)
"configuration files with names ending in .conf.");
}
+ free (fulldir);
+
return found ? 0 : 1;
}
--
2.31.1

View File

@ -1,62 +0,0 @@
Upstream submission:
<https://sourceware.org/pipermail/libc-alpha/2021-June/128163.html>
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Jun 28 10:05:44 2021 +0200
nptl_db: Clean up main/rtld variable handling
Most symbols are now in libc.so.6. The "main" (exempted from
coverage checks) status is therefore not necessary. Use
DB_MAIN_VARIABLE for the remaining separate symbol,
__nptl_initial_report_events. DB_RTLD_VARIABLE is now unused, so
remove it.
diff --git a/nptl_db/db-symbols.awk b/nptl_db/db-symbols.awk
index 6f326cf379fc886b..ef1d91b167998d3d 100644
--- a/nptl_db/db-symbols.awk
+++ b/nptl_db/db-symbols.awk
@@ -2,7 +2,6 @@
# we've just built. It checks for all the symbols used in td_symbol_list.
BEGIN {
-%define DB_RTLD_VARIABLE(name) /* Nothing. */
%define DB_MAIN_VARIABLE(name) /* Nothing. */
%define DB_MAIN_SYMBOL(name) /* Nothing. */
%define DB_MAIN_ARRAY_VARIABLE(name) /* Nothing. */
diff --git a/nptl_db/structs.def b/nptl_db/structs.def
index 6a726f207eca49a3..fb7bb9367d7c01ec 100644
--- a/nptl_db/structs.def
+++ b/nptl_db/structs.def
@@ -22,10 +22,6 @@
# define STRUCTS_DEF_DEFAULTS 1
#endif
-#ifndef DB_RTLD_VARIABLE
-# define DB_RTLD_VARIABLE(name) DB_VARIABLE (name)
-#endif
-
/* DB_MAIN_VARIABLE, DB_MAIN_SYMBOL, DB_MAIN_ARRAY_VARIABLE are not
covered by the libc symbol check in db-symbols.awk. */
#ifndef DB_MAIN_VARIABLE
@@ -78,14 +74,14 @@ DB_STRUCT_FIELD (td_eventbuf_t, eventnum)
DB_STRUCT_FIELD (td_eventbuf_t, eventdata)
DB_SYMBOL (nptl_version)
-DB_MAIN_SYMBOL (__nptl_create_event)
-DB_MAIN_SYMBOL (__nptl_death_event)
+DB_SYMBOL (__nptl_create_event)
+DB_SYMBOL (__nptl_death_event)
DB_SYMBOL (__nptl_threads_events)
-DB_MAIN_VARIABLE (__nptl_nthreads)
+DB_VARIABLE (__nptl_nthreads)
DB_VARIABLE (__nptl_last_event)
-DB_RTLD_VARIABLE (__nptl_initial_report_events)
+DB_MAIN_VARIABLE (__nptl_initial_report_events)
-DB_MAIN_ARRAY_VARIABLE (__pthread_keys)
+DB_ARRAY_VARIABLE (__pthread_keys)
DB_STRUCT (pthread_key_struct)
DB_STRUCT_FIELD (pthread_key_struct, seq)
DB_STRUCT_FIELD (pthread_key_struct, destr)

View File

@ -1,37 +0,0 @@
Upstream submission:
<https://sourceware.org/pipermail/libc-alpha/2021-June/128163.html>
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Jun 28 10:25:21 2021 +0200
nptl: Rename nptl_version to __nptl_version
This prepares it for exporting as a dynamic symbol.
diff --git a/nptl_db/structs.def b/nptl_db/structs.def
index fb7bb9367d7c01ec..248ecf43358dd7ae 100644
--- a/nptl_db/structs.def
+++ b/nptl_db/structs.def
@@ -73,7 +73,7 @@ DB_STRUCT (td_eventbuf_t)
DB_STRUCT_FIELD (td_eventbuf_t, eventnum)
DB_STRUCT_FIELD (td_eventbuf_t, eventdata)
-DB_SYMBOL (nptl_version)
+DB_SYMBOL (__nptl_version)
DB_SYMBOL (__nptl_create_event)
DB_SYMBOL (__nptl_death_event)
DB_SYMBOL (__nptl_threads_events)
diff --git a/nptl_db/td_ta_new.c b/nptl_db/td_ta_new.c
index 501d922ea269f703..eeca29d5a0f7be9f 100644
--- a/nptl_db/td_ta_new.c
+++ b/nptl_db/td_ta_new.c
@@ -39,7 +39,7 @@ td_ta_new (struct ps_prochandle *ps, td_thragent_t **ta)
LOG ("td_ta_new");
/* Check whether the versions match. */
- if (td_lookup (ps, SYM_nptl_version, &versaddr) != PS_OK)
+ if (td_lookup (ps, SYM___nptl_version, &versaddr) != PS_OK)
return TD_NOLIBTHREAD;
if (ps_pdread (ps, versaddr, versbuf, sizeof (versbuf)) != PS_OK)
return TD_ERR;

View File

@ -1,194 +0,0 @@
Upstream submission:
<https://sourceware.org/pipermail/libc-alpha/2021-June/128163.html>
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Jun 28 10:24:33 2021 +0200
nptl: Export libthread_db-used symbols under GLIBC_PRIVATE
This allows distributions to strip debugging information from
libc.so.6 without impacting the debugging experience.
The commit also enhances the checks in nptl/db-symbols.awk to cover
both the _thread_db_* descriptor symbols and the actual symbols
themselves.
diff --git a/nptl/Versions b/nptl/Versions
index e4fae73c0b9fae0c..060d8d5dec2be29c 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -403,10 +403,14 @@ libc {
__nptl_deallocate_tsd;
__nptl_death_event;
__nptl_free_tcb;
+ __nptl_last_event;
__nptl_nthreads;
+ __nptl_rtld_global;
__nptl_setxid_sighandler;
__nptl_stack_list_add;
__nptl_stack_list_del;
+ __nptl_threads_events;
+ __nptl_version;
__pthread_attr_copy;
__pthread_attr_destroy;
__pthread_attr_init;
@@ -430,6 +434,60 @@ libc {
__pthread_unwind;
__sched_fifo_max_prio;
__sched_fifo_min_prio;
+ _thread_db___nptl_last_event;
+ _thread_db___nptl_nthreads;
+ _thread_db___nptl_rtld_global;
+ _thread_db___pthread_keys;
+ _thread_db_const_thread_area;
+ _thread_db_dtv_dtv;
+ _thread_db_dtv_slotinfo_gen;
+ _thread_db_dtv_slotinfo_list_len;
+ _thread_db_dtv_slotinfo_list_next;
+ _thread_db_dtv_slotinfo_list_slotinfo;
+ _thread_db_dtv_slotinfo_map;
+ _thread_db_dtv_t_counter;
+ _thread_db_dtv_t_pointer_val;
+ _thread_db_link_map_l_tls_modid;
+ _thread_db_link_map_l_tls_offset;
+ _thread_db_list_t_next;
+ _thread_db_list_t_prev;
+ _thread_db_pthread_cancelhandling;
+ _thread_db_pthread_dtvp;
+ _thread_db_pthread_eventbuf;
+ _thread_db_pthread_eventbuf_eventmask;
+ _thread_db_pthread_eventbuf_eventmask_event_bits;
+ _thread_db_pthread_key_data_data;
+ _thread_db_pthread_key_data_level2_data;
+ _thread_db_pthread_key_data_seq;
+ _thread_db_pthread_key_struct_destr;
+ _thread_db_pthread_key_struct_seq;
+ _thread_db_pthread_list;
+ _thread_db_pthread_nextevent;
+ _thread_db_pthread_report_events;
+ _thread_db_pthread_schedparam_sched_priority;
+ _thread_db_pthread_schedpolicy;
+ _thread_db_pthread_specific;
+ _thread_db_pthread_start_routine;
+ _thread_db_pthread_tid;
+ _thread_db_register32;
+ _thread_db_register32_thread_area;
+ _thread_db_register64;
+ _thread_db_register64_thread_area;
+ _thread_db_rtld_global__dl_stack_used;
+ _thread_db_rtld_global__dl_stack_user;
+ _thread_db_rtld_global__dl_tls_dtv_slotinfo_list;
+ _thread_db_sizeof_dtv_slotinfo;
+ _thread_db_sizeof_dtv_slotinfo_list;
+ _thread_db_sizeof_list_t;
+ _thread_db_sizeof_pthread;
+ _thread_db_sizeof_pthread_key_data;
+ _thread_db_sizeof_pthread_key_data_level2;
+ _thread_db_sizeof_pthread_key_struct;
+ _thread_db_sizeof_td_eventbuf_t;
+ _thread_db_sizeof_td_thr_events_t;
+ _thread_db_td_eventbuf_t_eventdata;
+ _thread_db_td_eventbuf_t_eventnum;
+ _thread_db_td_thr_events_t_event_bits;
}
}
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 3f017f1e26c0d107..d1b6817a81b21ef1 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -43,21 +43,24 @@
/* Globally enabled events. */
-static td_thr_events_t __nptl_threads_events __attribute_used__;
+td_thr_events_t __nptl_threads_events __attribute__ ((nocommon));
+libc_hidden_proto (__nptl_threads_events)
+libc_hidden_data_def (__nptl_threads_events)
/* Pointer to descriptor with the last event. */
-static struct pthread *__nptl_last_event __attribute_used__;
+struct pthread *__nptl_last_event __attribute__ ((nocommon));
+libc_hidden_proto (__nptl_last_event)
+libc_hidden_data_def (__nptl_last_event)
#ifdef SHARED
/* This variable is used to access _rtld_global from libthread_db. If
GDB loads libpthread before ld.so, it is not possible to resolve
_rtld_global directly during libpthread initialization. */
-static struct rtld_global *__nptl_rtld_global __attribute_used__
- = &_rtld_global;
+struct rtld_global *__nptl_rtld_global = &_rtld_global;
#endif
/* Version of the library, used in libthread_db to detect mismatches. */
-static const char nptl_version[] __attribute_used__ = VERSION;
+const char __nptl_version[] = VERSION;
/* This performs the initialization necessary when going from
single-threaded to multi-threaded mode for the first time. */
diff --git a/nptl_db/Makefile b/nptl_db/Makefile
index 1f79c018a1f9fe19..c04aa6140acff337 100644
--- a/nptl_db/Makefile
+++ b/nptl_db/Makefile
@@ -55,7 +55,7 @@ include ../Rules
$(objpfx)db-symbols.out: $(objpfx)db-symbols.v.i \
$(common-objpfx)libc.so
- LC_ALL=C $(READELF) -W -s $(filter %.so,$^) | $(AWK) -f $< > $@; \
+ LC_ALL=C $(READELF) -W -D -s $(filter %.so,$^) | $(AWK) -f $< > $@; \
$(evaluate-test)
$(objpfx)db-symbols.v.i: db-symbols.awk
diff --git a/nptl_db/db-symbols.awk b/nptl_db/db-symbols.awk
index ef1d91b167998d3d..a9289b4686a02dd2 100644
--- a/nptl_db/db-symbols.awk
+++ b/nptl_db/db-symbols.awk
@@ -1,7 +1,8 @@
-# This script processes the output of 'readelf -W -s' on the libpthread.so
+# This script processes the output of 'readelf -W -D -s' on the libc.so
# we've just built. It checks for all the symbols used in td_symbol_list.
BEGIN {
+# This processes the _thread_db_* names.
%define DB_MAIN_VARIABLE(name) /* Nothing. */
%define DB_MAIN_SYMBOL(name) /* Nothing. */
%define DB_MAIN_ARRAY_VARIABLE(name) /* Nothing. */
@@ -9,10 +10,19 @@ BEGIN {
%define DB_LOOKUP_NAME_TH_UNIQUE(idx, name) th_unique[STRINGIFY (name)] = 1;
%include "db-symbols.h"
+# And this processes the symbol names themselves.
+%define DB_STRUCT(...) /* Nothing. */
+%define DB_STRUCT_FIELD(...) /* Nothing. */
+%define DB_STRUCT_FLEXIBLE_ARRAY(...) /* Nothing. */
+%define DB_SYMBOL(name) required[STRINGIFY (name)] = 1;
+%define DB_FUNCTION(name) required[STRINGIFY (name)] = 1;
+%define DB_VARIABLE(name) required[STRINGIFY (name)] = 1;
+%include "structs.def"
+
in_symtab = 0;
}
-/Symbol table '.symtab'/ { in_symtab=1; next }
+/Symbol table for image/ { in_symtab=1; next }
NF == 0 { in_symtab=0; next }
!in_symtab { next }
@@ -23,6 +33,7 @@ END {
status = 0;
for (s in required) {
+ s = s "@@GLIBC_PRIVATE"
if (s in seen) print s, "ok";
else {
status = 1;
@@ -32,6 +43,7 @@ END {
any = "";
for (s in th_unique) {
+ s = s "@@GLIBC_PRIVATE"
if (s in seen) {
any = s;
break;

View File

@ -1,31 +0,0 @@
Patch series proposed upstream:
<https://sourceware.org/pipermail/libc-alpha/2021-June/127473.html>
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Jun 9 14:12:46 2021 +0200
nptl_db: Install libthread_db under a regular implementation name
Currently, the name is always libthread_db-1.0.so. It does not change
with the glibc version, like the other libraries.
GDB hard-codes libthread_db.so.1 (the soname), so this change does not
affect loading libthread_db.
Tested on x86_64-linux-gnu, in an environment where the nptl GDB tests
actually run.
diff --git a/nptl_db/Makefile b/nptl_db/Makefile
index ea721c1dcfce6e7b..1f79c018a1f9fe19 100644
--- a/nptl_db/Makefile
+++ b/nptl_db/Makefile
@@ -21,8 +21,6 @@ subdir := nptl_db
include ../Makeconfig
-nptl_db-version = 1.0
-
extra-libs = libthread_db
extra-libs-others := $(extra-libs)

View File

@ -1,78 +0,0 @@
Patch series proposed upstream:
<https://sourceware.org/pipermail/libc-alpha/2021-June/127473.html>
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Jun 9 14:12:46 2021 +0200
Makerules: Remove lib-version, $(subdir-version)
Also clarify that the “versioned” term refers to the soname, not the glibc
version (which also ends up in the installed file name).
I verified on x86_64-linux-gnu that “make install” produces the same
files.
diff --git a/Makerules b/Makerules
index ca9885436e15784b..d3f29d0b8991efc7 100644
--- a/Makerules
+++ b/Makerules
@@ -982,22 +982,21 @@ install-lib.so := $(filter %.so,$(install-lib:%_pic.a=%.so))
install-lib := $(filter-out %.so %_pic.a,$(install-lib))
ifeq (yes,$(build-shared))
-# Find which .so's have versions.
+# Find which .so's have a version number in their soname.
versioned := $(strip $(foreach so,$(install-lib.so),\
$(patsubst %,$(so),$($(so)-version))))
install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
-# For versioned libraries, we install three files:
+# For libraries whose soname have version numbers, we install three files:
# $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
# $(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file
-lib-version := $(firstword $($(subdir)-version) $(version))
install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
$(foreach L,$(install-lib.so-versioned),\
$(inst_libdir)/$L \
- $(inst_slibdir)/$(L:.so=)-$(lib-version).so \
+ $(inst_slibdir)/$(L:.so=)-$(version).so \
$(inst_slibdir)/$L$($L-version))
# Install all the unversioned shared libraries.
@@ -1125,7 +1124,6 @@ include $(o-iterator)
generated += $(foreach o,$(versioned),$o$($o-version))
-ifeq (,$($(subdir)-version))
define o-iterator-doit
$(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \
$(+force);
@@ -1140,23 +1138,7 @@ $(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);
endef
object-suffixes-left := $(versioned)
include $(o-iterator)
-else
-define o-iterator-doit
-$(inst_slibdir)/$o$($o-version): \
- $(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so $(+force);
- $$(make-shlib-link)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-
-define o-iterator-doit
-$(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o $(+force);
- $$(do-install-program)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-endif
-endif
+endif # ifneq (,$(versioned))
define do-install-so
$(do-install-program)

View File

@ -1,131 +0,0 @@
Patch series proposed upstream:
<https://sourceware.org/pipermail/libc-alpha/2021-June/127473.html>
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Jun 9 14:12:46 2021 +0200
elf: Generalize name-based DSO recognition in ldconfig
This introduces <dl-is_dso.h> and the _dl_is_dso function. A
test ensures that the official names of libc.so, ld.so, and their
versioned names are recognized.
diff --git a/elf/Makefile b/elf/Makefile
index 38d08e03b8979a81..62f7e8a22544ab9d 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -223,7 +223,8 @@ tests += restest1 preloadtest loadfail multiload origtest resolvfail \
tst-single_threaded tst-single_threaded-pthread \
tst-tls-ie tst-tls-ie-dlmopen argv0test \
tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \
- tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dlmopen-gethostbyname
+ tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dlmopen-gethostbyname \
+ tst-dl-is_dso
# reldep9
tests-internal += loadtest unload unload2 circleload1 \
neededtest neededtest2 neededtest3 neededtest4 \
diff --git a/elf/dl-is_dso.h b/elf/dl-is_dso.h
new file mode 100644
index 0000000000000000..94e00966a16e0df5
--- /dev/null
+++ b/elf/dl-is_dso.h
@@ -0,0 +1,33 @@
+/* Heuristic for recognizing DSO file names.
+ Copyright (C) 2021 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdbool.h>
+#include <string.h>
+
+/* Returns true if the file name looks like a DSO name. */
+static bool
+_dl_is_dso (const char *name)
+{
+ /* Recognize lib*.so*, ld-*.so*, ld.so.*, ld64.so.*. ld-*.so*
+ matches both platform dynamic linker names like ld-linux.so.2,
+ and versioned dynamic loader names like ld-2.12.so. */
+ return (((strncmp (name, "lib", 3) == 0 || strncmp (name, "ld-", 3) == 0)
+ && strstr (name, ".so") != NULL)
+ || strncmp (name, "ld.so.", 6) == 0
+ || strncmp (name, "ld64.so.", 8) == 0);
+}
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 96bf7700b2efd37a..1037e8d0cf8d28b6 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -43,6 +43,7 @@
#include <ldconfig.h>
#include <dl-cache.h>
#include <dl-hwcaps.h>
+#include <dl-is_dso.h>
#include <dl-procinfo.h>
@@ -842,9 +843,7 @@ search_dir (const struct dir_entry *entry)
subdirectory (if not already processing a glibc-hwcaps
subdirectory)? The dynamic linker is also considered as
shared library. */
- if (((strncmp (direntry->d_name, "lib", 3) != 0
- && strncmp (direntry->d_name, "ld-", 3) != 0)
- || strstr (direntry->d_name, ".so") == NULL)
+ if (!_dl_is_dso (direntry->d_name)
&& (direntry->d_type == DT_REG
|| (entry->hwcaps == NULL
&& !is_hwcap_platform (direntry->d_name))))
diff --git a/elf/tst-dl-is_dso.c b/elf/tst-dl-is_dso.c
new file mode 100644
index 0000000000000000..48d2cc9fbe9edbc6
--- /dev/null
+++ b/elf/tst-dl-is_dso.c
@@ -0,0 +1,35 @@
+/* Test heuristic for recognizing DSO file names.
+ Copyright (C) 2021 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <dl-is_dso.h>
+#include <gnu/lib-names.h>
+#include <support/check.h>
+
+static int
+do_test (void)
+{
+ /* Official ABI names. */
+ TEST_VERIFY (_dl_is_dso (LIBC_SO));
+ TEST_VERIFY (_dl_is_dso (LD_SO));
+ /* Version-based names. The version number does not matter. */
+ TEST_VERIFY (_dl_is_dso ("libc-2.12.so"));
+ TEST_VERIFY (_dl_is_dso ("ld-2.12.so"));
+ return 0;
+}
+
+#include <support/test-driver.c>

View File

@ -1,158 +0,0 @@
Patch series proposed upstream:
<https://sourceware.org/pipermail/libc-alpha/2021-June/127473.html>
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Jun 9 14:12:46 2021 +0200
Install shared objects under their ABI names
Previously, the installed objects were named like libc-2.33.so,
and the ABI soname libc.so.6 was just a symbolic link.
The Makefile targets to install these symbolic links are no longer
needed after this, so they are removed with this commit. The more
general $(make-link) command (which invokes scripts/rellns-sh) is
retained because other symbolic links are still needed.
diff --git a/INSTALL b/INSTALL
index 56ed01d4386ad8b7..7f054f422d990d8a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -199,6 +199,16 @@ if 'CFLAGS' is specified it must enable optimization. For example:
RELRO and a read-only global offset table (GOT), at the cost of
slightly increased program load times.
+'--disable-major-minor-libraries'
+ Do not install shared objects under file names that contain the
+ major and minor version of the GNU C Library. By default, such
+ names are used, and the names defined by the ABI are provided as
+ symbolic links only. This causes problems with certain package
+ managers during library upgrades and (in particular) downgrades, so
+ this option can be used to install these shared objects directly
+ under their ABI-defined names, without an additional indirection
+ via symbolic links.
+
'--enable-pt_chown'
The file 'pt_chown' is a helper binary for 'grantpt' (*note
Pseudo-Terminals: Allocation.) that is installed setuid root to fix
diff --git a/Makefile b/Makefile
index 242d36de914c516f..c115c652a0b8c1ce 100644
--- a/Makefile
+++ b/Makefile
@@ -109,12 +109,6 @@ elf/ldso_install:
# Ignore the error if we cannot update /etc/ld.so.cache.
ifeq (no,$(cross-compiling))
ifeq (yes,$(build-shared))
-install: install-symbolic-link
-.PHONY: install-symbolic-link
-install-symbolic-link: subdir_install
- $(symbolic-link-prog) $(symbolic-link-list)
- rm -f $(symbolic-link-list)
-
install:
-test ! -x $(elf-objpfx)ldconfig || LC_ALL=C \
$(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \
diff --git a/Makerules b/Makerules
index d3f29d0b8991efc7..6efff78fbe44bdca 100644
--- a/Makerules
+++ b/Makerules
@@ -989,14 +989,12 @@ versioned := $(strip $(foreach so,$(install-lib.so),\
install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
-# For libraries whose soname have version numbers, we install three files:
+# For libraries whose soname have version numbers, we install two files:
# $(inst_libdir)/libfoo.so -- for linking, symlink or ld script
-# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME, symlink
-# $(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file
+# $(inst_slibdir)/libfoo.so.NN -- for loading by SONAME
install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
$(foreach L,$(install-lib.so-versioned),\
$(inst_libdir)/$L \
- $(inst_slibdir)/$(L:.so=)-$(version).so \
$(inst_slibdir)/$L$($L-version))
# Install all the unversioned shared libraries.
@@ -1029,35 +1027,10 @@ ln -f $(objpfx)/$(@F) $@
endef
endif
-ifeq (yes,$(build-shared))
-ifeq (no,$(cross-compiling))
-symbolic-link-prog := $(elf-objpfx)sln
-symbolic-link-list := $(elf-objpfx)symlink.list
-define make-shlib-link
-echo `$(..)scripts/rellns-sh -p $< $@` $@ >> $(symbolic-link-list)
-endef
-else # cross-compiling
-# We need a definition that can be used by elf/Makefile's install rules.
-symbolic-link-prog = $(LN_S)
-endif
-endif
-ifndef make-shlib-link
-define make-shlib-link
-rm -f $@
-$(LN_S) `$(..)scripts/rellns-sh -p $< $@` $@
-endef
-endif
-
ifdef libc.so-version
-# For a library specified to be version N, install three files:
-# libc.so -> libc.so.N (e.g. libc.so.6)
-# libc.so.6 -> libc-VERSION.so (e.g. libc-1.10.so)
-
-$(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \
- $(+force)
- $(make-shlib-link)
-$(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force)
+$(inst_slibdir)/libc.so$(libc.so-version): $(common-objpfx)libc.so $(+force)
$(do-install-program)
+
install: $(inst_slibdir)/libc.so$(libc.so-version)
# This fragment of linker script gives the OUTPUT_FORMAT statement
@@ -1125,15 +1098,7 @@ include $(o-iterator)
generated += $(foreach o,$(versioned),$o$($o-version))
define o-iterator-doit
-$(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \
- $(+force);
- $$(make-shlib-link)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-
-define o-iterator-doit
-$(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);
+$(inst_slibdir)/$o$($o-version): $(objpfx)$o $(+force);
$$(do-install-program)
endef
object-suffixes-left := $(versioned)
diff --git a/elf/Makefile b/elf/Makefile
index 1751f5ec6772eceb..02f634c19241949f 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -628,20 +628,14 @@ $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig
CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx).
ifeq (yes,$(build-shared))
-$(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
+$(inst_rtlddir)/$(rtld-installed-name): $(objpfx)ld.so $(+force)
$(make-target-directory)
$(do-install-program)
-$(inst_rtlddir)/$(rtld-installed-name): \
- $(inst_slibdir)/$(rtld-version-installed-name) \
- $(inst_slibdir)/libc-$(version).so
- $(make-target-directory)
- $(make-shlib-link)
-
# Special target called by parent to install just the dynamic linker.
.PHONY: ldso_install
ldso_install: $(inst_rtlddir)/$(rtld-installed-name)
-endif
+endif # $(build-shared)
# Workarounds for ${exec_prefix} expansion in configure variables.

View File

@ -0,0 +1,74 @@
Emergency backport of a submitted upstream patch.
From: Stefan Liebler via Libc-alpha <libc-alpha@sourceware.org>
Subject: [PATCH] s390x: Update math: redirect roundeven function
To: libc-alpha@sourceware.org
Cc: Stefan Liebler <stli@linux.ibm.com>
Date: Mon, 28 Jun 2021 13:01:07 +0200 (4 hours, 41 minutes, 28 seconds ago)
Message-Id: <20210628110107.4039211-1-stli@linux.ibm.com>
Reply-To: Stefan Liebler <stli@linux.ibm.com>
After recent commit
447954a206837b5f153869cfeeeab44631c3fac9
"math: redirect roundeven function", building on
s390x fails with:
Error: symbol `__roundevenl' is already defined
Similar to aarch64/riscv fix, this patch redirects target
specific functions for s390x:
commit 3213ed770cbc5821920d16caa93c85e92dd7b9f6
"Update math: redirect roundeven function"
---
sysdeps/s390/fpu/s_roundeven.c | 2 +-
sysdeps/s390/fpu/s_roundevenf.c | 1 +
sysdeps/s390/fpu/s_roundevenl.c | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/sysdeps/s390/fpu/s_roundeven.c b/sysdeps/s390/fpu/s_roundeven.c
index 40b07e054b..0773adfed0 100644
--- a/sysdeps/s390/fpu/s_roundeven.c
+++ b/sysdeps/s390/fpu/s_roundeven.c
@@ -18,6 +18,7 @@
<https://www.gnu.org/licenses/>. */
#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
+# define NO_MATH_REDIRECT
# include <math.h>
# include <libm-alias-double.h>
@@ -31,7 +32,6 @@ __roundeven (double x)
__asm__ ("fidbra %0,4,%1,4" : "=f" (y) : "f" (x));
return y;
}
-hidden_def (__roundeven)
libm_alias_double (__roundeven, roundeven)
#else
diff --git a/sysdeps/s390/fpu/s_roundevenf.c b/sysdeps/s390/fpu/s_roundevenf.c
index d2fbf3d2b6..289785bc4a 100644
--- a/sysdeps/s390/fpu/s_roundevenf.c
+++ b/sysdeps/s390/fpu/s_roundevenf.c
@@ -18,6 +18,7 @@
<https://www.gnu.org/licenses/>. */
#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
+# define NO_MATH_REDIRECT
# include <math.h>
# include <libm-alias-float.h>
diff --git a/sysdeps/s390/fpu/s_roundevenl.c b/sysdeps/s390/fpu/s_roundevenl.c
index 29ab7a8616..94b6459ab4 100644
--- a/sysdeps/s390/fpu/s_roundevenl.c
+++ b/sysdeps/s390/fpu/s_roundevenl.c
@@ -18,6 +18,7 @@
<https://www.gnu.org/licenses/>. */
#ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
+# define NO_MATH_REDIRECT
# include <math.h>
# include <math_private.h>
# include <libm-alias-ldouble.h>
--
2.31.1

View File

@ -1,4 +1,4 @@
%define glibcsrcdir glibc-2.33.9000-805-g2c16cb88a6
%define glibcsrcdir glibc-2.33.9000-826-gdd45734e32
%define glibcversion 2.33.9000
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
@ -111,7 +111,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 32%{?dist}
Release: 33%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -190,14 +190,7 @@ Patch23: glibc-python3.patch
Patch29: glibc-fedora-nsswitch.patch
Patch30: glibc-deprecated-selinux-makedb.patch
Patch31: glibc-deprecated-selinux-nscd.patch
Patch34: glibc-nosymlink-1.patch
Patch35: glibc-nosymlink-2.patch
Patch36: glibc-nosymlink-3.patch
Patch37: glibc-nosymlink-4.patch
Patch39: glibc-iconvconfig-corruption.patch
Patch40: glibc-libthread_db-dynsym-1.patch
Patch41: glibc-libthread_db-dynsym-2.patch
Patch42: glibc-libthread_db-dynsym-3.patch
Patch32: glibc-s390x-roundeven.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2215,6 +2208,33 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Mon Jun 28 2021 Florian Weimer <fweimer@redhat.com> - 2.33.9000-33
- Dropped patches glibc-nosymlink-*.patch, glibc-iconvconfig-corruption.patch,
glibc-libthread_db-dynsym-*.patch; applied upstream.
- Auto-sync with upstream branch master,
commit dd45734e322a03287d34d8af9b7da7b35cfddb8e:
- nptl: Add glibc.pthread.stack_cache_size tunable
- nptl: Export libthread_db-used symbols under GLIBC_PRIVATE
- nptl: Rename nptl_version to __nptl_version
- nptl_db: Clean up main/rtld variable handling
- arm: align stack in clone [BZ 28020]
- Linux: Cleanups after librt move
- Linux: Move timer_settime, __timer_settime64 from librt to libc
- Linux: Move timer_gettime, __timer_gettime64 from librt to libc
- Linux: Move timer_getoverrun from librt to libc
- Linux: Move timer_create, timer_delete from librt to libc
- Linux: Define TIMER_T_WAS_INT_COMPAT in kernel-posix-timers.h
- Install shared objects under their ABI names
- elf: Generalize name-based DSO recognition in ldconfig
- Makerules: Remove lib-version, $(subdir-version)
- nptl_db: Install libthread_db under a regular implementation name
- iconvconfig: Fix multiple issues
- wordexp: handle overflow in positional parameter number (bug 28011)
- Update math: redirect roundeven function
- Use GCC builtins for roundeven functions if desired.
- x86_64: roundeven with sse4.1 support
- math: redirect roundeven function
* Mon Jun 28 2021 Florian Weimer <fweimer@redhat.com> - 2.33.9000-32
- Switch to new version of libthread_db .dynsym patch