[PATCH] include: sync with GCC
Pietro Monteiro
pietro@sociotechnical.xyz
Sun Nov 8 19:10:22 GMT 2026
Please disregard, I typo-ed the gdb-patches mailing list address and will resend.
sorry,
pietro
On Sun, Nov 8, 2026, at 2:01 PM, Pietro Monteiro wrote:
> I copied from include in the gcc tree all common files, except for
> btf.h. I did some git archeology to get the list of commits the
> changes came from.
>
> I'm sending the patch rather than just committing to give folks time to test.
>
> pietro
> -- >8 --
> Sync the GCC files in the include/ directory with gcc commit
> aa0906b0ae8b02e2f9ad721d6b52cd97b8bce427
>
> Pull changes from the following commits:
>
> aa0906b0ae8 libiberty: Declare strto{u,}ll if at least C++11. [PR128228]
> 389b68a1b98 [PATCH 2/2] include: Parenthesize sdiv_qrnnd macro
> parameters in longlong.h
> 3b6dbfc2adb include: Fix typos in various files
> 5c821cbae4a LoongArch: C and .h files for LA32
> 9c862a593bc ctf: translate annotation DIEs to internal ctf
> e08ef05e4da [PATCH] RISC-V: Use builtin clz/ctz when
> count_leading_zeros and count_trailing_zeros is used
> 45ab93d9afa non-gcc: Remove trailing whitespace
> 9f7afa99c67 [committed] Adding missing prototype for __clzhi2 to
> xstormy port
>
> Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
> ---
> include/ctf.h | 4 ++++
> include/demangle.h | 2 +-
> include/doubly-linked-list.h | 2 +-
> include/dyn-string.h | 2 +-
> include/fibheap.h | 6 +++---
> include/floatformat.h | 2 +-
> include/gcc-cp-fe.def | 4 ++--
> include/hashtab.h | 4 ++--
> include/libcollector.h | 2 +-
> include/libiberty.h | 15 ++++++++++-----
> include/longlong.h | 27 +++++++++++++++++++--------
> include/partition.h | 2 +-
> include/plugin-api.h | 12 ++++++------
> include/safe-ctype.h | 2 +-
> include/sort.h | 6 +++---
> include/splay-tree.h | 8 ++++----
> include/symcat.h | 4 ++--
> include/vtv-change-permission.h | 6 +++---
> include/xregex.h | 2 +-
> 19 files changed, 66 insertions(+), 46 deletions(-)
>
> diff --git a/include/ctf.h b/include/ctf.h
> index e28a37d4658..02e10d7136a 100644
> --- a/include/ctf.h
> +++ b/include/ctf.h
> @@ -423,6 +423,10 @@ union
> #define CTF_K_CONST 12 /* ctt_type is base type. */
> #define CTF_K_RESTRICT 13 /* ctt_type is base type. */
> #define CTF_K_SLICE 14 /* Variant data is a ctf_slice_t. */
> +#define CTF_K_DECL_TAG 15 /* Declaration tag. Internal use only.
> + Not valid externally until CTF V4. */
> +#define CTF_K_TYPE_TAG 16 /* Type tag. Internal use only.
> + Not valid externally until CTF V4. */
>
> #define CTF_K_MAX 63 /* Maximum possible (V2) CTF_K_* value. */
>
> diff --git a/include/demangle.h b/include/demangle.h
> index e9165d6b083..db2d2f48530 100644
> --- a/include/demangle.h
> +++ b/include/demangle.h
> @@ -314,7 +314,7 @@ enum demangle_component_type
> /* C++11: An rvalue reference modifying a member function. The one
> subtree is the type which is being referenced. */
> DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS,
> - /* C++23: A member function with explict object parameter. */
> + /* C++23: A member function with explicit object parameter. */
> DEMANGLE_COMPONENT_XOBJ_MEMBER_FUNCTION,
> /* A vendor qualifier. The left subtree is the type which is being
> qualified, and the right subtree is the name of the
> diff --git a/include/doubly-linked-list.h b/include/doubly-linked-list.h
> index d46d773800b..88a6ea6530a 100644
> --- a/include/doubly-linked-list.h
> +++ b/include/doubly-linked-list.h
> @@ -64,7 +64,7 @@
> or as a whole via LINKED_LIST_MUTATIVE_OPS_PROTOTYPE for the prototypes, and
> LINKED_LIST_MUTATIVE_OPS_DECL for the implementations. */
>
> -/* Append the given node new_ to the exising list.
> +/* Append the given node new_ to the existing list.
> Precondition: prev and next of new_ must be NULL. */
> #define LINKED_LIST_APPEND(LTYPE) LTYPE##_append
>
> diff --git a/include/dyn-string.h b/include/dyn-string.h
> index f8a55a43db8..b50395e43f0 100644
> --- a/include/dyn-string.h
> +++ b/include/dyn-string.h
> @@ -3,7 +3,7 @@
> Contributed by Mark Mitchell (mark@markmitchell.com).
>
> This file is part of GCC.
> -
> +
> GCC is free software; you can redistribute it and/or modify
> it under the terms of the GNU General Public License as published by
> the Free Software Foundation; either version 2, or (at your option)
> diff --git a/include/fibheap.h b/include/fibheap.h
> index f6b92d94306..62492ca4b15 100644
> --- a/include/fibheap.h
> +++ b/include/fibheap.h
> @@ -3,7 +3,7 @@
> Contributed by Daniel Berlin (dan@cgsoftware.com).
>
> This file is part of GCC.
> -
> +
> GCC is free software; you can redistribute it and/or modify it
> under the terms of the GNU General Public License as published by
> the Free Software Foundation; either version 2, or (at your option)
> @@ -33,8 +33,8 @@ Boston, MA 02110-1301, USA. */
> Amortized and real worst case time for operations:
>
> ExtractMin: O(lg n) amortized. O(n) worst case.
> - DecreaseKey: O(1) amortized. O(lg n) worst case.
> - Insert: O(2) amortized. O(1) actual.
> + DecreaseKey: O(1) amortized. O(lg n) worst case.
> + Insert: O(2) amortized. O(1) actual.
> Union: O(1) amortized. O(1) actual. */
>
> #ifndef _FIBHEAP_H_
> diff --git a/include/floatformat.h b/include/floatformat.h
> index bf3190e805f..954033d625f 100644
> --- a/include/floatformat.h
> +++ b/include/floatformat.h
> @@ -67,7 +67,7 @@ struct floatformat
> unsigned int exp_start;
> unsigned int exp_len;
> /* Bias added to a "true" exponent to form the biased exponent. It
> - is intentionally signed as, otherwize, -exp_bias can turn into a
> + is intentionally signed as, otherwise, -exp_bias can turn into a
> very large number (e.g., given the exp_bias of 0x3fff and a 64
> bit long, the equation (long)(1 - exp_bias) evaluates to
> 4294950914) instead of -16382). */
> diff --git a/include/gcc-cp-fe.def b/include/gcc-cp-fe.def
> index b3c3c7928ca..2561b75fe1b 100644
> --- a/include/gcc-cp-fe.def
> +++ b/include/gcc-cp-fe.def
> @@ -138,7 +138,7 @@ GCC_METHOD1 (int /* bool */, push_function,
> Then, as we set up the binding context to compile a code snippet at
> point 3, we may choose to activate c_1, o_0 and p upfront,
> declaring and discarding c, c_0 and o, and then reentering the
> - funciton scope to declare c_1, o_0 and p; or we can wait for oracle
> + function scope to declare c_1, o_0 and p; or we can wait for oracle
> lookups of c, o or p. If c is looked up, and the debugger resolves
> c in the scope to c_1, it is expected to enter the function scope
> from the top level, declare c, leave it, reenter it, declare c_0,
> @@ -258,7 +258,7 @@ GCC_METHOD2 (int /* bool */, add_using_decl,
> SYM_KIND, in addition to any other applicable flags, and pass as
> NAME a string starting with the two-character mangling for operator
> name: "ps" for unary plus, "mL" for multiply and assign, *=; etc.
> - Use "cv" for type converstion operators (the target type portion
> + Use "cv" for type conversion operators (the target type portion
> may be omitted, as it is taken from the return type in SYM_TYPE).
> For operator"", use "li" followed by the identifier (the mangled
> name mandates digits specifying the length of the identifier; if
> diff --git a/include/hashtab.h b/include/hashtab.h
> index 6ff9c0c2101..4ee2858b2e4 100644
> --- a/include/hashtab.h
> +++ b/include/hashtab.h
> @@ -1,4 +1,4 @@
> -/* An expandable hash tables datatype.
> +/* An expandable hash tables datatype.
> Copyright (C) 1999-2026 Free Software Foundation, Inc.
> Contributed by Vladimir Makarov (vmakarov@cygnus.com).
>
> @@ -56,7 +56,7 @@ typedef int (*htab_eq) (const void *, const void *);
> /* Cleanup function called whenever a live element is removed from
> the hash table. */
> typedef void (*htab_del) (void *);
> -
> +
> /* Function called by htab_traverse for each live element. The first
> arg is the slot of the element (which can be passed to htab_clear_slot
> if desired), the second arg is the auxiliary pointer handed to
> diff --git a/include/libcollector.h b/include/libcollector.h
> index 7bf3269095d..59db52657b2 100644
> --- a/include/libcollector.h
> +++ b/include/libcollector.h
> @@ -75,7 +75,7 @@ extern "C"
> /* Define the macros that actually get inserted in the caller's code. */
> #define collector_sample(x) (collector_sample ? collector_sample(x), 0 : 0)
> #define collector_pause() (collector_pause ? collector_pause(), 0 : 0)
> -#define collector_resume() (collector_resume ? collector_resume(),0 : 0
> +#define collector_resume() (collector_resume ? collector_resume(),0 : 0
> #define collector_thread_pause(tid) \
> (collector_thread_pause ? collector_thread_pause(tid), 0 : 0)
> #define collector_thread_resume(tid) \
> diff --git a/include/libiberty.h b/include/libiberty.h
> index bdb491b9b37..4ed783e6ef9 100644
> --- a/include/libiberty.h
> +++ b/include/libiberty.h
> @@ -3,7 +3,7 @@
> Copyright (C) 1997-2026 Free Software Foundation, Inc.
>
> Note - certain prototypes declared in this header file are for
> - functions whoes implementation copyright does not belong to the
> + functions whose implementation copyright does not belong to the
> FSF. Those prototypes are present in this file for reference
> purposes only and their presence in this file should not construed
> as an indication of ownership by the FSF of the implementation of
> @@ -499,7 +499,7 @@ extern struct pex_obj *pex_init (int flags, const
> char *pname,
> /* Append stdout to existing file instead of truncating it. */
> #define PEX_STDOUT_APPEND 0x100
>
> -/* Thes same as PEX_STDOUT_APPEND, but for STDERR. */
> +/* The same as PEX_STDOUT_APPEND, but for STDERR. */
> #define PEX_STDERR_APPEND 0x200
>
> /* Execute one program. Returns NULL on success. On error returns an
> @@ -728,16 +728,21 @@ extern unsigned long int strtoul (const char *nptr,
> char **endptr, int base);
> #endif
>
> -#if defined(HAVE_LONG_LONG) && defined(HAVE_DECL_STRTOLL) && !HAVE_DECL_STRTOLL
> +/* hppa64-hp-hpux11.11 GCC bootstrap pass with this and
> + declare strto{u,}ll if at least C++11. */
> +#if (defined(HAVE_LONG_LONG) \
> + || (defined(__cplusplus) && __cplusplus >= 201103L))
> +# if defined(HAVE_DECL_STRTOLL) && !HAVE_DECL_STRTOLL
> __extension__
> extern long long int strtoll (const char *nptr,
> char **endptr, int base);
> -#endif
> +# endif
>
> -#if defined(HAVE_LONG_LONG) && defined(HAVE_DECL_STRTOULL) &&
> !HAVE_DECL_STRTOULL
> +# if defined(HAVE_DECL_STRTOULL) && !HAVE_DECL_STRTOULL
> __extension__
> extern unsigned long long int strtoull (const char *nptr,
> char **endptr, int base);
> +# endif
> #endif
>
> /* Set the title of a process */
> diff --git a/include/longlong.h b/include/longlong.h
> index 2e50270d46b..5f44c1c6a01 100644
> --- a/include/longlong.h
> +++ b/include/longlong.h
> @@ -422,7 +422,7 @@ extern UDItype __umulsidi3 (USItype, USItype);
> union {DItype __ll; \
> struct {USItype __h, __l;} __i; \
> } __x; \
> - __x.__i.__h = n1; __x.__i.__l = n0; \
> + __x.__i.__h = (n1); __x.__i.__l = (n0); \
> __asm__ ("dr %0,%2" \
> : "=r" (__x.__ll) \
> : "0" (__x.__ll), "r" (d)); \
> @@ -594,11 +594,7 @@ extern UDItype __umulsidi3 (USItype, USItype);
> #endif
>
> #ifdef __loongarch__
> -# if W_TYPE_SIZE == 32
> -# define count_leading_zeros(count, x) ((count) = __builtin_clz (x))
> -# define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x))
> -# define COUNT_LEADING_ZEROS_0 32
> -# elif W_TYPE_SIZE == 64
> +# if W_TYPE_SIZE == 64
> # define count_leading_zeros(count, x) ((count) = __builtin_clzll (x))
> # define count_trailing_zeros(count, x) ((count) = __builtin_ctzll (x))
> # define COUNT_LEADING_ZEROS_0 64
> @@ -1065,6 +1061,20 @@ extern UDItype __umulsidi3 (USItype, USItype);
> #endif
>
> #if defined(__riscv)
> +
> +#ifdef __riscv_zbb
> +#if W_TYPE_SIZE == 32
> +#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
> +#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X))
> +#define COUNT_LEADING_ZEROS_0 32
> +#endif /* W_TYPE_SIZE == 32 */
> +#if W_TYPE_SIZE == 64
> +#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clzll (X))
> +#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctzll (X))
> +#define COUNT_LEADING_ZEROS_0 64
> +#endif /* W_TYPE_SIZE == 64 */
> +#endif /* __riscv_zbb */
> +
> #ifdef __riscv_mul
> #define __umulsidi3(u,v) ((UDWtype)(UWtype)(u) * (UWtype)(v))
> #define __muluw3(a, b) ((UWtype)(a) * (UWtype)(b))
> @@ -1074,7 +1084,7 @@ extern UDItype __umulsidi3 (USItype, USItype);
> #elif __riscv_xlen == 64
> #define MULUW3 "call __muldi3"
> #else
> -#error unsupport xlen
> +#error unsupported xlen
> #endif /* __riscv_xlen */
> /* We rely on the fact that MULUW3 doesn't clobber the t-registers.
> It can get better register allocation result. */
> @@ -1508,7 +1518,7 @@ extern UDItype __umulsidi3 (USItype, USItype);
> union {DItype __ll; \
> struct {SItype __l, __h;} __i; \
> } __xx; \
> - __xx.__i.__h = n1; __xx.__i.__l = n0; \
> + __xx.__i.__h = (n1); __xx.__i.__l = (n0); \
> __asm__ ("ediv %3,%2,%0,%1" \
> : "=g" (q), "=g" (r) \
> : "g" (__xx.__ll), "g" (d)); \
> @@ -1573,6 +1583,7 @@ extern UHItype __stormy16_count_leading_zeros (UHItype);
> for ((count) = 0, size = W_TYPE_SIZE; size; size -= 16) \
> { \
> UHItype c; \
> + extern UHItype __clzhi2 (UHItype); \
> \
> c = __clzhi2 ((x) >> (size - 16)); \
> (count) += c; \
> diff --git a/include/partition.h b/include/partition.h
> index 45849cb604d..64cc55f39ed 100644
> --- a/include/partition.h
> +++ b/include/partition.h
> @@ -56,7 +56,7 @@ struct partition_elem
> unsigned class_count;
> };
>
> -typedef struct partition_def
> +typedef struct partition_def
> {
> /* The number of elements in this partition. */
> int num_elements;
> diff --git a/include/plugin-api.h b/include/plugin-api.h
> index fec2e7f126f..60936228acd 100644
> --- a/include/plugin-api.h
> +++ b/include/plugin-api.h
> @@ -37,7 +37,7 @@
> #error cannot find uint64_t type
> #endif
>
> -/* Detect endianess based on gcc's (>=4.6.0) __BYTE_ORDER__ macro. */
> +/* Detect endianness based on gcc's (>=4.6.0) __BYTE_ORDER__ macro. */
> #if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
> defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_PDP_ENDIAN__)
> #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> @@ -64,7 +64,7 @@
> #include <machine/endian.h>
> #endif
>
> -/* Detect endianess based on __BYTE_ORDER. */
> +/* Detect endianness based on __BYTE_ORDER. */
> #ifdef __BYTE_ORDER
> #if __BYTE_ORDER == __LITTLE_ENDIAN
> #define PLUGIN_LITTLE_ENDIAN 1
> @@ -72,7 +72,7 @@
> #define PLUGIN_BIG_ENDIAN 1
> #endif
>
> -/* Detect endianess based on _BYTE_ORDER. */
> +/* Detect endianness based on _BYTE_ORDER. */
> #elif defined _BYTE_ORDER
> #if _BYTE_ORDER == _LITTLE_ENDIAN
> #define PLUGIN_LITTLE_ENDIAN 1
> @@ -160,7 +160,7 @@ struct ld_plugin_symbol
> char unused;
> char section_kind;
> #else
> -#error "Could not detect architecture endianess"
> +#error "Could not detect architecture endianness"
> #endif
> int visibility;
> uint64_t size;
> @@ -403,7 +403,7 @@ enum ld_plugin_status
> size_t* len);
>
> /* The linker's interface for specifying the desired order of sections.
> - The sections should be specifed using the array SECTION_LIST in the
> + The sections should be specified using the array SECTION_LIST in the
> order in which they should appear in the final layout. NUM_SECTIONS
> specifies the number of entries in each array. This should be
> invoked
> in the all_symbols_read handler. */
> @@ -599,7 +599,7 @@ struct ld_plugin_tv
> ld_plugin_get_input_section_contents tv_get_input_section_contents;
> ld_plugin_update_section_order tv_update_section_order;
> ld_plugin_allow_section_ordering tv_allow_section_ordering;
> - ld_plugin_allow_unique_segment_for_sections
> tv_allow_unique_segment_for_sections;
> + ld_plugin_allow_unique_segment_for_sections
> tv_allow_unique_segment_for_sections;
> ld_plugin_unique_segment_for_sections
> tv_unique_segment_for_sections;
> ld_plugin_get_input_section_alignment
> tv_get_input_section_alignment;
> ld_plugin_get_input_section_size tv_get_input_section_size;
> diff --git a/include/safe-ctype.h b/include/safe-ctype.h
> index d5abf5128db..66de4329b21 100644
> --- a/include/safe-ctype.h
> +++ b/include/safe-ctype.h
> @@ -112,7 +112,7 @@ extern const unsigned char _sch_tolower[256];
> #define TOUPPER(c) _sch_toupper[(c) & 0xff]
> #define TOLOWER(c) _sch_tolower[(c) & 0xff]
>
> -/* Prevent the users of safe-ctype.h from accidently using the routines
> +/* Prevent the users of safe-ctype.h from accidentally using the routines
> from ctype.h. Initially, the approach was to produce an error when
> detecting that ctype.h has been included. But this was causing
> trouble as ctype.h might get indirectly included as a result of
> diff --git a/include/sort.h b/include/sort.h
> index 1062b889437..fca32b1a274 100644
> --- a/include/sort.h
> +++ b/include/sort.h
> @@ -3,7 +3,7 @@
> Contributed by Mark Mitchell <mark@codesourcery.com>.
>
> This file is part of GCC.
> -
> +
> GCC is free software; you can redistribute it and/or modify it
> under the terms of the GNU General Public License as published by
> the Free Software Foundation; either version 2, or (at your option)
> @@ -44,5 +44,5 @@ extern void sort_pointers (size_t, void **, void **);
> #endif /* SORT_H */
>
>
> -
> -
> +
> +
> diff --git a/include/splay-tree.h b/include/splay-tree.h
> index 81e46525ed9..19890ade9eb 100644
> --- a/include/splay-tree.h
> +++ b/include/splay-tree.h
> @@ -1,9 +1,9 @@
> -/* A splay-tree datatype.
> +/* A splay-tree datatype.
> Copyright (C) 1998-2026 Free Software Foundation, Inc.
> Contributed by Mark Mitchell (mark@markmitchell.com).
>
> This file is part of GCC.
> -
> +
> GCC is free software; you can redistribute it and/or modify it
> under the terms of the GNU General Public License as published by
> the Free Software Foundation; either version 2, or (at your option)
> @@ -22,7 +22,7 @@
> /* For an easily readable description of splay-trees, see:
>
> Lewis, Harry R. and Denenberg, Larry. Data Structures and Their
> - Algorithms. Harper-Collins, Inc. 1991.
> + Algorithms. Harper-Collins, Inc. 1991.
>
> The major feature of splay trees is that all basic tree operations
> are amortized O(log n) time for a tree with n nodes. */
> @@ -105,7 +105,7 @@ struct splay_tree_s {
> /* The root of the tree. */
> splay_tree_node root;
>
> - /* The comparision function. */
> + /* The comparison function. */
> splay_tree_compare_fn comp;
>
> /* The deallocate-key function. NULL if no cleanup is necessary. */
> diff --git a/include/symcat.h b/include/symcat.h
> index c75fab29a07..203b341404d 100644
> --- a/include/symcat.h
> +++ b/include/symcat.h
> @@ -11,7 +11,7 @@
> but WITHOUT ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> GNU General Public License for more details.
> -
> +
> You should have received a copy of the GNU General Public License along
> with this program; if not, write to the Free Software Foundation, Inc.,
> 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
> @@ -50,6 +50,6 @@
> bar", "XSTRING(foo)", to yield "bar". Be aware that this only
> works for __STDC__, not for traditional C which will still resolve
> to "foo". */
> -#define XSTRING(s) STRINGX(s)
> +#define XSTRING(s) STRINGX(s)
>
> #endif /* SYM_CAT_H */
> diff --git a/include/vtv-change-permission.h b/include/vtv-change-permission.h
> index a267bd07276..1a971124f58 100644
> --- a/include/vtv-change-permission.h
> +++ b/include/vtv-change-permission.h
> @@ -1,7 +1,7 @@
> /* Copyright (C) 2013-2026 Free Software Foundation, Inc.
> -
> +
> This file is part of GCC.
> -
> +
> modify it under the terms of the GNU Library General Public License
> as published by the Free Software Foundation; either version 2, or
> (at your option) any later version.
> @@ -45,7 +45,7 @@ extern void __VLTChangePermission (int);
> #ifdef BIG_PAGE_SIZE
> /* TODO - Replace '4096' below with correct big page size. */
> #define VTV_PAGE_SIZE 4096
> -#else
> +#else
> #if defined(__sun__) && defined(__svr4__) && defined(__sparc__)
> #define VTV_PAGE_SIZE 8192
> #elif defined(__loongarch_lp64)
> diff --git a/include/xregex.h b/include/xregex.h
> index 4c5ef934556..b5de00af4bb 100644
> --- a/include/xregex.h
> +++ b/include/xregex.h
> @@ -4,7 +4,7 @@
> #ifndef _XREGEX_H
> #define _XREGEX_H 1
>
> -# define regfree xregfree
> +# define regfree xregfree
> # define regexec xregexec
> # define regcomp xregcomp
> # define regerror xregerror
> --
> 2.56.0
More information about the Binutils
mailing list