From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id fHEwCo/hkGYeuSMAWB0awg (envelope-from ) for ; Fri, 12 Jul 2024 03:55:59 -0400 Received: by simark.ca (Postfix, from userid 112) id 181751E0C3; Fri, 12 Jul 2024 03:55:59 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F228B1E097 for ; Fri, 12 Jul 2024 03:55:56 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 65470383917B for ; Fri, 12 Jul 2024 07:55:56 +0000 (GMT) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id EA2073858431; Fri, 12 Jul 2024 07:55:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EA2073858431 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EA2073858431 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:ea4a:1:5054:ff:fec7:86e4 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720770928; cv=none; b=uALAApyNL5jno6n6oC/5JXZNu3dBjTjFh0MT5UuajmYDbrek+tVdIWMX8152+splm7Qt+mMpgDj6ebv3hXp7LaSJD6/1jNKdkm6eSHkQl51ZOLQvVBJpT9YwQLx/9ZWbC4tuOmw73t58eEOEuHhnAXp81KYsJFdsFCO0h8SsaL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720770928; c=relaxed/simple; bh=qyoDhPT3Yc8KXGYT7dtLCb0mkUBN+O1jFclG2qm7v4g=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=GFSjDOub04b5ypNy5Kw0MmzA336iE3vNVDnGGgre/Q8IvmDxv8xpIyPt1sC7LXFNVXGg5tnn81FrhUIFosVdKCgACo1Kxzr9Wl6ljMt/hLeWl0K3GLCYekQPSFDFpMNpbQ41LAk9PV/LaVSbxp3xQwUr1we6JXXa+93SHlXOhHY= ARC-Authentication-Results: i=1; server2.sourceware.org From: Sam James To: binutils@sourceware.org Cc: gdb-patches@sourceware.org, Nick Clifton Subject: Re: [PATCH] libiberty: sync with gcc In-Reply-To: <20240629171711.2305705-1-sam@gentoo.org> (Sam James's message of "Sat, 29 Jun 2024 18:17:11 +0100") Organization: Gentoo References: <20240629171711.2305705-1-sam@gentoo.org> Date: Fri, 12 Jul 2024 08:55:21 +0100 Message-ID: <87bk339h92.fsf@gentoo.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Sam James writes: > This imports the following commits from GCC as of r15-1722-g7682d11540274= 3: > ca2f7c84927f libiberty: Invoke D demangler when --format=3Dauto > 94792057ad4a Fix up duplicated words mostly in comments, part 1 > 20e57660e64e libiberty: Fix error return value in pex_unix_exec_child [P= R113957]. > 52ac4c6be866 [libiberty] remove TBAA violation in iterative_hash, improv= e code-gen > 53bb7145135c libiberty: Fix up libiberty_vprintf_buffer_size > 65388b28656d c++, demangle: Implement https://github.com/itanium-cxx-abi= /cxx-abi/issues/148 non-proposal > --- ping. It might be nice for this to get in for binutils-2.43 branching given the UB fix for hashing. > libiberty/ChangeLog | 45 +++++++++++++++++ > libiberty/cplus-dem.c | 2 +- > libiberty/dyn-string.c | 2 +- > libiberty/functions.texi | 14 +++--- > libiberty/hashtab.c | 23 ++++----- > libiberty/pex-unix.c | 2 + > libiberty/regex.c | 2 +- > libiberty/testsuite/d-demangle-expected | 5 ++ > libiberty/vprintf-support.c | 65 ++++++++++++++++++++++--- > 9 files changed, 131 insertions(+), 29 deletions(-) > > diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog > index 884c8b70f87..cdcd4b3ced8 100644 > --- a/libiberty/ChangeLog > +++ b/libiberty/ChangeLog > @@ -1,3 +1,48 @@ > +2024-04-02 Tom Tromey > + > + * cplus-dem.c (cplus_demangle): Try the D demangler with > + "auto" format. > + * testsuite/d-demangle-expected: Add --format=3Dauto test. > + > +2024-04-02 Jakub Jelinek > + > + * regex.c (byte_re_match_2_internal): Fix duplicated words in comment; > + next next -> next. > + * dyn-string.c (dyn_string_init): Fix duplicated words in comment; > + of of -> of. > + > +2024-02-19 Iain Sandoe > + > + PR other/113957 > + * pex-unix.c (pex_unix_exec_child): Set pid =3D -1 in the error > + paths, since that is used to signal an erroneous outcome for > + the routine. > + > +2024-02-15 Richard Biener > + > + * hashtab.c (iterative_hash): Remove TBAA violating handling > + of aligned little-endian case in favor of just keeping the > + aligned case special-cased. Use | for composing a larger word. > + > +2024-02-12 Jakub Jelinek > + > + * vprintf-support.c (libiberty_vprintf_buffer_size): Handle > + properly l, ll, z, t or on _WIN32 I64 modifiers for diouxX > + and L modifier for fFgGeE. > + > +2024-01-13 Jakub Jelinek > + > + * cp-demangle.c (FNQUAL_COMPONENT_CASE): Add case for > + DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION. > + (d_dump): Handle DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION. > + (d_nested_name): Parse H after N in nested name. > + (d_count_templates_scopes): Handle > + DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION. > + (d_print_mod): Likewise. > + (d_print_function_type): Likewise. > + * testsuite/demangle-expected: Add tests for explicit object > + member functions. > + > 2023-12-05 Jakub Jelinek >=20=20 > * configure.ac (HAVE_X86_SHA1_HW_SUPPORT): Verify __get_cpuid and > diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c > index 8b92946981f..ee9e84f5d6b 100644 > --- a/libiberty/cplus-dem.c > +++ b/libiberty/cplus-dem.c > @@ -186,7 +186,7 @@ cplus_demangle (const char *mangled, int options) > if (GNAT_DEMANGLING) > return ada_demangle (mangled, options); >=20=20 > - if (DLANG_DEMANGLING) > + if (DLANG_DEMANGLING || AUTO_DEMANGLING) > { > ret =3D dlang_demangle (mangled, options); > if (ret) > diff --git a/libiberty/dyn-string.c b/libiberty/dyn-string.c > index ecd8c069984..5805c0b4ff8 100644 > --- a/libiberty/dyn-string.c > +++ b/libiberty/dyn-string.c > @@ -47,7 +47,7 @@ Boston, MA 02110-1301, USA. */ >=20=20 > /* Performs in-place initialization of a dyn_string struct. This > function can be used with a dyn_string struct on the stack or > - embedded in another object. The contents of of the string itself > + embedded in another object. The contents of the string itself > are still dynamically allocated. The string initially is capable > of holding at least SPACE characeters, including the terminating > NUL. If SPACE is 0, it will silently be increated to 1.=20=20 > diff --git a/libiberty/functions.texi b/libiberty/functions.texi > index 651b169b040..b56b02e0686 100644 > --- a/libiberty/functions.texi > +++ b/libiberty/functions.texi > @@ -165,7 +165,7 @@ not recommended. >=20=20 > @end deftypefn >=20=20 > -@c make-temp-file.c:108 > +@c make-temp-file.c:95 > @deftypefn Replacement const char* choose_tmpdir () >=20=20 > Returns a pointer to a directory path suitable for creating temporary > @@ -192,7 +192,7 @@ Concatenate zero or more of strings and return the re= sult in freshly >=20=20 > @end deftypefn >=20=20 > -@c argv.c:485 > +@c argv.c:495 > @deftypefn Extension int countargv (char * const *@var{argv}) >=20=20 > Return the number of elements in @var{argv}. > @@ -257,7 +257,7 @@ symbolic name or message. >=20=20 > @end deftypefn >=20=20 > -@c argv.c:339 > +@c argv.c:352 > @deftypefn Extension void expandargv (int *@var{argcp}, char ***@var{arg= vp}) >=20=20 > The @var{argcp} and @code{argvp} arguments are pointers to the usual > @@ -726,7 +726,7 @@ relative prefix can be found, return @code{NULL}. >=20=20 > @end deftypefn >=20=20 > -@c make-temp-file.c:185 > +@c make-temp-file.c:173 > @deftypefn Replacement char* make_temp_file (const char *@var{suffix}) >=20=20 > Return a temporary file name (as a string) or @code{NULL} if unable to > @@ -1747,7 +1747,7 @@ that the converted value is unsigned. > @c strtoll.c:33 > @deftypefn Supplemental {long long int} strtoll (const char *@var{string= }, @ > char **@var{endptr}, int @var{base}) > -@deftypefnx Supplemental {unsigned long long int} strtoul (@ > +@deftypefnx Supplemental {unsigned long long int} strtoull (@ > const char *@var{string}, char **@var{endptr}, int @var{base}) >=20=20 > The @code{strtoll} function converts the string in @var{string} to a > @@ -1938,8 +1938,8 @@ does the return value. The third argument is unuse= d in @libib{}. > @deftypefn Extension int writeargv (char * const *@var{argv}, FILE *@var= {file}) >=20=20 > Write each member of ARGV, handling all necessary quoting, to the file > -associated with FILE, separated by whitespace. Return 0 on success, > -non-zero if an error occurred while writing to FILE. > +named by FILE, separated by whitespace. Return 0 on success, non-zero > +if an error occurred while writing to FILE. >=20=20 > @end deftypefn >=20=20 > diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c > index 48f28078114..e3a07256a30 100644 > --- a/libiberty/hashtab.c > +++ b/libiberty/hashtab.c > @@ -940,26 +940,23 @@ iterative_hash (const void *k_in /* the key */, > c =3D initval; /* the previous hash value */ >=20=20 > /*---------------------------------------- handle most of the key */ > -#ifndef WORDS_BIGENDIAN > - /* On a little-endian machine, if the data is 4-byte aligned we can ha= sh > - by word for better speed. This gives nondeterministic results on > - big-endian machines. */ > - if (sizeof (hashval_t) =3D=3D 4 && (((size_t)k)&3) =3D=3D 0) > - while (len >=3D 12) /* aligned */ > + /* Provide specialization for the aligned case for targets that cannot > + efficiently perform misaligned loads of a merged access. */ > + if ((((size_t)k)&3) =3D=3D 0) > + while (len >=3D 12) > { > - a +=3D *(hashval_t *)(k+0); > - b +=3D *(hashval_t *)(k+4); > - c +=3D *(hashval_t *)(k+8); > + a +=3D (k[0] | ((hashval_t)k[1]<<8) | ((hashval_t)k[2]<<16) | ((hashval= _t)k[3]<<24)); > + b +=3D (k[4] | ((hashval_t)k[5]<<8) | ((hashval_t)k[6]<<16) | ((hashval= _t)k[7]<<24)); > + c +=3D (k[8] | ((hashval_t)k[9]<<8) | ((hashval_t)k[10]<<16)| ((hashval= _t)k[11]<<24)); > mix(a,b,c); > k +=3D 12; len -=3D 12; > } > else /* unaligned */ > -#endif > while (len >=3D 12) > { > - a +=3D (k[0] +((hashval_t)k[1]<<8) +((hashval_t)k[2]<<16) +((hashval_t)= k[3]<<24)); > - b +=3D (k[4] +((hashval_t)k[5]<<8) +((hashval_t)k[6]<<16) +((hashval_t)= k[7]<<24)); > - c +=3D (k[8] +((hashval_t)k[9]<<8) +((hashval_t)k[10]<<16)+((hashval_t)= k[11]<<24)); > + a +=3D (k[0] | ((hashval_t)k[1]<<8) | ((hashval_t)k[2]<<16) | ((hashval= _t)k[3]<<24)); > + b +=3D (k[4] | ((hashval_t)k[5]<<8) | ((hashval_t)k[6]<<16) | ((hashval= _t)k[7]<<24)); > + c +=3D (k[8] | ((hashval_t)k[9]<<8) | ((hashval_t)k[10]<<16)| ((hashval= _t)k[11]<<24)); > mix(a,b,c); > k +=3D 12; len -=3D 12; > } > diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c > index af98062a94c..f3a1cc95ada 100644 > --- a/libiberty/pex-unix.c > +++ b/libiberty/pex-unix.c > @@ -695,6 +695,7 @@ pex_unix_exec_child (struct pex_obj *obj ATTRIBUTE_UN= USED, > { > *err =3D ret; > *errmsg =3D "posix_spawnp"; > + pid =3D -1; /* The value of pid is unspecified on failure. */ > goto exit; > } > } > @@ -705,6 +706,7 @@ pex_unix_exec_child (struct pex_obj *obj ATTRIBUTE_UN= USED, > { > *err =3D ret; > *errmsg =3D "posix_spawn"; > + pid =3D -1; > goto exit; > } > } > diff --git a/libiberty/regex.c b/libiberty/regex.c > index 4841c5a08f9..67747e6ce5a 100644 > --- a/libiberty/regex.c > +++ b/libiberty/regex.c > @@ -5597,7 +5597,7 @@ byte_re_match_2_internal (struct re_pattern_buffer = *bufp, > to resume scanning the pattern; the second one is where to resume > scanning the strings. If the latter is zero, the failure point is > a ``dummy''; if a failure happens and the failure point is a dummy, > - it gets discarded and the next next one is tried. */ > + it gets discarded and the next one is tried. */ > #ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */ > PREFIX(fail_stack_type) fail_stack; > #endif > diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuit= e/d-demangle-expected > index 47b059c4298..cfbdf2a52cb 100644 > --- a/libiberty/testsuite/d-demangle-expected > +++ b/libiberty/testsuite/d-demangle-expected > @@ -1470,3 +1470,8 @@ demangle.anonymous > --format=3Ddlang > _D8demangle9anonymous03fooZ > demangle.anonymous.foo > +# > +# Test that 'auto' works. > +--format=3Dauto > +_D8demangle9anonymous03fooZ > +demangle.anonymous.foo > diff --git a/libiberty/vprintf-support.c b/libiberty/vprintf-support.c > index b590e5ab034..0543ec0554e 100644 > --- a/libiberty/vprintf-support.c > +++ b/libiberty/vprintf-support.c > @@ -56,6 +56,7 @@ libiberty_vprintf_buffer_size (const char *format, va_l= ist args) > { > if (*p++ =3D=3D '%') > { > + int prec =3D 0; > while (strchr ("-+ #0", *p)) > ++p; > if (*p =3D=3D '*') > @@ -76,8 +77,43 @@ libiberty_vprintf_buffer_size (const char *format, va_= list args) > else > total_width +=3D strtoul (p, (char **) &p, 10); > } > - while (strchr ("hlL", *p)) > - ++p; > + do > + { > + switch (*p) > + { > + case 'h': > + ++p; > + continue; > + case 'l': > + case 'L': > + ++prec; > + ++p; > + continue; > + case 'z': > + prec =3D 3; > + ++p; > + continue; > + case 't': > + prec =3D 4; > + ++p; > + continue; > +#ifdef _WIN32 > + case 'I': > + if (p[1] =3D=3D '6' && p[2] =3D=3D '4') > + { > + prec =3D 2; > + p +=3D 3; > + continue; > + } > + break; > +#endif > + default: > + break; > + } > + break; > + } > + while (1); > + > /* Should be big enough for any format specifier except %s and floats= . */ > total_width +=3D 30; > switch (*p) > @@ -88,6 +124,15 @@ libiberty_vprintf_buffer_size (const char *format, va= _list args) > case 'u': > case 'x': > case 'X': > + switch (prec) > + { > + case 0: (void) va_arg (ap, int); break; > + case 1: (void) va_arg (ap, long int); break; > + case 2: (void) va_arg (ap, long long int); break; > + case 3: (void) va_arg (ap, size_t); break; > + case 4: (void) va_arg (ap, ptrdiff_t); break; > + } > + break; > case 'c': > (void) va_arg (ap, int); > break; > @@ -96,10 +141,18 @@ libiberty_vprintf_buffer_size (const char *format, v= a_list args) > case 'E': > case 'g': > case 'G': > - (void) va_arg (ap, double); > - /* Since an ieee double can have an exponent of 307, we'll > - make the buffer wide enough to cover the gross case. */ > - total_width +=3D 307; > + if (!prec) > + { > + (void) va_arg (ap, double); > + /* Since an ieee double can have an exponent of 308, we'll > + make the buffer wide enough to cover the gross case. */ > + total_width +=3D 308; > + } > + else > + { > + (void) va_arg (ap, long double); > + total_width +=3D 4932; > + } > break; > case 's': > total_width +=3D strlen (va_arg (ap, char *)); --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iOUEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZpDhaV8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv by5vcmcACgkQc4QJ9SDfkZDYOgEAi0IJX8wcbmGZwHnE9pivWHWaglrPHCeql8Wa G7N9CmAA/jddbZJS76B9hvA0PGmUyHUv+jdH9ZjidorPcZYvcCYG =Z5Vq -----END PGP SIGNATURE----- --=-=-=--