1441 Commits

Author SHA1 Message Date
GCC Administrator
efc76a7f33 Daily bump. 2026-02-13 00:16:32 +00:00
LIU Hao
25c18a03de libiberty: Preserve errno across calls to libiberty_vprintf_buffer_size()
The MSVCRT `strtoul()` function resets `errno` to zero upon success. On such
a system, `libiberty_vprintf_buffer_size()` could clobber `errno` like this:

   MINGW64 ~
   $ ld nonexistent.file
   C:\MSYS64\mingw64\bin\ld.exe: cannot find nonexistent.file: No error

libiberty/ChangeLog:

	* vprintf-support.c (do_strtoul): New function.
	(libiberty_vprintf_buffer_size): Replace `strtoul` with `do_strtoul`.

Signed-off-by: LIU Hao <lh_mouse@126.com>
2026-02-12 15:23:12 +00:00
GCC Administrator
adaeecb1f5 Daily bump. 2026-02-06 00:16:39 +00:00
Matthieu Longo
7722c043f0 libiberty: add helper to swap doubly-linked list wrappers
This patch introduces a new helper to swap the contents of two
doubly-linked list wrappers. The new *_swap_lists operation exchanges
the first, last, and size fields, allowing two lists to be swapped
efficiently without iterating over their elements.

This helper is intended for cases where the ownership of a list must be
exchanged but swapping wrapper pointers is not possible. For simple
references to lists, when wrappers are dynamically allocated, swapping
the wrapper pointers themselves is sufficient and remains the preferred
approach.

This change adds the necessary declaration and definition macros to
doubly-linked-list.h and integrates them into the set of mutative
list operations.

The testsuite is updated accordingly to cover the new functionality.

include/ChangeLog:

	* doubly-linked-list.h
	(LINKED_LIST_SWAP_LISTS): Add new helper.
	(LINKED_LIST_DECL_SWAP_LISTS): Likewise.
	(LINKED_LIST_DEFN_SWAP_LISTS): Likewise.
	(LWRAPPERTYPE##_swap_lists): Likewise.

libiberty/ChangeLog:

	* testsuite/test-doubly-linked-list.c: Update.
2026-02-05 15:35:03 +00:00
GCC Administrator
7c3584be8c Daily bump. 2026-01-13 00:16:32 +00:00
Maciej W. Rozycki
0c775dcf3e libiberty: Make objalloc_free' free'-like WRT null pointer
Inspired by a suggestion from Jan Beulich to make one of `objalloc_free'
callers `free'-like with respect to null pointer argument handling make
the function return with no action taken rather than crashing when such
a pointer is passed.  This is to make the API consistent with ISO C and
to relieve all the callers from having to check for a null pointer.

	libiberty/
	* objalloc.c (objalloc_free): Don't use the pointer passed if
	null.
2026-01-12 13:08:28 +00:00
GCC Administrator
1f7e64d56b Daily bump. 2026-01-10 00:16:49 +00:00
Jan Beulich
07df546fb9 libiberty/testsuite: make test-pexecute's -t option a little more useful
Printing the program name twice doesn't really provide much value.

libiberty/

	* testsuite/test-pexecute.c (main): Adjust a tracing fprintf().
2026-01-09 08:30:58 +01:00
Jakub Jelinek
254a858ae7 Update copyright years. 2026-01-02 09:56:11 +01:00
GCC Administrator
3b30d09ac7 Daily bump. 2025-12-01 00:16:36 +00:00
Jose E. Marchesi
0fdf9b30c6 a68: darwin specific support
This commit:

- Adapts specs in config/darwin.h for libga68.a.

- Amends section processing for non-LTO use in libibery on Darwin.

  The initial implementation of the Mach-O simple object code was
  mainly targeting LTO cases.  The implementation was not suitable for
  cases where we are just looking for a regular named section.

Signed-off-by: Iain Sandoe <iains.gcc@gmail.com>

gcc/ChangeLog

	* config/darwin.h: Adapt specs for libga68.a.

libiberty/ChangeLog:

	* simple-object-mach-o.c
	(simple_object_mach_o_segment): Handle non-LTO sections.
2025-11-30 01:52:26 +01:00
GCC Administrator
29ea6d141e Daily bump. 2025-11-07 00:20:18 +00:00
Peter Damianov
f401c2b735 libiberty: Add BigObj COFF support for LTO on Windows targets [PR122472]
This patch adds support for the BigObj COFF object file format to libiberty's
simple-object-coff.c. BigObj extends regular COFF to support a 32-bit section
count.

BigObj differs from COFF in a few ways:

* A different header structure
* 32-bit section counts instead of 16-bit
* 32-bit symbol section numbers instead of 16-bit
* 20-byte symbols instead of 18-byte symbols
  (due to the extended section numbers)

For a more detailed summary, read my blog post on this subject:
https://peter0x44.github.io/posts/bigobj_format_explained/

libiberty/ChangeLog:

	PR target/122472
	* simple-object-coff.c (struct external_filehdr_bigobj): New
	structure for BigObj file header.
	(bigobj_magic): New constant for BigObj magic bytes.
	(struct external_syment_bigobj): New structure for BigObj
	20-byte symbol table entries.
	(union external_auxent_bigobj): New union for BigObj 20-byte
	auxiliary symbol entries.
	(struct simple_object_coff_read): Add is_bigobj flag and make
	nscns 32-bit to support both formats.
	(struct simple_object_coff_attributes): Add is_bigobj flag.
	(simple_object_coff_match): Add BigObj format detection.
	(simple_object_coff_read_strtab): Use format-specific symbol
	size when calculating string table offset.
	(simple_object_coff_attributes_merge): Check is_bigobj flag.
	(simple_object_coff_write_filehdr_bigobj): New function.
	(simple_object_coff_write_to_file): Add logic for writing
	BigObj vs regular COFF format with appropriate symbol
	and auxiliary entry structures.

Signed-off-by: Peter Damianov <peter0x44@disroot.org>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
2025-11-06 11:02:13 +00:00
GCC Administrator
0e9ccae269 Daily bump. 2025-11-04 00:20:26 +00:00
Sam James
f8bb20167f gcc: sync top-level with binutils-gdb
This just pulls in Alan's:

commit 87b6078fc212ccba5f043399c6370ee20f6b355a
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Mon Nov 3 10:59:50 2025 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Mon Nov 3 10:59:50 2025 +1030

    tidy m4 plugin config support

    ...

It tidies up the configure test output.

config/ChangeLog:

	* clang-plugin.m4: Sync with binutils.
	* gcc-plugin.m4: Ditto.

ChangeLog:

	* configure: Regenerate.

gcc/ChangeLog:

	* configure: Regenerate.

libatomic/ChangeLog:

	* configure: Regenerate.

libbacktrace/ChangeLog:

	* configure: Regenerate.

libcc1/ChangeLog:

	* configure: Regenerate.

libffi/ChangeLog:

	* configure: Regenerate.

libgcobol/ChangeLog:

	* configure: Regenerate.

libgfortran/ChangeLog:

	* configure: Regenerate.

libgm2/ChangeLog:

	* configure: Regenerate.

libgomp/ChangeLog:

	* configure: Regenerate.

libgrust/ChangeLog:

	* configure: Regenerate.

libiberty/ChangeLog:

	* configure: Regenerate.

libitm/ChangeLog:

	* configure: Regenerate.

libobjc/ChangeLog:

	* configure: Regenerate.

libphobos/ChangeLog:

	* configure: Regenerate.

libquadmath/ChangeLog:

	* configure: Regenerate.

libsanitizer/ChangeLog:

	* configure: Regenerate.

libssp/ChangeLog:

	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* configure: Regenerate.

libvtv/ChangeLog:

	* configure: Regenerate.

lto-plugin/ChangeLog:

	* configure: Regenerate.

zlib/ChangeLog:

	* configure: Regenerate.
2025-11-03 20:25:00 +00:00
GCC Administrator
7f57e04ce4 Daily bump. 2025-10-05 16:50:51 +00:00
H.J. Lu
6051a849aa Sync toplevel files from binutils-gdb
commit aef88b83384976e96a8fb287a001588a2277ecd5
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Oct 2 08:53:45 2025 +0800

    binutils/GCC: Quote ${COMPILER_FOR_TARGET}

    Replace

    if test x${COMPILER_FOR_TARGET} = x"\$(CC)"; then

    with

    if test x"${COMPILER_FOR_TARGET}" = x"\$(CC)"; then

    since COMPILER_FOR_TARGET may contain spaces when configuring GCC.

commit 76a693c087c30e8108852928c717399011c6166d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Sep 30 11:23:58 2025 +0800

    binutils: Use AC_TRY_COMPILE to check target clang/gcc

    Use AC_TRY_COMPILE to check for the working target clang and gcc when
    configuring for cross tools.

commit 77c74294bfc5005204a2de3cc64bbdb2f877be29
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Sep 26 08:03:01 2025 +0800

    binutils: Pass target plugin file to target ar/nm/ranlib

    There are 2 kinds of binutils tests:

    1. Tests of binutils object files and libraries using the build tools,
    like CC, AR, NM and RANLIB.
    2. Tests of binutils programs as the target tools, like CC_FOR_TARGET,
    AR_FOR_TARGET, NM_FOR_TARGET and RANLIB_FOR_TARGET.

    Set AR_PLUGIN_OPTION_FOR_TARGET, NM_PLUGIN_OPTION_FOR_TARGET and
    RANLIB_PLUGIN_OPTION_FOR_TARGET to the target compiler plugin file for
    target ar/nm/ranlib.

commit 10deea6e2fc1b9ec5818b5fa1bc510c63ff5b2e2
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Sep 23 04:24:00 2025 +0800

    Binutils/GCC: Add clang LTO support to AR, NM and RANLIB

    Add CLANG_PLUGIN_FILE to find the clang plugin file and pass it to
    --plugin for ar, nm and ranlib so that binutils can be built with
    clang LTO.  Run CLANG_PLUGIN_FILE before GCC_PLUGIN_OPTION since
    GCC_PLUGIN_OPTION may return the wrong PLUGIN_OPTION with clang.

commit 1fcb94ed750db2ac30d0f0ecc04fa0c7833dd10f
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date:   Thu Sep 18 16:17:14 2025 +0200

    Remove remnants of Solaris/PowerPC support

    When removing Solaris/PowerPC support, I missed a couple of references.
    This patch removes them.

    Tested with crosses to ppc-unknown-linux-gnu and powerpc-ibm-aix7.

ChangeLog:

	* Makefile.in: Regenerated.
	* configure: Likewise.
	* Makefile.tpl: Synced from binutils-gdb.
	* configure.ac: Likewise.
	* libtool.m4: Likewise.

config/ChangeLog:

	* clang-plugin.m4: Synced from binutils-gdb.
	* gcc-plugin.m4: Likewise.

libbacktrace/ChangeLog:

	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.

libiberty/ChangeLog:

	* aclocal.m4: Regenerated.
	* configure: Likewise.
	* configure.ac: Synced from binutils-gdb.

zlib/ChangeLog:

	* Makefile.in: Regenerated.
	* aclocal.m4: Likewise.
	* configure: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-10-02 15:00:06 +08:00
GCC Administrator
b42c5ee445 Daily bump. 2025-08-17 00:19:17 +00:00
Nathaniel Shead
7921bb4afc c++: Implement P2115R0 linkage changes for unnamed unscoped enums [PR120503]
We currently list P2115R0 as implemented, but only the modules changes
had been done.  This patch implements the linkage changes so that
unnamed unscoped enums will use the name of the first enumerator for
linkage purposes.

This is (strictly speaking) a breaking change, as code that previously
relied on unnamed enumerations being internal linkage may have overloads
using those types become exposed and clash with other functions in a
different TU that have been similarly exposed.  As such this feature is
only implemented for C++20.

No ABI flag warning is provided, partly because C++20 is still an
experimental standard, but also because any affected functions could not
have been part of an ABI until this change anyway.

A number of testcases that are testing for behaviour of no-linkage types
are adjusted to use an enumeration with no values, so that the pre-C++20
and post-C++20 behaviour is equivalently tested.

In terms of implementation, I had originally considered adjusting the
DECL_NAME of the enum, as with 'name_unnamed_type', but this ended up
being more complicated as it had unwanted interactions with the existing
modules streaming and with name lookup and diagnostic messages.  This
patch instead uses a new function to derive this case.

The standard says that ([dcl.enum] p11) such an enum "...is denoted, for
linkage purposes, by its underlying type and its first enumerator", so
we need to add a new mangling production as well to handle this.

	PR c++/120503
	PR c++/120824

gcc/cp/ChangeLog:

	* cp-tree.h (TYPE_UNNAMED_P): Adjust for enums with enumerators
	for linkage purposes.
	(enum_with_enumerator_for_linkage_p): Declare.
	* decl.cc (name_unnamed_type): Adjust assertions to handle enums
	with enumerators for linkage purposes.
	(grokdeclarator): Use a typedef name for enums with enumerators
	for linkage purposes.
	(enum_with_enumerator_for_linkage_p): New function.
	(finish_enum_value_list): Reset type linkage for enums with
	enumerators for linkage purposes.
	* mangle.cc (write_unnamed_enum_name): New function.
	(write_unqualified_name): Handle enums with enumerators for
	linkage purposes.
	* tree.cc (decl_linkage): Fixup unnamed enums.

gcc/testsuite/ChangeLog:

	* g++.dg/abi/mangle32.C: Remove enumerator list.
	* g++.dg/cpp0x/linkage2.C: Likewise.
	* g++.dg/ext/vector26.C: Likewise.
	* g++.dg/other/anon3.C: Likewise.
	* g++.dg/abi/mangle83.C: New test.
	* g++.dg/modules/enum-15_a.C: New test.
	* g++.dg/modules/enum-15_b.C: New test.

include/ChangeLog:

	* demangle.h (enum demangle_component_type): Add enumeration
	DEMANGLE_COMPONENT_UNNAMED_ENUM.

libiberty/ChangeLog:

	* cp-demangle.c (d_unnamed_enum): New function.
	(d_unqualified_name): Call it.
	(cplus_demangle_type): Handle unscoped unnamed types
	(Ue, Ul, etc.)
	(d_count_templates_scopes): Handle unnamed enums.
	(d_find_pack): Likewise.
	(d_print_comp_inner): Print unnamed enums.
	* testsuite/demangle-expected: Add tests.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
2025-08-17 10:14:14 +10:00
GCC Administrator
6520bb9efb Daily bump. 2025-08-14 00:20:55 +00:00
Jakub Jelinek
0f665822a0 libiberty: Fix comment typo
This patch fixes a comment typo, whaever -> whatever, prompted by the
recent hae -> has typo fix.

2025-08-13  Jakub Jelinek  <jakub@redhat.com>

	* cp-demangle.c (d_encoding): Fix a comment typo, whaever -> whatever.
2025-08-13 22:26:54 +02:00
GCC Administrator
ca2169c65b Daily bump. 2025-08-07 00:20:46 +00:00
Matthieu Longo
0d0837df69 libiberty: disable logging of list content for doubly-linked list tests
When the doubly-linked list tests were introduced, the tests were
printing the content of the list forward and backward. However, this
printing is not needed outside of debugging, and confuses people because
the output is not only composed of PASS: lines.

This patch disables the printing of the list content by default. If
one wants to re-enable it for debugging, he can set the macro DUMP_LIST
to 1.

libiberty/ChangeLog:

	* testsuite/test-doubly-linked-list.c: disable debug logging on
	stdout.
2025-08-06 15:25:22 +01:00
GCC Administrator
285422c70e Daily bump. 2025-07-10 00:20:18 +00:00
Matthieu Longo
0fd98b6f9f libiberty: add routines to handle type-sensitive doubly linked lists
Those methods's implementation is relying on duck-typing at compile
time.
The structure corresponding to the node of a doubly linked list needs
to define attributes 'prev' and 'next' which are pointers on the type
of a node.
The structure wrapping the nodes and others metadata (first, last, size)
needs to define pointers 'first', and 'last' of the node's type, and
an integer type for 'size'.

Mutative methods can be bundled together and be declarable once via a
same macro, or can be declared separately. The merge sort is bundled
separately.
There are 3 types of macros:
1. for the declaration of prototypes: to use in a header file for a
   public declaration, or as a forward declaration in the source file
   for private declaration.
2. for the declaration of the implementation: to use always in a
   source file.
3. for the invocation of the functions.

The methods can be declared either public or private via the second
argument of the declaration macros.

List of currently implemented methods:
- LINKED_LIST_*:
    - APPEND: insert a node at the end of the list.
    - PREPEND: insert a node at the beginning of the list.
    - INSERT_BEFORE: insert a node before the given node.
    - POP_FRONT: remove the first node of the list.
    - POP_BACK: remove the last node of the list.
    - REMOVE: remove the given node from the list.
    - SWAP: swap the two given nodes in the list.
- LINKED_LIST_MERGE_SORT: a merge sort implementation.

include/ChangeLog:

	* doubly-linked-list.h: New file.

libiberty/ChangeLog:

	* Makefile.in: Add new header.
	* testsuite/Makefile.in: Add new test.
	* testsuite/test-doubly-linked-list.c: New test.
2025-07-09 16:15:55 +01:00
GCC Administrator
92430eec52 Daily bump. 2025-05-14 00:18:21 +00:00
Andreas Schwab
43717ee906 libiberty: Fix off-by-one when collecting range expression
Fixes this error during build of fixincludes:

In function ‘byte_regex_compile’,
    inlined from ‘xregcomp’ at ../libiberty/../../libiberty/regex.c:7973:11:
../libiberty/../../libiberty/regex.c:3477:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
 3477 |                     str[c1] = '\0';
      |                             ^
../libiberty/../../libiberty/regex.c: In function ‘xregcomp’:
../libiberty/../../libiberty/regex.c:3454:35: note: at offset 128 into destination object ‘str’ of size 128
 3454 |                     unsigned char str[128];     /* Should be large enough.  */
      |                                   ^

	* regex.c (regex_compile): Don't write beyond array bounds when
	collecting range expression.
2025-05-13 09:51:49 +02:00
GCC Administrator
cc63163f0a Daily bump. 2025-03-30 00:16:46 +00:00
Iain Sandoe
9018336252 libiberty, gcc: Add memrchr to libiberty and use it [PR119283].
This adds an implementation of memrchr to libiberty and arranges
to configure gcc to use it, if the host does not have it.

	PR cobol/119283

gcc/ChangeLog:

	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for host memrchr.

include/ChangeLog:

	* libiberty.h (memrchr): New.

libiberty/ChangeLog:

	* Makefile.in: Add memrchr build rules.
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Check for memrchr.
	* functions.texi: Document memrchr.
	* memrchr.c: New file.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-29 13:53:22 +00:00
GCC Administrator
7d414e11ac Daily bump. 2025-03-26 00:17:07 +00:00
Iain Sandoe
f3d07779fd libiberty: Append <libgen.h> to AC_CHECK_DECLS [PR119218].
Darwin and Solaris, at least, provide basename() in libc, but only
declare it in <libgen.h>.  That library is not one of the set in
AC_INCLUDES_DEFAULT and so we fail the config test and fall back
to the libiberty-provided version.  In itself, this is not an
issue; however, if we include <libgen.h> and libiberty.h in the same
TU we do then get a decl conflict.

	PR other/119218

libiberty/ChangeLog:

	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Append <libgen.h> to AC_INCLUDES_DEFAULT
	when checking for the 'basename' decl.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
2025-03-25 19:29:12 +00:00
GCC Administrator
a03e863975 Daily bump. 2025-03-19 00:17:56 +00:00
Jose E. Marchesi
31dd621796 libiberty: add ldirname function
This patch adds a function ldirname to libiberty.  It is implemented
in terms of lbasename.  Basically, given a given pathname, the dirname
part is what is not the basename minus the last directory separator
separating the dirname with the basename.

include/ChangeLog

	* libiberty.h (ldirname): New function declaration.
	(dos_ldirname): Likewise.
	(unix_ldirname): Likewise.

libiberty/ChangeLog

	* ldirname.c: New file.
	* Makefile.in (CFILES): Add ldirname.c.
	(REQUIRED_OFILES): Add ldirname.$(objext).
	(./ldirname.$(objext)): New rule.
	* makefile.vms (OBJS): Add ldirname.obj.
	* configure.com (FILES): Add ldirname.
2025-03-18 11:19:48 +01:00
Jakub Jelinek
6441eb6dc0 Update copyright years. 2025-01-02 11:59:57 +01:00
GCC Administrator
24822c0942 Daily bump. 2024-12-12 00:19:00 +00:00
Matthieu Longo
f78b4da602 autoupdate: replace obsolete macros in libiberty
Autoreconf-2.72 warns about obsolete macros. This patch aims at removing
the noise from a future upgrade to autoreconf-2.72 or later. This is in
no a way a complete patch allowing the upgrade to autoreconf-2.72.

- AC_GNU_SOURCE by AC_USE_SYSTEM_EXTENSIONS
  https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/
  autoconf.html#index-AC_005fGNU_005fSOURCE-1
- AC_CONFIG_HEADER by AC_CONFIG_HEADERS
  https://www.gnu.org/software/automake/manual/1.12.2/html_node/Obsolete-
  Macros.html#index-AM_005fCONFIG_005fHEADER

Those fixes were originally submitted in a patch series in binutils.
https://inbox.sourceware.org/binutils/878qthm6a0.fsf@gentoo.org/

libiberty/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Fix autoupdate warnings.
2024-12-11 11:17:01 +00:00
Sangamesh Mallayya
e76df35864 aix: Resolve build failure with default C23
libiberty/getopt.c file is defining _NO_PROTO, which causes
conflicting declarations for the functions in AIX header files
like stdio.h & stdlib.h.
Looks like _NO_PROTO define were added long back and conflicting
declarations were always present until C23 standard uncovered it.

Remove the block defining _NO_PROTO as both Tru64 UNIX (ex-OSF/1)
and AIX 3.2 is no more supported.

libiberty/ChangeLog:

	* getopt.c: Remove _NO_PROTO block
2024-12-11 03:54:50 -06:00
GCC Administrator
b597edbdfb Daily bump. 2024-11-20 00:19:59 +00:00
Evgeny Karpov
961c504109 Add LTO support
The patch reuses the configuration for LTO from ix86 and adds the
aarch64 architecture to the list of supported COFF headers.

gcc/ChangeLog:

	* config/aarch64/cygming.h (TARGET_ASM_LTO_START): New.
	(TARGET_ASM_LTO_END): Likewise.
	* config/i386/cygming.h (TARGET_ASM_LTO_START): Update.
	(TARGET_ASM_LTO_END): Likewise.
	* config/i386/i386-protos.h (i386_pe_asm_lto_start): Delete.
	(i386_pe_asm_lto_end): Likewise.
	* config/mingw/winnt.cc (i386_pe_asm_lto_start): Rename
	into ...
	(mingw_pe_asm_lto_start): ... this.
	(i386_pe_asm_lto_end): Rename into ...
	(mingw_pe_asm_lto_end): ... this.
	* config/mingw/winnt.h (mingw_pe_asm_lto_start): New.
	(mingw_pe_asm_lto_end): Likewise.

libiberty/ChangeLog:

	* simple-object-coff.c: Add aarch64.
2024-11-19 14:27:33 +01:00
GCC Administrator
a649efea00 Daily bump. 2024-11-17 00:21:19 +00:00
Andrew Pinski
94bea5dd6c libiberity: ANSIfy test-demangle.c
Some of the function definitions used K&R style definitions (but not all).
This just moves them all to be ANSI C

Bootstrapped and tested on x86_64-linux-gnu.

libiberty/ChangeLog:

	* testsuite/test-demangle.c (get_line): Change K&R style
	definition into ANSI C90 definitions.
	(fail): Likewise.
	(main): Likewise.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
2024-11-16 11:10:48 -08:00
GCC Administrator
441676b588 Daily bump. 2024-11-02 00:19:21 +00:00
Mark Wielaard
aa84020b2e libiberty: Fix comment typos
These comment typos were found in the valgrind fork of libiberty
demangle code.

libiberty/ChangeLog:

	* cplus-dem.c: Change preceeded to preceded.

include/ChangeLog:

	* safe-ctype.h: Change accidently to accidentally.
2024-10-31 22:07:18 +01:00
GCC Administrator
ccd7ede939 Daily bump. 2024-10-11 00:17:48 +00:00
Simon Martin
c1b2100e73 libiberty: Restore build with CP_DEMANGLE_DEBUG defined
cp-demangle.c does not build when CP_DEMANGLE_DEBUG is defined since
r13-2887-gb04208895fed34. This trivial patch fixes the issue.

libiberty/ChangeLog:

	* cp-demangle.c (d_dump): Fix compilation when CP_DEMANGLE_DEBUG
	is defined.
2024-10-10 15:59:38 +02:00
GCC Administrator
bfb9105ffb Daily bump. 2024-09-08 00:17:46 +00:00
Jakub Jelinek
bb8dd0980b libiberty: Fix up > 64K section handling in simple_object_elf_copy_lto_debug_section [PR116614]
cat abc.C
  #define A(n) struct T##n {} t##n;
  #define B(n) A(n##0) A(n##1) A(n##2) A(n##3) A(n##4) A(n##5) A(n##6) A(n##7) A(n##8) A(n##9)
  #define C(n) B(n##0) B(n##1) B(n##2) B(n##3) B(n##4) B(n##5) B(n##6) B(n##7) B(n##8) B(n##9)
  #define D(n) C(n##0) C(n##1) C(n##2) C(n##3) C(n##4) C(n##5) C(n##6) C(n##7) C(n##8) C(n##9)
  #define E(n) D(n##0) D(n##1) D(n##2) D(n##3) D(n##4) D(n##5) D(n##6) D(n##7) D(n##8) D(n##9)
  E(1) E(2) E(3)
  int main () { return 0; }
./xg++ -B ./ -o abc{.o,.C} -flto -flto-partition=1to1 -O2 -g -fdebug-types-section -c
./xgcc -B ./ -o abc{,.o} -flto -flto-partition=1to1 -O2
(not included in testsuite as it takes a while to compile) FAILs with
lto-wrapper: fatal error: Too many copied sections: Operation not supported
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

The following patch fixes that.  Most of the 64K+ section support for
reading and writing was already there years ago (and especially reading used
quite often already) and a further bug fixed in it in the PR104617 fix.

Yet, the fix isn't solely about removing the
  if (new_i - 1 >= SHN_LORESERVE)
    {
      *err = ENOTSUP;
      return "Too many copied sections";
    }
5 lines, the missing part was that the function only handled reading of
the .symtab_shndx section but not copying/updating of it.
If the result has less than 64K-epsilon sections, that actually wasn't
needed, but e.g. with -fdebug-types-section one can exceed that pretty
easily (reported to us on WebKitGtk build on ppc64le).
Updating the section is slightly more complicated, because it basically
needs to be done in lock step with updating the .symtab section, if one
doesn't need to use SHN_XINDEX in there, the section should (or should be
updated to) contain SHN_UNDEF entry, otherwise needs to have whatever would
be overwise stored but couldn't fit.  But repeating due to that all the
symtab decisions what to discard and how to rewrite it would be ugly.

So, the patch instead emits the .symtab_shndx section (or sections) last
and prepares the content during the .symtab processing and in a second
pass when going just through .symtab_shndx sections just uses the saved
content.

2024-09-07  Jakub Jelinek  <jakub@redhat.com>

	PR lto/116614
	* simple-object-elf.c (SHN_COMMON): Align comment with neighbouring
	comments.
	(SHN_HIRESERVE): Use uppercase hex digits instead of lowercase for
	consistency.
	(simple_object_elf_find_sections): Formatting fixes.
	(simple_object_elf_fetch_attributes): Likewise.
	(simple_object_elf_attributes_merge): Likewise.
	(simple_object_elf_start_write): Likewise.
	(simple_object_elf_write_ehdr): Likewise.
	(simple_object_elf_write_shdr): Likewise.
	(simple_object_elf_write_to_file): Likewise.
	(simple_object_elf_copy_lto_debug_section): Likewise.  Don't fail for
	new_i - 1 >= SHN_LORESERVE, instead arrange in that case to copy
	over .symtab_shndx sections, though emit those last and compute their
	section content when processing associated .symtab sections.  Handle
	simple_object_internal_read failure even in the .symtab_shndx reading
	case.
2024-09-07 09:39:06 +02:00
GCC Administrator
8ac4db24e4 Daily bump. 2024-08-06 00:17:19 +00:00
Andrew Burgess
ea23809688 libiberty/argv.c: remove only_whitespace
After the commit:

  commit 5e1d530da8 (gcc-buildargv)
  Date:   Sat Feb 10 11:22:13 2024 +0000

      libiberty/buildargv: handle input consisting of only white space

The function only_whitespace (in argv.c) was no longer being called.
Lets delete it.

There should be no user visible changes after this commit.

2024-07-29  Andrew Burgess  <aburgess@redhat.com>

libiberty/

	* argv.c (only_whitespace): Delete.
2024-08-05 12:35:38 +01:00
GCC Administrator
72bce1fbef Daily bump. 2024-07-17 00:18:32 +00:00