diff -Nru glibc-2.35/debian/changelog glibc-2.35/debian/changelog --- glibc-2.35/debian/changelog 2022-02-04 00:59:11.000000000 +0000 +++ glibc-2.35/debian/changelog 2022-03-04 02:54:17.000000000 +0000 @@ -1,3 +1,35 @@ +glibc (2.35-0ubuntu3) jammy; urgency=medium + + * debian/rules.d/build.mk: build with --with-default-link=no. + + -- Michael Hudson-Doyle Fri, 04 Mar 2022 15:54:17 +1300 + +glibc (2.35-0ubuntu2) jammy; urgency=medium + + * d/patches/arm/local-vfp-sysdeps.diff: Restore, and add another EABI + attribute to hopefully avoid upsetting current binutils. + * debian/debhelper.in/libc.preinst: drop the check for kernel release + > 255 now that glibc and preinstall script are fixed. (LP: #1962225) + * Fix "./debian/rules update-from-upstream" to replace rather than append to + git-updates.diff. + * Update d/patches/git-updates.diff: + - linux: fix accuracy of get_nprocs and get_nprocs_conf [BZ #28865] + - linux: Use socket-constants-time64.h on tst-socket-timestamp-compat + - string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755] + - x86: Fallback {str|wcs}cmp RTM in the ncmp overflow case [BZ #28896] + - x86: Test wcscmp RTM in the wcsncmp overflow case [BZ #28896] + - x86: Fix TEST_NAME to make it a string in tst-strncmp-rtm.c + - elf: Check invalid hole in PT_LOAD segments [BZ #28838] + - elf: Replace tst-audit24bmod2.so with tst-audit24bmod2 + - resolv: Fix tst-resolv tests for 2.35 ABIs and later + - localedef: Update LC_MONETARY handling (Bug 28845) + - localedata: Do not generate output if warnings were present. + - localedef: Handle symbolic links when generating locale-archive + - nptl: Fix cleanups for stack grows up [BZ# 28899] + * Remove tst-p_align3 from xfails. + + -- Michael Hudson-Doyle Fri, 04 Mar 2022 15:38:35 +1300 + glibc (2.35-0ubuntu1) jammy; urgency=medium * New upstream version. diff -Nru glibc-2.35/debian/debhelper.in/libc.preinst glibc-2.35/debian/debhelper.in/libc.preinst --- glibc-2.35/debian/debhelper.in/libc.preinst 2022-01-31 20:36:21.000000000 +0000 +++ glibc-2.35/debian/debhelper.in/libc.preinst 2022-03-04 02:51:40.000000000 +0000 @@ -98,21 +98,6 @@ system=`uname -s` if [ "$system" = "Linux" ] then - # Test to make sure z < 255, in x.y.z-n form of kernel version - # Also make sure we don't trip on x.y.zFOO-n form - kernel_rev=$(uname -r | sed 's/\([0-9]*\.\)\{1,2\}\([0-9]*\)\(.*\)/\2/') - if [ "$kernel_rev" -ge 255 ] - then - echo "ERROR: Your kernel version indicates a revision number" - echo "of 255 or greater. Glibc has a number of built in" - echo "assumptions that this revision number is less than 255." - echo "If you\'ve built your own kernel, please make sure that any" - echo "custom version numbers are appended to the upstream" - echo "kernel number with a dash or some other delimiter." - echo - exit 1 - fi - # sanity checking for the appropriate kernel on each architecture. kernel_ver=`uname -r` case ${DPKG_MAINTSCRIPT_ARCH} in diff -Nru glibc-2.35/debian/patches/arm/local-vfp-sysdeps.diff glibc-2.35/debian/patches/arm/local-vfp-sysdeps.diff --- glibc-2.35/debian/patches/arm/local-vfp-sysdeps.diff 1970-01-01 00:00:00.000000000 +0000 +++ glibc-2.35/debian/patches/arm/local-vfp-sysdeps.diff 2022-03-04 02:51:40.000000000 +0000 @@ -0,0 +1,25 @@ +Description: Work around broken compilers (like fpc) on armhf + patches/arm/local-vfp-sysdeps.diff: Force the Tag_ABI_HardFP_use + and Tag_ABI_VFP_args EABI tags when building for armhf, so compilers + only linking crti.o will generate what appear to be armhf binaries. +Author: Adam Conrad +Forwarded: no + +--- a/sysdeps/arm/sysdep.h ++++ b/sysdeps/arm/sysdep.h +@@ -134,6 +134,15 @@ + the caller. */ + .eabi_attribute 24, 1 + ++#ifdef __ARM_PCS_VFP ++/* Tag_FP_arch: Use of vfpv3-d16 instructions is permitted */ ++ .eabi_attribute 10, 4 ++/* Tag_ABI_HardFP_use: This code uses hard floating point */ ++ .eabi_attribute 27, 3 ++/* Tag_ABI_VFP_args: This code stores FP arguments in VFP registers */ ++ .eabi_attribute 28, 1 ++#endif /* __ARM_PCS_VFP */ ++ + /* The thumb2 encoding is reasonably complete. Unless suppressed, use it. */ + .syntax unified + # if defined(__thumb2__) && !defined(NO_THUMB) diff -Nru glibc-2.35/debian/patches/git-updates.diff glibc-2.35/debian/patches/git-updates.diff --- glibc-2.35/debian/patches/git-updates.diff 2022-02-04 00:59:05.000000000 +0000 +++ glibc-2.35/debian/patches/git-updates.diff 2022-03-04 02:51:40.000000000 +0000 @@ -1,10 +1,10 @@ - +GIT update of https://sourceware.org/git/glibc.git/release/2.35/master from glibc-2.35 to e30c1c73da3f220f5bf0063a1d0344f8280311e7 diff --git a/NEWS b/NEWS -index faa7ec1871..6b8db4e947 100644 +index faa7ec1871..d11e2d9d31 100644 --- a/NEWS +++ b/NEWS -@@ -4,6 +4,17 @@ See the end for copying conditions. +@@ -4,6 +4,23 @@ See the end for copying conditions. Please send GNU C library bug reports via using `glibc' in the "product" field. @@ -13,11 +13,17 @@ + +The following bugs are resolved with this release: + ++ [28838] FAIL: elf/tst-p_align3 + [28850] linux: __get_nprocs_sched reads uninitialized memory from the stack + [28853] libc: tst-spawn6 changes current foreground process group + (breaks test isolation) ++ [28857] libc: FAIL: elf/tst-audit24a + [28860] build: --enable-kernel=5.1.0 build fails because of missing + __convert_scm_timestamps ++ [28865] linux: _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN are inaccurate ++ without /sys and /proc ++ [28896] strncmp-avx2-rtm and wcsncmp-avx2-rtm fallback on non-rtm ++ variants when avoiding overflow + Version 2.35 @@ -75,6 +81,416 @@ --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] +diff --git a/elf/Makefile b/elf/Makefile +index 5bdf0a383d..b2bd03a9f6 100644 +--- a/elf/Makefile ++++ b/elf/Makefile +@@ -943,7 +943,7 @@ extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) + # filtmod1.so, tst-big-note-lib.so, tst-ro-dynamic-mod.so have special + # rules. + modules-names-nobuild := filtmod1 tst-big-note-lib tst-ro-dynamic-mod \ +- tst-audit24bmod1 tst-audit24bmod2.so ++ tst-audit24bmod1 tst-audit24bmod2 + + tests += $(tests-static) + +@@ -2210,7 +2210,7 @@ $(objpfx)tst-audit24c.out: $(objpfx)tst-auditmod24c.so + $(objpfx)tst-audit24c: $(objpfx)tst-audit24amod1.so \ + $(objpfx)tst-audit24amod2.so + tst-audit24c-ENV = LD_BIND_NOW=1 LD_AUDIT=$(objpfx)tst-auditmod24c.so +-LDFLAGS-tst-audit24b = -Wl,-z,lazy ++LDFLAGS-tst-audit24c = -Wl,-z,lazy + + $(objpfx)tst-audit24d.out: $(objpfx)tst-auditmod24d.so + $(objpfx)tst-audit24d: $(objpfx)tst-audit24dmod1.so \ +diff --git a/elf/dl-audit.c b/elf/dl-audit.c +index 794bfd45cd..efc0492474 100644 +--- a/elf/dl-audit.c ++++ b/elf/dl-audit.c +@@ -257,7 +257,8 @@ _dl_audit_symbind (struct link_map *l, struct reloc_result *reloc_result, + reloc_result->flags = flags; + } + +- DL_FIXUP_BINDNOW_RELOC (value, new_value, sym.st_value); ++ if (flags & LA_SYMB_ALTVALUE) ++ DL_FIXUP_BINDNOW_RELOC (value, new_value, sym.st_value); + } + + void +diff --git a/elf/dl-map-segments.h b/elf/dl-map-segments.h +index 172692b120..fd24cf5d01 100644 +--- a/elf/dl-map-segments.h ++++ b/elf/dl-map-segments.h +@@ -113,6 +113,9 @@ _dl_map_segments (struct link_map *l, int fd, + unallocated. Then jump into the normal segment-mapping loop to + handle the portion of the segment past the end of the file + mapping. */ ++ if (__glibc_unlikely (loadcmds[nloadcmds - 1].mapstart < ++ c->mapend)) ++ return N_("ELF load command address/offset not page-aligned"); + if (__glibc_unlikely + (__mprotect ((caddr_t) (l->l_addr + c->mapend), + loadcmds[nloadcmds - 1].mapstart - c->mapend, +diff --git a/elf/tst-auditmod24a.c b/elf/tst-auditmod24a.c +index d8e88f3984..3075dfae2f 100644 +--- a/elf/tst-auditmod24a.c ++++ b/elf/tst-auditmod24a.c +@@ -110,5 +110,7 @@ la_symbind32 (Elf32_Sym *sym, unsigned int ndx, + return sym->st_value; + } + +- abort (); ++ if (symname[0] != '\0') ++ abort (); ++ return sym->st_value; + } +diff --git a/elf/tst-auditmod24d.c b/elf/tst-auditmod24d.c +index 8c803ecc0a..badc6be451 100644 +--- a/elf/tst-auditmod24d.c ++++ b/elf/tst-auditmod24d.c +@@ -116,5 +116,7 @@ la_symbind32 (Elf32_Sym *sym, unsigned int ndx, + } + } + +- abort (); ++ if (symname[0] != '\0') ++ abort (); ++ return sym->st_value; + } +diff --git a/elf/tst-auditmod25.c b/elf/tst-auditmod25.c +index 526f5c54bc..20640a8daf 100644 +--- a/elf/tst-auditmod25.c ++++ b/elf/tst-auditmod25.c +@@ -72,7 +72,7 @@ la_symbind32 (Elf32_Sym *sym, unsigned int ndx, + unsigned int *flags, const char *symname) + #endif + { +- if (*refcook != -1 && *defcook != -1) ++ if (*refcook != -1 && *defcook != -1 && symname[0] != '\0') + fprintf (stderr, "la_symbind: %s %u\n", symname, + *flags & (LA_SYMB_NOPLTENTER | LA_SYMB_NOPLTEXIT) ? 1 : 0); + return sym->st_value; +diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c +index 3b0412b405..18698bbe94 100644 +--- a/locale/programs/ld-monetary.c ++++ b/locale/programs/ld-monetary.c +@@ -196,21 +196,105 @@ No definition for %s category found"), "LC_MONETARY"); + } + } + ++ /* Generally speaking there are 3 standards the define the default, ++ warning, and error behaviour of LC_MONETARY. They are ISO/IEC TR 30112, ++ ISO/IEC 9899:2018 (ISO C17), and POSIX.1-2017. Within 30112 we have the ++ definition of a standard i18n FDCC-set, which for LC_MONETARY has the ++ following default values: ++ int_curr_symbol "" ++ currency_symbol "" ++ mon_decimal_point "" i.e. "," ++ mon_thousand_sep "" ++ mon_grouping "\177" i.e. CHAR_MAX ++ positive_sign "" ++ negative_sign "" i.e. "." ++ int_frac_digits -1 ++ frac_digits -1 ++ p_cs_precedes -1 ++ p_sep_by_space -1 ++ n_cs_precedes -1 ++ n_sep_by_space -1 ++ p_sign_posn -1 ++ n_sign_posn -1 ++ Under 30112 a keyword that is not provided implies an empty string "" ++ for string values or a -1 for integer values, and indicates the value ++ is unspecified with no default implied. No errors are considered. ++ The exception is mon_grouping which is a string with a terminating ++ CHAR_MAX. ++ For POSIX Issue 7 we have: ++ https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html ++ and again values not provided default to "" or -1, and indicate the value ++ is not available to the locale. The exception is mon_grouping which is ++ a string with a terminating CHAR_MAX. For the POSIX locale the values of ++ LC_MONETARY should be: ++ int_curr_symbol "" ++ currency_symbol "" ++ mon_decimal_point "" ++ mon_thousands_sep "" ++ mon_grouping "\177" i.e. CHAR_MAX ++ positive_sign "" ++ negative_sign "" ++ int_frac_digits -1 ++ frac_digits -1 ++ p_cs_precedes -1 ++ p_sep_by_space -1 ++ n_cs_precedes -1 ++ n_sep_by_space -1 ++ p_sign_posn -1 ++ n_sign_posn -1 ++ int_p_cs_precedes -1 ++ int_p_sep_by_space -1 ++ int_n_cs_precedes -1 ++ int_n_sep_by_space -1 ++ int_p_sign_posn -1 ++ int_n_sign_posn -1 ++ Like with 30112, POSIX also considers no error if the keywords are ++ missing, only that if the cateory as a whole is missing the referencing ++ of the category results in unspecified behaviour. ++ For ISO C17 there is no default value provided, but the localeconv ++ specification in 7.11.2.1 admits that members of char * type may point ++ to "" to indicate a value is not available or is of length zero. ++ The exception is decimal_point (not mon_decimal_point) which must be a ++ defined non-empty string. The values of char, which are generally ++ mapped to integer values in 30112 and POSIX, must be non-negative ++ numbers that map to CHAR_MAX when a value is not available in the ++ locale. ++ In ISO C17 for the "C" locale all values are empty strings "", or ++ CHAR_MAX, with the exception of decimal_point which is "." (defined ++ in LC_NUMERIC). ISO C17 makes no exception for mon_grouping like ++ 30112 and POSIX, but a value of "" is functionally equivalent to ++ "\177" since neither defines a grouping (though the latter terminates ++ the grouping). ++ ++ Lastly, we must consider the legacy C/POSIX locale that implemented ++ as a builtin in glibc and wether a default value mapping to the ++ C/POSIX locale may benefit the user from a compatibility perspective. ++ ++ Thus given 30112, POSIX, ISO C, and the builtin C/POSIX locale we ++ need to pick appropriate defaults below. */ ++ ++ /* The members of LC_MONETARY are handled in the order of their definition ++ in locale/categories.def. Please keep them in that order. */ ++ ++ /* The purpose of TEST_ELEM is to define a default value for the fields ++ in the category if the field was not defined in the cateory. If the ++ category was present but we didn't see a definition for the field then ++ we also issue a warning, otherwise the only warning you get is the one ++ earlier when a default category is created (completely missing category). ++ This missing field warning is glibc-specific since no standard requires ++ this warning, but we consider it valuable to print a warning for all ++ missing fields in the category. */ + #define TEST_ELEM(cat, initval) \ + if (monetary->cat == NULL) \ + { \ + if (! nothing) \ +- record_error (0, 0, _("%s: field `%s' not defined"), \ +- "LC_MONETARY", #cat); \ ++ record_warning (_("%s: field `%s' not defined"), \ ++ "LC_MONETARY", #cat); \ + monetary->cat = initval; \ + } + ++ /* Keyword: int_curr_symbol. */ + TEST_ELEM (int_curr_symbol, ""); +- TEST_ELEM (currency_symbol, ""); +- TEST_ELEM (mon_thousands_sep, ""); +- TEST_ELEM (positive_sign, ""); +- TEST_ELEM (negative_sign, ""); +- + /* The international currency symbol must come from ISO 4217. */ + if (monetary->int_curr_symbol != NULL) + { +@@ -247,41 +331,63 @@ not correspond to a valid name in ISO 4217 [--no-warnings=intcurrsym]"), + } + } + +- /* The decimal point must not be empty. This is not said explicitly +- in POSIX but ANSI C (ISO/IEC 9899) says in 4.4.2.1 it has to be +- != "". */ ++ /* Keyword: currency_symbol */ ++ TEST_ELEM (currency_symbol, ""); ++ ++ /* Keyword: mon_decimal_point */ ++ /* ISO C17 7.11.2.1.3 explicitly allows mon_decimal_point to be the ++ empty string e.g. "". This indicates the value is not available in the ++ current locale or is of zero length. However, if the value was never ++ defined then we issue a warning and use a glibc-specific default. ISO ++ 30112 in the i18n FDCC-Set uses ",", and POSIX Issue 7 in the ++ POSIX locale uses "". It is specific to glibc that the default is ++ "."; we retain this existing behaviour for backwards compatibility. */ + if (monetary->mon_decimal_point == NULL) + { + if (! nothing) +- record_error (0, 0, _("%s: field `%s' not defined"), +- "LC_MONETARY", "mon_decimal_point"); ++ record_warning (_("%s: field `%s' not defined, using defaults"), ++ "LC_MONETARY", "mon_decimal_point"); + monetary->mon_decimal_point = "."; + monetary->mon_decimal_point_wc = L'.'; + } +- else if (monetary->mon_decimal_point[0] == '\0' && ! be_quiet && ! nothing) ++ ++ /* Keyword: mon_thousands_sep */ ++ if (monetary->mon_thousands_sep == NULL) + { +- record_error (0, 0, _("\ +-%s: value for field `%s' must not be an empty string"), +- "LC_MONETARY", "mon_decimal_point"); ++ if (! nothing) ++ record_warning (_("%s: field `%s' not defined, using defaults"), ++ "LC_MONETARY", "mon_thousands_sep"); ++ monetary->mon_thousands_sep = ""; ++ monetary->mon_thousands_sep_wc = L'\0'; + } + ++ /* Keyword: mon_grouping */ + if (monetary->mon_grouping_len == 0) + { + if (! nothing) +- record_error (0, 0, _("%s: field `%s' not defined"), +- "LC_MONETARY", "mon_grouping"); +- ++ record_warning (_("%s: field `%s' not defined"), ++ "LC_MONETARY", "mon_grouping"); ++ /* Missing entries are given 1 element in their bytearray with ++ a value of CHAR_MAX which indicates that "No further grouping ++ is to be performed" (functionally equivalent to ISO C's "C" ++ locale default of ""). */ + monetary->mon_grouping = (char *) "\177"; + monetary->mon_grouping_len = 1; + } + ++ /* Keyword: positive_sign */ ++ TEST_ELEM (positive_sign, ""); ++ ++ /* Keyword: negative_sign */ ++ TEST_ELEM (negative_sign, ""); ++ + #undef TEST_ELEM + #define TEST_ELEM(cat, min, max, initval) \ + if (monetary->cat == -2) \ + { \ + if (! nothing) \ +- record_error (0, 0, _("%s: field `%s' not defined"), \ +- "LC_MONETARY", #cat); \ ++ record_warning (_("%s: field `%s' not defined"), \ ++ "LC_MONETARY", #cat); \ + monetary->cat = initval; \ + } \ + else if ((monetary->cat < min || monetary->cat > max) \ +@@ -300,16 +406,11 @@ not correspond to a valid name in ISO 4217 [--no-warnings=intcurrsym]"), + TEST_ELEM (p_sign_posn, -1, 4, -1); + TEST_ELEM (n_sign_posn, -1, 4, -1); + +- /* The non-POSIX.2 extensions are optional. */ +- if (monetary->duo_int_curr_symbol == NULL) +- monetary->duo_int_curr_symbol = monetary->int_curr_symbol; +- if (monetary->duo_currency_symbol == NULL) +- monetary->duo_currency_symbol = monetary->currency_symbol; +- +- if (monetary->duo_int_frac_digits == -2) +- monetary->duo_int_frac_digits = monetary->int_frac_digits; +- if (monetary->duo_frac_digits == -2) +- monetary->duo_frac_digits = monetary->frac_digits; ++ /* Keyword: crncystr */ ++ monetary->crncystr = (char *) xmalloc (strlen (monetary->currency_symbol) ++ + 2); ++ monetary->crncystr[0] = monetary->p_cs_precedes ? '-' : '+'; ++ strcpy (&monetary->crncystr[1], monetary->currency_symbol); + + #undef TEST_ELEM + #define TEST_ELEM(cat, alt, min, max) \ +@@ -327,6 +428,17 @@ not correspond to a valid name in ISO 4217 [--no-warnings=intcurrsym]"), + TEST_ELEM (int_p_sign_posn, p_sign_posn, -1, 4); + TEST_ELEM (int_n_sign_posn, n_sign_posn, -1, 4); + ++ /* The non-POSIX.2 extensions are optional. */ ++ if (monetary->duo_int_curr_symbol == NULL) ++ monetary->duo_int_curr_symbol = monetary->int_curr_symbol; ++ if (monetary->duo_currency_symbol == NULL) ++ monetary->duo_currency_symbol = monetary->currency_symbol; ++ ++ if (monetary->duo_int_frac_digits == -2) ++ monetary->duo_int_frac_digits = monetary->int_frac_digits; ++ if (monetary->duo_frac_digits == -2) ++ monetary->duo_frac_digits = monetary->frac_digits; ++ + TEST_ELEM (duo_p_cs_precedes, p_cs_precedes, -1, 1); + TEST_ELEM (duo_p_sep_by_space, p_sep_by_space, -1, 2); + TEST_ELEM (duo_n_cs_precedes, n_cs_precedes, -1, 1); +@@ -349,17 +461,15 @@ not correspond to a valid name in ISO 4217 [--no-warnings=intcurrsym]"), + if (monetary->duo_valid_to == 0) + monetary->duo_valid_to = 99991231; + ++ /* Keyword: conversion_rate */ + if (monetary->conversion_rate[0] == 0) + { + monetary->conversion_rate[0] = 1; + monetary->conversion_rate[1] = 1; + } + +- /* Create the crncystr entry. */ +- monetary->crncystr = (char *) xmalloc (strlen (monetary->currency_symbol) +- + 2); +- monetary->crncystr[0] = monetary->p_cs_precedes ? '-' : '+'; +- strcpy (&monetary->crncystr[1], monetary->currency_symbol); ++ /* A value for monetary-decimal-point-wc was set when ++ monetary_decimal_point was set, likewise for monetary-thousands-sep-wc. */ + } + + +diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c +index 45408c26c1..eeb2fa6ffe 100644 +--- a/locale/programs/locarchive.c ++++ b/locale/programs/locarchive.c +@@ -1397,7 +1397,7 @@ add_locales_to_archive (size_t nlist, char *list[], bool replace) + { + char fullname[fnamelen + 2 * strlen (d->d_name) + 7]; + +- if (d_type == DT_UNKNOWN) ++ if (d_type == DT_UNKNOWN || d_type == DT_LNK) + { + strcpy (stpcpy (stpcpy (fullname, fname), "/"), + d->d_name); +diff --git a/localedata/Makefile b/localedata/Makefile +index 9ae2e5c161..7741ac3b5e 100644 +--- a/localedata/Makefile ++++ b/localedata/Makefile +@@ -468,11 +468,11 @@ define build-one-locale + endef + + $(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir +- @flags="-c"; \ ++ @flags=""; \ + $(build-one-locale) + + $(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir +- @flags="-c --no-archive --no-hard-links"; \ ++ @flags="--no-archive --no-hard-links"; \ + $(build-one-locale) + + tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP +diff --git a/localedata/gen-locale.sh b/localedata/gen-locale.sh +index 7fce35f212..8053c816a6 100644 +--- a/localedata/gen-locale.sh ++++ b/localedata/gen-locale.sh +@@ -54,8 +54,14 @@ modifier=`echo $locfile|sed 's|[^.]*[.]\([^@ ]*\)\(@[^ ]*\)\?/LC_CTYPE|\2|'` + + echo "Generating locale $locale.$charmap: this might take a while..." + +-# Run quietly and force output. +-flags="--quiet -c" ++# Do not force output with '-c', all locales should compile without ++# warning or errors. There is likewise no need to run quietly with ++# '--quiet' since all locales should compile without additional ++# diagnostics. If there are messages printed then we want to see ++# them, fix them, and the associated error or warning. During ++# development it may be beneficialy to put '--quiet -c' here to allow ++# you to develop in-progress locales. ++flags="" + + # For SJIS the charmap is SHIFT_JIS. We just want the locale to have + # a slightly nicer name instead of using "*.SHIFT_SJIS", but that +diff --git a/nptl/unwind.c b/nptl/unwind.c +index c3563e3467..33b0d87579 100644 +--- a/nptl/unwind.c ++++ b/nptl/unwind.c +@@ -25,7 +25,7 @@ + #include + #include + +-#ifdef _STACK_GROWS_DOWN ++#if _STACK_GROWS_DOWN + # define FRAME_LEFT(frame, other, adj) \ + ((uintptr_t) frame - adj >= (uintptr_t) other - adj) + #elif _STACK_GROWS_UP diff --git a/posix/tst-spawn6.c b/posix/tst-spawn6.c index 911e90a461..044abd8535 100644 --- a/posix/tst-spawn6.c @@ -169,6 +585,258 @@ + #define TEST_FUNCTION_ARGV do_test #include +diff --git a/resolv/Makefile b/resolv/Makefile +index c465479e8b..438672786f 100644 +--- a/resolv/Makefile ++++ b/resolv/Makefile +@@ -79,11 +79,6 @@ generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace + extra-libs := libresolv libnss_dns + ifeq ($(have-thread-library),yes) + routines += gai_sigqueue +-endif +- +-ifeq ($(have-GLIBC_2.34)$(have-thread-library),yesyes) +-# Empty compatibility library for old binaries. +-extra-libs += libanl + + tests += \ + tst-bug18665 \ +@@ -144,7 +139,8 @@ xtests += tst-resolv-qtypes + + # This test has dropped packet tests and runs for a long time. + xtests += tst-resolv-rotate +-endif ++endif # $(have-thread-library) ++ + extra-libs-others = $(extra-libs) + libresolv-routines := \ + base64 \ +@@ -168,6 +164,13 @@ libresolv-routines := \ + resolv-deprecated \ + # libresolv-routines + ++ifeq ($(have-GLIBC_2.34)$(have-thread-library),yesyes) ++# Empty compatibility library for old binaries. ++extra-libs += libanl ++libanl-routines += libanl-compat ++libanl-shared-only-routines += libanl-compat ++endif ++ + $(libanl-routines-var) += \ + gai_cancel \ + gai_error \ +@@ -177,9 +180,6 @@ $(libanl-routines-var) += \ + getaddrinfo_a \ + # $(libanl-routines-var) + +-libanl-routines += libanl-compat +-libanl-shared-only-routines += libanl-compat +- + # Pretend that libanl.so is a linker script, so that the symbolic link + # is not installed. + install-lib-ldscripts = libanl.so +diff --git a/string/test-strncmp.c b/string/test-strncmp.c +index e7d5edea39..22b7dfa73b 100644 +--- a/string/test-strncmp.c ++++ b/string/test-strncmp.c +@@ -434,6 +434,18 @@ check3 (void) + } + } + ++static void ++check4 (void) ++{ ++ const CHAR *s1 = L ("abc"); ++ CHAR *s2 = STRDUP (s1); ++ ++ FOR_EACH_IMPL (impl, 0) ++ check_result (impl, s1, s2, SIZE_MAX, 0); ++ ++ free (s2); ++} ++ + int + test_main (void) + { +@@ -444,6 +456,7 @@ test_main (void) + check1 (); + check2 (); + check3 (); ++ check4 (); + + printf ("%23s", ""); + FOR_EACH_IMPL (impl, 0) +diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c +index 2584557c4f..9ed21602d6 100644 +--- a/sysdeps/hppa/dl-fptr.c ++++ b/sysdeps/hppa/dl-fptr.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -351,21 +352,20 @@ _dl_lookup_address (const void *address) + { + ElfW(Addr) addr = (ElfW(Addr)) address; + ElfW(Word) reloc_arg; +- volatile unsigned int *desc; +- unsigned int *gptr; ++ unsigned int *desc, *gptr; + + /* Return ADDR if the least-significant two bits of ADDR are not consistent + with ADDR being a linker defined function pointer. The normal value for + a code address in a backtrace is 3. */ +- if (((unsigned int) addr & 3) != 2) ++ if (((uintptr_t) addr & 3) != 2) + return addr; + + /* Handle special case where ADDR points to page 0. */ +- if ((unsigned int) addr < 4096) ++ if ((uintptr_t) addr < 4096) + return addr; + + /* Clear least-significant two bits from descriptor address. */ +- desc = (unsigned int *) ((unsigned int) addr & ~3); ++ desc = (unsigned int *) ((uintptr_t) addr & ~3); + if (!_dl_read_access_allowed (desc)) + return addr; + +@@ -376,7 +376,7 @@ _dl_lookup_address (const void *address) + /* Then load first word of candidate descriptor. It should be a pointer + with word alignment and point to memory that can be read. */ + gptr = (unsigned int *) desc[0]; +- if (((unsigned int) gptr & 3) != 0 ++ if (((uintptr_t) gptr & 3) != 0 + || !_dl_read_access_allowed (gptr)) + return addr; + +@@ -400,10 +400,11 @@ _dl_lookup_address (const void *address) + + /* If gp has been resolved, we need to hunt for relocation offset. */ + if (!(reloc_arg & PA_GP_RELOC)) +- reloc_arg = _dl_fix_reloc_arg (addr, l); ++ reloc_arg = _dl_fix_reloc_arg ((struct fdesc *) addr, l); + + _dl_fixup (l, reloc_arg); + } + + return (ElfW(Addr)) desc[0]; + } ++rtld_hidden_def (_dl_lookup_address) +diff --git a/sysdeps/hppa/dl-lookupcfg.h b/sysdeps/hppa/dl-lookupcfg.h +index 8da2412fea..de0a3b78e8 100644 +--- a/sysdeps/hppa/dl-lookupcfg.h ++++ b/sysdeps/hppa/dl-lookupcfg.h +@@ -30,6 +30,7 @@ rtld_hidden_proto (_dl_symbol_address) + #define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref) + + Elf32_Addr _dl_lookup_address (const void *address); ++rtld_hidden_proto (_dl_lookup_address) + + #define DL_LOOKUP_ADDRESS(addr) _dl_lookup_address ((const void *) addr) + +@@ -79,7 +80,9 @@ void attribute_hidden _dl_unmap (struct link_map *map); + /* Extract the code address from a fixup value */ + #define DL_FIXUP_VALUE_CODE_ADDR(value) ((value).ip) + #define DL_FIXUP_VALUE_ADDR(value) ((uintptr_t) &(value)) +-#define DL_FIXUP_ADDR_VALUE(addr) (*(struct fdesc *) (addr)) ++/* Clear the plabel bit to get the actual address of the descriptor. */ ++#define DL_FIXUP_ADDR_VALUE(addr) \ ++ (*(DL_FIXUP_VALUE_TYPE *) ((uintptr_t) (addr) & ~2)) + #define DL_FIXUP_BINDNOW_ADDR_VALUE(addr) (addr) +-#define DL_FIXUP_BINDNOW_RELOC(value, new_value, st_value) \ +- (*value) = *(struct fdesc *) (st_value) ++#define DL_FIXUP_BINDNOW_RELOC(value, new_value, st_value) \ ++ *(value) = *(DL_FIXUP_VALUE_TYPE *) ((uintptr_t) (new_value) & ~2) +diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h +index da4d57d2e4..7b7a697cbb 100644 +--- a/sysdeps/hppa/dl-machine.h ++++ b/sysdeps/hppa/dl-machine.h +@@ -176,6 +176,15 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + Elf32_Addr i[2]; + } sig = {{0x00,0xc0,0xff,0xee, 0xde,0xad,0xbe,0xef}}; + ++ /* Initialize dp register for main executable. */ ++ if (l->l_main_map) ++ { ++ register Elf32_Addr dp asm ("%r27"); ++ ++ dp = D_PTR (l, l_info[DT_PLTGOT]); ++ asm volatile ("" : : "r" (dp)); ++ } ++ + /* If we don't have a PLT we can just skip all this... */ + if (__builtin_expect (l->l_info[DT_JMPREL] == NULL,0)) + return lazy; +@@ -338,16 +347,6 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], + its return value is the user program's entry point. */ + + #define RTLD_START \ +-/* Set up dp for any non-PIC lib constructors that may be called. */ \ +-static struct link_map * __attribute__((used)) \ +-set_dp (struct link_map *map) \ +-{ \ +- register Elf32_Addr dp asm ("%r27"); \ +- dp = D_PTR (map, l_info[DT_PLTGOT]); \ +- asm volatile ("" : : "r" (dp)); \ +- return map; \ +-} \ +- \ + asm ( \ + " .text\n" \ + " .globl _start\n" \ +@@ -447,14 +446,11 @@ asm ( \ + " stw %r24,-44(%sp)\n" \ + \ + ".Lnofix:\n" \ ++ /* Call _dl_init(main_map, argc, argv, envp). */ \ + " addil LT'_rtld_local,%r19\n" \ + " ldw RT'_rtld_local(%r1),%r26\n" \ +-" bl set_dp, %r2\n" \ + " ldw 0(%r26),%r26\n" \ + \ +- /* Call _dl_init(_dl_loaded, argc, argv, envp). */ \ +-" copy %r28,%r26\n" \ +- \ + /* envp = argv + argc + 1 */ \ + " sh2add %r25,%r24,%r23\n" \ + " bl _dl_init,%r2\n" \ +diff --git a/sysdeps/hppa/dl-runtime.c b/sysdeps/hppa/dl-runtime.c +index 8b2ee58e37..192a6bee03 100644 +--- a/sysdeps/hppa/dl-runtime.c ++++ b/sysdeps/hppa/dl-runtime.c +@@ -25,8 +25,7 @@ + return that to the caller. The caller will continue on to call + _dl_fixup with the relocation offset. */ + +-ElfW(Word) +-attribute_hidden __attribute ((noinline)) DL_ARCH_FIXUP_ATTRIBUTE ++ElfW(Word) __attribute ((noinline)) DL_ARCH_FIXUP_ATTRIBUTE + _dl_fix_reloc_arg (struct fdesc *fptr, struct link_map *l) + { + Elf32_Addr l_addr, iplt, jmprel, end_jmprel, r_type; +@@ -52,3 +51,4 @@ _dl_fix_reloc_arg (struct fdesc *fptr, struct link_map *l) + ABORT_INSTRUCTION; + return 0; + } ++rtld_hidden_def (_dl_fix_reloc_arg) +diff --git a/sysdeps/hppa/dl-runtime.h b/sysdeps/hppa/dl-runtime.h +index d4da46079b..5ced8e14e9 100644 +--- a/sysdeps/hppa/dl-runtime.h ++++ b/sysdeps/hppa/dl-runtime.h +@@ -17,6 +17,9 @@ + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + ++ElfW(Word) _dl_fix_reloc_arg (struct fdesc *, struct link_map *); ++rtld_hidden_proto (_dl_fix_reloc_arg) ++ + /* Clear PA_GP_RELOC bit in relocation offset. */ + static inline uintptr_t + reloc_offset (uintptr_t plt0, uintptr_t pltn) diff --git a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c index 82171bf325..dfc8c2beff 100644 --- a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c @@ -186,10 +854,10 @@ # include # include diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c -index 4798cc337e..c98c8ce3d4 100644 +index 4798cc337e..d1ea074f0d 100644 --- a/sysdeps/unix/sysv/linux/getsysstats.c +++ b/sysdeps/unix/sysv/linux/getsysstats.c -@@ -44,7 +44,7 @@ __get_nprocs_sched (void) +@@ -44,15 +44,14 @@ __get_nprocs_sched (void) int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, cpu_bits_size, cpu_bits); if (r > 0) @@ -198,3 +866,657 @@ else if (r == -EINVAL) /* The input buffer is still not enough to store the number of cpus. This is an arbitrary values assuming such systems should be rare and there + is no offline cpus. */ + return max_num_cpus; +- /* Some other error. 2 is conservative (not a uniprocessor system, so +- atomics are needed). */ +- return 2; ++ /* Some other error. */ ++ return 0; + } + + static char * +@@ -108,22 +107,19 @@ next_line (int fd, char *const buffer, char **cp, char **re, + } + + static int +-get_nproc_stat (char *buffer, size_t buffer_size) ++get_nproc_stat (void) + { ++ enum { buffer_size = 1024 }; ++ char buffer[buffer_size]; + char *buffer_end = buffer + buffer_size; + char *cp = buffer_end; + char *re = buffer_end; +- +- /* Default to an SMP system in case we cannot obtain an accurate +- number. */ +- int result = 2; ++ int result = 0; + + const int flags = O_RDONLY | O_CLOEXEC; + int fd = __open_nocancel ("/proc/stat", flags); + if (fd != -1) + { +- result = 0; +- + char *l; + while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL) + /* The current format of /proc/stat has all the cpu* entries +@@ -139,8 +135,8 @@ get_nproc_stat (char *buffer, size_t buffer_size) + return result; + } + +-int +-__get_nprocs (void) ++static int ++get_nprocs_cpu_online (void) + { + enum { buffer_size = 1024 }; + char buffer[buffer_size]; +@@ -179,7 +175,8 @@ __get_nprocs (void) + } + } + +- result += m - n + 1; ++ if (m >= n) ++ result += m - n + 1; + + l = endp; + if (l < re && *l == ',') +@@ -188,28 +185,18 @@ __get_nprocs (void) + while (l < re && *l != '\n'); + + __close_nocancel_nostatus (fd); +- +- if (result > 0) +- return result; + } + +- return get_nproc_stat (buffer, buffer_size); ++ return result; + } +-libc_hidden_def (__get_nprocs) +-weak_alias (__get_nprocs, get_nprocs) +- + +-/* On some architectures it is possible to distinguish between configured +- and active cpus. */ +-int +-__get_nprocs_conf (void) ++static int ++get_nprocs_cpu (void) + { +- /* Try to use the sysfs filesystem. It has actual information about +- online processors. */ ++ int count = 0; + DIR *dir = __opendir ("/sys/devices/system/cpu"); + if (dir != NULL) + { +- int count = 0; + struct dirent64 *d; + + while ((d = __readdir64 (dir)) != NULL) +@@ -224,12 +211,57 @@ __get_nprocs_conf (void) + + __closedir (dir); + +- return count; + } ++ return count; ++} + +- enum { buffer_size = 1024 }; +- char buffer[buffer_size]; +- return get_nproc_stat (buffer, buffer_size); ++static int ++get_nprocs_fallback (void) ++{ ++ int result; ++ ++ /* Try /proc/stat first. */ ++ result = get_nproc_stat (); ++ if (result != 0) ++ return result; ++ ++ /* Try sched_getaffinity. */ ++ result = __get_nprocs_sched (); ++ if (result != 0) ++ return result; ++ ++ /* We failed to obtain an accurate number. Be conservative: return ++ the smallest number meaning that this is not a uniprocessor system, ++ so atomics are needed. */ ++ return 2; ++} ++ ++int ++__get_nprocs (void) ++{ ++ /* Try /sys/devices/system/cpu/online first. */ ++ int result = get_nprocs_cpu_online (); ++ if (result != 0) ++ return result; ++ ++ /* Fall back to /proc/stat and sched_getaffinity. */ ++ return get_nprocs_fallback (); ++} ++libc_hidden_def (__get_nprocs) ++weak_alias (__get_nprocs, get_nprocs) ++ ++/* On some architectures it is possible to distinguish between configured ++ and active cpus. */ ++int ++__get_nprocs_conf (void) ++{ ++ /* Try /sys/devices/system/cpu/ first. */ ++ int result = get_nprocs_cpu (); ++ if (result != 0) ++ return result; ++ ++ /* Fall back to /proc/stat and sched_getaffinity. */ ++ return get_nprocs_fallback (); + } + libc_hidden_def (__get_nprocs_conf) + weak_alias (__get_nprocs_conf, get_nprocs_conf) +diff --git a/sysdeps/unix/sysv/linux/hppa/getcontext.S b/sysdeps/unix/sysv/linux/hppa/getcontext.S +index 1e73587f13..dcdf986f2d 100644 +--- a/sysdeps/unix/sysv/linux/hppa/getcontext.S ++++ b/sysdeps/unix/sysv/linux/hppa/getcontext.S +@@ -21,22 +21,28 @@ + #include "ucontext_i.h" + + +- /* Trampoline function. Non-standard calling ABI. */ ++ /* Trampoline function. Non-standard calling ABI. */ + /* Can not use ENTRY(__getcontext_ret) here. */ + .type __getcontext_ret, @function + .hidden __getcontext_ret + __getcontext_ret: + .proc + .callinfo FRAME=0,NO_CALLS +- /* r26-r23 contain original r3-r6, but because setcontext +- does not reload r3-r6 (it's using them as temporaries) +- we must save them elsewhere and swap them back in. */ +- copy %r23, %r3 +- copy %r24, %r4 +- copy %r25, %r5 +- copy %r26, %r6 +- /* r20 contains original return pointer. */ +- bv 0(%r20) ++ /* Because setcontext does not reload r3-r6 (it's using them ++ as temporaries), we must load them ourself. */ ++ ldw oR3(%r26), %r3 ++ ldw oR4(%r26), %r4 ++ ldw oR5(%r26), %r5 ++ ldw oR6(%r26), %r6 ++ ++ /* Also reload registers clobbered by $$dyncall. */ ++ ldw oR21(%r26), %r21 ++ ldw oR22(%r26), %r22 ++ ldw oR31(%r26), %r31 ++ ++ /* oR0 contains original return pointer. */ ++ ldw oR0(%r26), %rp ++ bv 0(%rp) + copy %r0, %ret0 + .procend + .size __getcontext_ret, .-__getcontext_ret +@@ -64,13 +70,13 @@ ENTRY(__getcontext) + stw %r17, oR17(%r26) + stw %r18, oR18(%r26) + stw %r19, oR19(%r26) +- /* stw %r20, oR20(%r26) - used for trampoline. */ ++ stw %r20, oR20(%r26) + stw %r21, oR21(%r26) + stw %r22, oR22(%r26) +- /* stw %r23, oR23(%r26) - used for trampoline. */ +- /* stw %r24, oR24(%r26) - used for trampoline. */ +- /* stw %r25, oR25(%r26) - used for trampoline. */ +- /* stw %r26, oR26(%r26) - used for trampoline. */ ++ stw %r23, oR23(%r26) ++ stw %r24, oR24(%r26) ++ stw %r25, oR25(%r26) ++ stw %r26, oR26(%r26) + stw %r27, oR27(%r26) + stw %r28, oR28(%r26) + stw %r29, oR29(%r26) +@@ -89,7 +95,10 @@ ENTRY(__getcontext) + stw %r0, oIASQ1(%r26) + stw %r0, oIAOQ0(%r26) + stw %r0, oIAOQ1(%r26) +- stw %r0, oSAR(%r26) /* used as flag in swapcontext(). */ ++ ++ /* Save SAR register. */ ++ mfctl %sar, %r1 ++ stw %r1, oSAR(%r26) /* MSB used as flag in swapcontext(). */ + + + /* Store floating-point regs. */ +@@ -137,15 +146,12 @@ ENTRY(__getcontext) + stw %r19, -32(%sp) + .cfi_offset 19, 32 + #endif ++ stw %ret1, -60(%sp) ++ .cfi_offset 29, 4 + + /* Set up the trampoline registers. +- r20, r23, r24, r25, r26 and r2 are clobbered +- by call to getcontext() anyway. Reuse them. */ +- stw %r2, oR20(%r26) +- stw %r3, oR23(%r26) +- stw %r4, oR24(%r26) +- stw %r5, oR25(%r26) +- stw %r6, oR26(%r26) ++ Use oR0 context slot to save return value. */ ++ stw %r2, oR0(%r26) + #ifdef PIC + addil LT%__getcontext_ret, %r19 + ldw RT%__getcontext_ret(%r1), %r1 +@@ -167,6 +173,7 @@ ENTRY(__getcontext) + #ifdef PIC + ldw -32(%sp), %r19 + #endif ++ ldw -60(%sp), %ret1 + bv %r0(%r2) + ldwm -64(%sp), %r4 + END(__getcontext) +diff --git a/sysdeps/unix/sysv/linux/hppa/setcontext.S b/sysdeps/unix/sysv/linux/hppa/setcontext.S +index bc4872c8e2..dfa794ad5c 100644 +--- a/sysdeps/unix/sysv/linux/hppa/setcontext.S ++++ b/sysdeps/unix/sysv/linux/hppa/setcontext.S +@@ -33,6 +33,8 @@ ENTRY(__setcontext) + stw %r19, -32(%sp) + .cfi_offset 19, 32 + #endif ++ stw %ret1, -60(%sp) ++ .cfi_offset 29, 4 + + /* Save ucp. */ + copy %r26, %r3 +@@ -73,7 +75,7 @@ ENTRY(__setcontext) + ldw oR18(%r3), %r18 + ldw oR19(%r3), %r19 + ldw oR20(%r3), %r20 +- ldw oR21(%r3), %r21 ++ ldw oR21(%r3), %r21 /* maybe clobbered by dyncall */ + /* ldw oR22(%r3), %r22 - dyncall arg. */ + ldw oR23(%r3), %r23 + ldw oR24(%r3), %r24 +@@ -85,6 +87,10 @@ ENTRY(__setcontext) + ldw oR30(%r3), %sp + /* ldw oR31(%r3), %r31 - dyncall scratch register */ + ++ /* Restore SAR register. */ ++ ldw oSAR(%r3), %r22 ++ mtsar %r22 ++ + /* Restore floating-point registers. */ + ldo oFPREGS31(%r3), %r22 + fldds 0(%r22), %fr31 +@@ -154,6 +160,7 @@ ENTRY(__setcontext) + #ifdef PIC + ldw -32(%r30), %r19 + #endif ++ ldw -60(%r30), %ret1 + bv %r0(%r2) + ldwm -64(%r30), %r3 + L(pseudo_end): +diff --git a/sysdeps/unix/sysv/linux/hppa/swapcontext.c b/sysdeps/unix/sysv/linux/hppa/swapcontext.c +index 5cbe00f1e9..e5bf6c9933 100644 +--- a/sysdeps/unix/sysv/linux/hppa/swapcontext.c ++++ b/sysdeps/unix/sysv/linux/hppa/swapcontext.c +@@ -17,6 +17,7 @@ + . */ + + #include ++#include "ucontext_i.h" + + extern int __getcontext (ucontext_t *ucp); + extern int __setcontext (const ucontext_t *ucp); +@@ -24,17 +25,57 @@ extern int __setcontext (const ucontext_t *ucp); + int + __swapcontext (ucontext_t *oucp, const ucontext_t *ucp) + { ++ /* Save rp for debugger. */ ++ asm ("stw %rp,-20(%sp)"); ++ asm (".cfi_offset 2, -20"); ++ ++ /* Copy rp to ret0 (r28). */ ++ asm ("copy %rp,%ret0"); ++ ++ /* Create a frame. */ ++ asm ("ldo 64(%sp),%sp"); ++ asm (".cfi_def_cfa_offset -64"); ++ + /* Save the current machine context to oucp. */ +- __getcontext (oucp); ++ asm ("bl __getcontext,%rp"); ++ ++ /* Copy oucp to register ret1 (r29). __getcontext saves and restores it ++ on a normal return. It is restored from oR29 on reactivation. */ ++ asm ("copy %r26,%ret1"); ++ ++ /* Pop frame. */ ++ asm ("ldo -64(%sp),%sp"); ++ asm (".cfi_def_cfa_offset 0"); ++ ++ /* Load return pointer from oR28. */ ++ asm ("ldw %0(%%ret1),%%rp" : : "i" (oR28)); ++ ++ /* Return if error. */ ++ asm ("or,= %r0,%ret0,%r0"); ++ asm ("bv,n %r0(%rp)"); ++ ++ /* Load sc_sar flag. */ ++ asm ("ldb %0(%%ret1),%%r20" : : "i" (oSAR)); ++ ++ /* Return if oucp context has been reactivated. */ ++ asm ("or,= %r0,%r20,%r0"); ++ asm ("bv,n %r0(%rp)"); ++ ++ /* Mark sc_sar flag. */ ++ asm ("1: ldi 1,%r20"); ++ asm ("stb %%r20,%0(%%ret1)" : : "i" (oSAR)); ++ ++ /* Activate the machine context in ucp. */ ++ asm ("bl __setcontext,%rp"); ++ asm ("ldw %0(%%ret1),%%r26" : : "i" (oR25)); + +- /* mark sc_sar flag to skip the setcontext call on reactivation. */ +- if (oucp->uc_mcontext.sc_sar == 0) { +- oucp->uc_mcontext.sc_sar++; ++ /* Load return pointer. */ ++ asm ("ldw %0(%%ret1),%%rp" : : "i" (oR28)); + +- /* Restore the machine context in ucp. */ +- __setcontext (ucp); +- } ++ /* A successful call to setcontext does not return. */ ++ asm ("bv,n %r0(%rp)"); + ++ /* Make gcc happy. */ + return 0; + } + +diff --git a/sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c b/sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c +index 0ff1a214e6..2b1feb4766 100644 +--- a/sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c ++++ b/sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + /* AF_INET socket and address used to receive data. */ + static int srv; +@@ -88,7 +89,7 @@ do_test_large_buffer (bool mc) + /* Enable 32 bit timeval precision and check if no 64 bit timeval stamp + is created. */ + { +- int r = setsockopt (srv, SOL_SOCKET, SO_TIMESTAMP_OLD, &(int){1}, ++ int r = setsockopt (srv, SOL_SOCKET, COMPAT_SO_TIMESTAMP_OLD, &(int){1}, + sizeof (int)); + TEST_VERIFY_EXIT (r != -1); + +@@ -103,10 +104,10 @@ do_test_large_buffer (bool mc) + if (cmsg->cmsg_level != SOL_SOCKET) + continue; + +- if (sizeof (time_t) > 4 && cmsg->cmsg_type == SO_TIMESTAMP_NEW) ++ if (sizeof (time_t) > 4 && cmsg->cmsg_type == COMPAT_SO_TIMESTAMP_NEW) + found_timestamp = true; + else +- TEST_VERIFY (cmsg->cmsg_type != SO_TIMESTAMP_NEW); ++ TEST_VERIFY (cmsg->cmsg_type != COMPAT_SO_TIMESTAMP_NEW); + } + + TEST_COMPARE (found_timestamp, sizeof (time_t) > 4); +@@ -114,7 +115,7 @@ do_test_large_buffer (bool mc) + + /* Same as before, but for timespec. */ + { +- int r = setsockopt (srv, SOL_SOCKET, SO_TIMESTAMPNS_OLD, &(int){1}, ++ int r = setsockopt (srv, SOL_SOCKET, COMPAT_SO_TIMESTAMPNS_OLD, &(int){1}, + sizeof (int)); + TEST_VERIFY_EXIT (r != -1); + +@@ -129,10 +130,10 @@ do_test_large_buffer (bool mc) + if (cmsg->cmsg_level != SOL_SOCKET) + continue; + +- if (sizeof (time_t) > 4 && cmsg->cmsg_type == SO_TIMESTAMPNS_NEW) ++ if (sizeof (time_t) > 4 && cmsg->cmsg_type == COMPAT_SO_TIMESTAMPNS_NEW) + found_timestamp = true; + else +- TEST_VERIFY (cmsg->cmsg_type != SO_TIMESTAMPNS_NEW); ++ TEST_VERIFY (cmsg->cmsg_type != COMPAT_SO_TIMESTAMPNS_NEW); + } + + TEST_COMPARE (found_timestamp, sizeof (time_t) > 4); +@@ -151,7 +152,7 @@ do_test_small_buffer (bool mc) + /* Enable 32 bit timeval precision and check if no 64 bit timeval stamp + is created. */ + { +- int r = setsockopt (srv, SOL_SOCKET, SO_TIMESTAMP_OLD, &(int){1}, ++ int r = setsockopt (srv, SOL_SOCKET, COMPAT_SO_TIMESTAMP_OLD, &(int){1}, + sizeof (int)); + TEST_VERIFY_EXIT (r != -1); + +@@ -172,10 +173,10 @@ do_test_small_buffer (bool mc) + if (cmsg->cmsg_level != SOL_SOCKET) + continue; + +- if (sizeof (time_t) > 4 && cmsg->cmsg_type == SO_TIMESTAMP_NEW) ++ if (sizeof (time_t) > 4 && cmsg->cmsg_type == COMPAT_SO_TIMESTAMP_NEW) + found_timestamp = true; + else +- TEST_VERIFY (cmsg->cmsg_type != SO_TIMESTAMP_NEW); ++ TEST_VERIFY (cmsg->cmsg_type != COMPAT_SO_TIMESTAMP_NEW); + } + + if (sizeof (time_t) > 4) +@@ -192,7 +193,7 @@ do_test_small_buffer (bool mc) + + /* Same as before, but for timespec. */ + { +- int r = setsockopt (srv, SOL_SOCKET, SO_TIMESTAMPNS_OLD, &(int){1}, ++ int r = setsockopt (srv, SOL_SOCKET, COMPAT_SO_TIMESTAMPNS_OLD, &(int){1}, + sizeof (int)); + TEST_VERIFY_EXIT (r != -1); + +@@ -213,10 +214,10 @@ do_test_small_buffer (bool mc) + if (cmsg->cmsg_level != SOL_SOCKET) + continue; + +- if (sizeof (time_t) > 4 && cmsg->cmsg_type == SO_TIMESTAMPNS_NEW) ++ if (sizeof (time_t) > 4 && cmsg->cmsg_type == COMPAT_SO_TIMESTAMPNS_NEW) + found_timestamp = true; + else +- TEST_VERIFY (cmsg->cmsg_type != SO_TIMESTAMPNS_NEW); ++ TEST_VERIFY (cmsg->cmsg_type != COMPAT_SO_TIMESTAMPNS_NEW); + } + + if (sizeof (time_t) > 4) +diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile +index 6cf708335c..c6bee981f8 100644 +--- a/sysdeps/x86/Makefile ++++ b/sysdeps/x86/Makefile +@@ -99,7 +99,9 @@ tests += \ + tst-strcpy-rtm \ + tst-strlen-rtm \ + tst-strncmp-rtm \ +- tst-strrchr-rtm ++ tst-strrchr-rtm \ ++ tst-wcsncmp-rtm \ ++# tests + + CFLAGS-tst-memchr-rtm.c += -mrtm + CFLAGS-tst-memcmp-rtm.c += -mrtm +@@ -109,8 +111,9 @@ CFLAGS-tst-memset-rtm.c += -mrtm + CFLAGS-tst-strchr-rtm.c += -mrtm + CFLAGS-tst-strcpy-rtm.c += -mrtm + CFLAGS-tst-strlen-rtm.c += -mrtm +-CFLAGS-tst-strncmp-rtm.c += -mrtm ++CFLAGS-tst-strncmp-rtm.c += -mrtm -Wno-error + CFLAGS-tst-strrchr-rtm.c += -mrtm ++CFLAGS-tst-wcsncmp-rtm.c += -mrtm -Wno-error + endif + + ifneq ($(enable-cet),no) +diff --git a/sysdeps/x86/tst-strncmp-rtm.c b/sysdeps/x86/tst-strncmp-rtm.c +index 09ed6fa0d6..300bc8c281 100644 +--- a/sysdeps/x86/tst-strncmp-rtm.c ++++ b/sysdeps/x86/tst-strncmp-rtm.c +@@ -16,20 +16,35 @@ + License along with the GNU C Library; if not, see + . */ + ++#include + #include + ++#ifdef WIDE ++# define CHAR wchar_t ++# define MEMSET wmemset ++# define STRNCMP wcsncmp ++# define TEST_NAME "wcsncmp" ++#else /* !WIDE */ ++# define CHAR char ++# define MEMSET memset ++# define STRNCMP strncmp ++# define TEST_NAME "strncmp" ++#endif /* !WIDE */ ++ ++ ++ + #define LOOP 3000 + #define STRING_SIZE 1024 +-char string1[STRING_SIZE]; +-char string2[STRING_SIZE]; ++CHAR string1[STRING_SIZE]; ++CHAR string2[STRING_SIZE]; + + __attribute__ ((noinline, noclone)) + static int + prepare (void) + { +- memset (string1, 'a', STRING_SIZE - 1); +- memset (string2, 'a', STRING_SIZE - 1); +- if (strncmp (string1, string2, STRING_SIZE) == 0) ++ MEMSET (string1, 'a', STRING_SIZE - 1); ++ MEMSET (string2, 'a', STRING_SIZE - 1); ++ if (STRNCMP (string1, string2, STRING_SIZE) == 0) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; +@@ -39,7 +54,17 @@ __attribute__ ((noinline, noclone)) + static int + function (void) + { +- if (strncmp (string1, string2, STRING_SIZE) == 0) ++ if (STRNCMP (string1, string2, STRING_SIZE) == 0) ++ return 0; ++ else ++ return 1; ++} ++ ++__attribute__ ((noinline, noclone)) ++static int ++function_overflow (void) ++{ ++ if (STRNCMP (string1, string2, SIZE_MAX) == 0) + return 0; + else + return 1; +@@ -48,5 +73,9 @@ function (void) + static int + do_test (void) + { +- return do_test_1 ("strncmp", LOOP, prepare, function); ++ int status = do_test_1 (TEST_NAME, LOOP, prepare, function); ++ if (status != EXIT_SUCCESS) ++ return status; ++ status = do_test_1 (TEST_NAME, LOOP, prepare, function_overflow); ++ return status; + } +diff --git a/sysdeps/x86/tst-wcsncmp-rtm.c b/sysdeps/x86/tst-wcsncmp-rtm.c +new file mode 100644 +index 0000000000..bad3b86378 +--- /dev/null ++++ b/sysdeps/x86/tst-wcsncmp-rtm.c +@@ -0,0 +1,21 @@ ++/* Test case for wcsncmp inside a transactionally executing RTM region. ++ Copyright (C) 2022 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 ++ . */ ++ ++#define WIDE 1 ++#include ++#include "tst-strncmp-rtm.c" +diff --git a/sysdeps/x86_64/multiarch/strcmp-avx2.S b/sysdeps/x86_64/multiarch/strcmp-avx2.S +index 9c73b5899d..cdcb3c5a26 100644 +--- a/sysdeps/x86_64/multiarch/strcmp-avx2.S ++++ b/sysdeps/x86_64/multiarch/strcmp-avx2.S +@@ -95,7 +95,7 @@ ENTRY (STRCMP) + length to bound a valid memory region. In these cases just use + 'wcscmp'. */ + shrq $56, %rcx +- jnz __wcscmp_avx2 ++ jnz OVERFLOW_STRCMP + # endif + /* Convert units: from wide to byte char. */ + shl $2, %RDX_LP +diff --git a/sysdeps/x86_64/multiarch/strncmp-avx2-rtm.S b/sysdeps/x86_64/multiarch/strncmp-avx2-rtm.S +index 37d1224bb9..68bad365ba 100644 +--- a/sysdeps/x86_64/multiarch/strncmp-avx2-rtm.S ++++ b/sysdeps/x86_64/multiarch/strncmp-avx2-rtm.S +@@ -1,3 +1,4 @@ + #define STRCMP __strncmp_avx2_rtm + #define USE_AS_STRNCMP 1 ++#define OVERFLOW_STRCMP __strcmp_avx2_rtm + #include "strcmp-avx2-rtm.S" +diff --git a/sysdeps/x86_64/multiarch/strncmp-avx2.S b/sysdeps/x86_64/multiarch/strncmp-avx2.S +index 1678bcc235..f138e9f1fd 100644 +--- a/sysdeps/x86_64/multiarch/strncmp-avx2.S ++++ b/sysdeps/x86_64/multiarch/strncmp-avx2.S +@@ -1,3 +1,4 @@ + #define STRCMP __strncmp_avx2 + #define USE_AS_STRNCMP 1 ++#define OVERFLOW_STRCMP __strcmp_avx2 + #include "strcmp-avx2.S" +diff --git a/sysdeps/x86_64/multiarch/wcsncmp-avx2-rtm.S b/sysdeps/x86_64/multiarch/wcsncmp-avx2-rtm.S +index 4e88c70cc6..f467582cbe 100644 +--- a/sysdeps/x86_64/multiarch/wcsncmp-avx2-rtm.S ++++ b/sysdeps/x86_64/multiarch/wcsncmp-avx2-rtm.S +@@ -1,5 +1,5 @@ + #define STRCMP __wcsncmp_avx2_rtm + #define USE_AS_STRNCMP 1 + #define USE_AS_WCSCMP 1 +- ++#define OVERFLOW_STRCMP __wcscmp_avx2_rtm + #include "strcmp-avx2-rtm.S" +diff --git a/sysdeps/x86_64/multiarch/wcsncmp-avx2.S b/sysdeps/x86_64/multiarch/wcsncmp-avx2.S +index 4fa1de4d3f..e9ede522b8 100644 +--- a/sysdeps/x86_64/multiarch/wcsncmp-avx2.S ++++ b/sysdeps/x86_64/multiarch/wcsncmp-avx2.S +@@ -1,5 +1,5 @@ + #define STRCMP __wcsncmp_avx2 + #define USE_AS_STRNCMP 1 + #define USE_AS_WCSCMP 1 +- ++#define OVERFLOW_STRCMP __wcscmp_avx2 + #include "strcmp-avx2.S" diff -Nru glibc-2.35/debian/patches/series glibc-2.35/debian/patches/series --- glibc-2.35/debian/patches/series 2022-02-04 00:59:05.000000000 +0000 +++ glibc-2.35/debian/patches/series 2022-03-04 02:51:40.000000000 +0000 @@ -23,6 +23,7 @@ arm/local-sigaction.diff arm/unsubmitted-ldconfig-cache-abi.diff arm/local-soname-hack.diff +arm/local-vfp-sysdeps.diff arm/unsubmitted-ldso-multilib.diff arm/local-arm-futex.diff diff -Nru glibc-2.35/debian/rules.d/build.mk glibc-2.35/debian/rules.d/build.mk --- glibc-2.35/debian/rules.d/build.mk 2022-02-04 00:59:05.000000000 +0000 +++ glibc-2.35/debian/rules.d/build.mk 2022-03-04 02:52:42.000000000 +0000 @@ -110,6 +110,7 @@ --enable-stackguard-randomization \ --enable-stack-protector=strong \ --with-pkgversion="Ubuntu GLIBC $(DEB_VERSION)" \ + --with-default-link=no \ --with-bugurl="https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs" \ $(if $(filter $(pt_chown),yes),--enable-pt_chown) \ $(if $(filter $(threads),no),--disable-nscd) \ diff -Nru glibc-2.35/debian/rules.d/tarball.mk glibc-2.35/debian/rules.d/tarball.mk --- glibc-2.35/debian/rules.d/tarball.mk 2022-02-04 00:59:05.000000000 +0000 +++ glibc-2.35/debian/rules.d/tarball.mk 2022-03-04 02:51:40.000000000 +0000 @@ -18,6 +18,8 @@ update-from-upstream: dh_testdir - echo "" >> $(GIT_UPDATES_DIFF) git fetch origin + h=$$(git log -n 1 --format=%H origin/$(GLIBC_BRANCH)); \ + echo "GIT update of $(GLIBC_GIT)/$(GLIBC_BRANCH) from $(GLIBC_TAG) to $$h" > $(GIT_UPDATES_DIFF) + echo "" >> $(GIT_UPDATES_DIFF) git diff --no-renames $(GLIBC_TAG) origin/$(GLIBC_BRANCH) >> $(GIT_UPDATES_DIFF) diff -Nru glibc-2.35/debian/testsuite-xfail-debian.mk glibc-2.35/debian/testsuite-xfail-debian.mk --- glibc-2.35/debian/testsuite-xfail-debian.mk 2022-02-04 00:59:05.000000000 +0000 +++ glibc-2.35/debian/testsuite-xfail-debian.mk 2022-03-04 02:51:40.000000000 +0000 @@ -57,9 +57,6 @@ test-xfail-tst-strerror = yes test-xfail-tst-strsignal = yes -# https://sourceware.org/bugzilla/show_bug.cgi?id=28838 -test-xfail-tst-p_align3 = yes - ###################################################################### # alpha (including optimized flavours) ######################################################################