<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gcc.git/libstdc++-v3/acinclude.m4, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/'/>
<entry>
<title>support Wild linker</title>
<updated>2025-11-19T15:07:57+00:00</updated>
<author>
<name>Martin Liska</name>
<email>martin.liska@hey.com</email>
</author>
<published>2025-11-02T08:47:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=27450916cddca054bb30b22d48a981c48b1f110e'/>
<id>27450916cddca054bb30b22d48a981c48b1f110e</id>
<content type='text'>
gcc/ChangeLog:

	* collect2.cc (main): Add wild linker to -fuse-ld.
	* common.opt: Likewise.
	* configure: Regenerate.
	* configure.ac: Add detection for wild linker.
	* doc/invoke.texi: Document -fuse-ld=wild.
	* gcc.cc (driver_handle_option): Support -fuse-ld=wild.
	* opts.cc (common_handle_option): Likewise.

libatomic/ChangeLog:

	* acinclude.m4: Add detection for wild linker.
	* configure: Regenerate.

libgomp/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

libitm/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

Signed-off-by: Martin Liška &lt;martin.liska@hey.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
gcc/ChangeLog:

	* collect2.cc (main): Add wild linker to -fuse-ld.
	* common.opt: Likewise.
	* configure: Regenerate.
	* configure.ac: Add detection for wild linker.
	* doc/invoke.texi: Document -fuse-ld=wild.
	* gcc.cc (driver_handle_option): Support -fuse-ld=wild.
	* opts.cc (common_handle_option): Likewise.

libatomic/ChangeLog:

	* acinclude.m4: Add detection for wild linker.
	* configure: Regenerate.

libgomp/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

libitm/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* acinclude.m4:: Add detection for wild linker.
	* configure: Regenerate.

Signed-off-by: Martin Liška &lt;martin.liska@hey.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Implement P3107R5 optimizations for std::print [PR121790]</title>
<updated>2025-10-10T07:00:22+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2024-02-21T16:11:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=8bd872f1ea74143aed0bd5148804a25dc6a9caf0'/>
<id>8bd872f1ea74143aed0bd5148804a25dc6a9caf0</id>
<content type='text'>
The names of the vprint functions follow the convention from P3235R3.

This takes advantage of the additional permission proposed by P3107R5 so
that std::print can write directly to a FILE stream, rather than
formatting to an intermediate std::string temporary and then writing
that to the stream. The change is to write to a new _File_sink type
instead of a _Str_sink that populates a std::string. There are three
implementations of _File_sink.

For non-Glibc targets that support POSIX flockfile and putc_unlocked,
the stream will be locked and then formatted characters will be buffered
on the stack (instead of allocating a std::string) and copied to the
stream when the buffer fills up.

For Glibc, _File_sink will lock the stream but then if the file is
line-buffered or fully buffered, characters will be written directly
into the file's output buffer. This avoids two levels of buffering and
copying the characters from one to the other. For an unbuffered stream
(like stderr) the _File_sink buffer will still be used, to avoid the
overhead of lots of small writes to the stream.  Because this version of
_File_sink accesses the stream's buffer directly it relies on
glibc-specific implementation details that are exposed in public
headers.

A fallback definition of _File_sink just wraps a _Str_sink so is
equivalent to the original code, and is used when flockfile isn't
available.

Both forms of std::println (taking a FILE* and a std::ostream) can be
implemented more efficiently by appending a newline to the format
string, to avoid formatting twice.

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_STDIO_LOCKING): New macro to check
	for std::print dependencies.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_STDIO_LOCKING.
	* include/bits/formatfwd.h (enable_nonlocking_formatter_optimization):
	Define new variable template.
	* include/bits/version.def (print): Bump value.
	* include/bits/version.h: Regenerate.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Define specializations for variable template.
	* include/std/ostream (print) [!_WIN32]: Do not use
	vprint_unicode at all.
	(println): Append newline to format string instead of formatting
	twice.
	* include/std/print (_File_sink): New class.
	(vprint_nonunicode_locking): New function.
	(vprint_unicode_locking): New function reusing previous code
	from vprint_unicode.
	(vprintf_unicode): Defer to vprint_nonunicode for Windows or to
	vprint_unicode_locking otherwise.
	(print): [!_WIN32]: Do no use vprint_unicode at all.
	Check enable_nonlocking_formatter_optimization and defer to
	either vprint_nonunicode_locking or vprint_nonunicode.
	(println): Use vprint_unicode or format directly to a _File_sink
	instead of formatting twice.
	* testsuite/27_io/print/1.cc: Updated and added new tests.
	* testsuite/std/format/formatter/nonlocking.cc: New tests.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
Co-authored-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The names of the vprint functions follow the convention from P3235R3.

This takes advantage of the additional permission proposed by P3107R5 so
that std::print can write directly to a FILE stream, rather than
formatting to an intermediate std::string temporary and then writing
that to the stream. The change is to write to a new _File_sink type
instead of a _Str_sink that populates a std::string. There are three
implementations of _File_sink.

For non-Glibc targets that support POSIX flockfile and putc_unlocked,
the stream will be locked and then formatted characters will be buffered
on the stack (instead of allocating a std::string) and copied to the
stream when the buffer fills up.

For Glibc, _File_sink will lock the stream but then if the file is
line-buffered or fully buffered, characters will be written directly
into the file's output buffer. This avoids two levels of buffering and
copying the characters from one to the other. For an unbuffered stream
(like stderr) the _File_sink buffer will still be used, to avoid the
overhead of lots of small writes to the stream.  Because this version of
_File_sink accesses the stream's buffer directly it relies on
glibc-specific implementation details that are exposed in public
headers.

A fallback definition of _File_sink just wraps a _Str_sink so is
equivalent to the original code, and is used when flockfile isn't
available.

Both forms of std::println (taking a FILE* and a std::ostream) can be
implemented more efficiently by appending a newline to the format
string, to avoid formatting twice.

	PR libstdc++/121790

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_CHECK_STDIO_LOCKING): New macro to check
	for std::print dependencies.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_STDIO_LOCKING.
	* include/bits/formatfwd.h (enable_nonlocking_formatter_optimization):
	Define new variable template.
	* include/bits/version.def (print): Bump value.
	* include/bits/version.h: Regenerate.
	* include/std/format (enable_nonlocking_formatter_optimization):
	Define specializations for variable template.
	* include/std/ostream (print) [!_WIN32]: Do not use
	vprint_unicode at all.
	(println): Append newline to format string instead of formatting
	twice.
	* include/std/print (_File_sink): New class.
	(vprint_nonunicode_locking): New function.
	(vprint_unicode_locking): New function reusing previous code
	from vprint_unicode.
	(vprintf_unicode): Defer to vprint_nonunicode for Windows or to
	vprint_unicode_locking otherwise.
	(print): [!_WIN32]: Do no use vprint_unicode at all.
	Check enable_nonlocking_formatter_optimization and defer to
	either vprint_nonunicode_locking or vprint_nonunicode.
	(println): Use vprint_unicode or format directly to a _File_sink
	instead of formatting twice.
	* testsuite/27_io/print/1.cc: Updated and added new tests.
	* testsuite/std/format/formatter/nonlocking.cc: New tests.

Reviewed-by: Jonathan Wakely &lt;jwakely@redhat.com&gt;
Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
Co-authored-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Implement C++26 &lt;debugging&gt; features [PR119670]</title>
<updated>2025-08-28T16:47:00+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-04-10T16:50:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=3c95766e92d6782eb945593c043a16be096707af'/>
<id>3c95766e92d6782eb945593c043a16be096707af</id>
<content type='text'>
This implements P2546R5 (Debugging Support), including the P2810R4
(is_debugger_present is_replaceable) changes, allowing
std::is_debugger_present to be replaced by the program.

It would be good to provide a macOS definition of is_debugger_present as
per https://developer.apple.com/library/archive/qa/qa1361/_index.html
but that isn't included in this change.

The src/c++26/debugging.cc file defines a global volatile int which can
be set by debuggers to indicate when they are attached and detached from
a running process. This allows std::is_debugger_present() to give a
reliable answer, and additionally allows a debugger to choose how
std::breakpoint() should behave. Setting the global to a positive value
will cause std::breakpoint() to use that value as an argument to
std::raise, so debuggers that prefer SIGABRT for breakpoints can select
that. By default std::breakpoint() will use a platform-specific action
such as the INT3 instruction on x86, or GCC's __builtin_trap().

On Linux the std::is_debugger_present() function checks whether the
process is being traced by a process named "gdb", "gdbserver" or
"lldb-server", to try to avoid interpreting other tracing processes
(such as strace) as a debugger. There have been comments suggesting this
isn't desirable and that std::is_debugger_present() should just return
true for any tracing process (which is the case for non-Linux targets
that support the ptrace system call).

libstdc++-v3/ChangeLog:

	PR libstdc++/119670
	* acinclude.m4 (GLIBCXX_CHECK_DEBUGGING): Check for facilities
	needed by &lt;debugging&gt;.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_DEBUGGING.
	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/bits/version.def (debugging): Add.
	* include/bits/version.h: Regenerate.
	* include/precompiled/stdc++.h: Add new header.
	* src/c++26/Makefile.am: Add new file.
	* src/c++26/Makefile.in: Regenerate.
	* include/std/debugging: New file.
	* src/c++26/debugging.cc: New file.
	* testsuite/19_diagnostics/debugging/breakpoint.cc: New test.
	* testsuite/19_diagnostics/debugging/breakpoint_if_debugging.cc:
	New test.
	* testsuite/19_diagnostics/debugging/is_debugger_present.cc: New
	test.
	* testsuite/19_diagnostics/debugging/is_debugger_present-2.cc:
	New test.

Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements P2546R5 (Debugging Support), including the P2810R4
(is_debugger_present is_replaceable) changes, allowing
std::is_debugger_present to be replaced by the program.

It would be good to provide a macOS definition of is_debugger_present as
per https://developer.apple.com/library/archive/qa/qa1361/_index.html
but that isn't included in this change.

The src/c++26/debugging.cc file defines a global volatile int which can
be set by debuggers to indicate when they are attached and detached from
a running process. This allows std::is_debugger_present() to give a
reliable answer, and additionally allows a debugger to choose how
std::breakpoint() should behave. Setting the global to a positive value
will cause std::breakpoint() to use that value as an argument to
std::raise, so debuggers that prefer SIGABRT for breakpoints can select
that. By default std::breakpoint() will use a platform-specific action
such as the INT3 instruction on x86, or GCC's __builtin_trap().

On Linux the std::is_debugger_present() function checks whether the
process is being traced by a process named "gdb", "gdbserver" or
"lldb-server", to try to avoid interpreting other tracing processes
(such as strace) as a debugger. There have been comments suggesting this
isn't desirable and that std::is_debugger_present() should just return
true for any tracing process (which is the case for non-Linux targets
that support the ptrace system call).

libstdc++-v3/ChangeLog:

	PR libstdc++/119670
	* acinclude.m4 (GLIBCXX_CHECK_DEBUGGING): Check for facilities
	needed by &lt;debugging&gt;.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_DEBUGGING.
	* include/Makefile.am: Add new header.
	* include/Makefile.in: Regenerate.
	* include/bits/version.def (debugging): Add.
	* include/bits/version.h: Regenerate.
	* include/precompiled/stdc++.h: Add new header.
	* src/c++26/Makefile.am: Add new file.
	* src/c++26/Makefile.in: Regenerate.
	* include/std/debugging: New file.
	* src/c++26/debugging.cc: New file.
	* testsuite/19_diagnostics/debugging/breakpoint.cc: New test.
	* testsuite/19_diagnostics/debugging/breakpoint_if_debugging.cc:
	New test.
	* testsuite/19_diagnostics/debugging/is_debugger_present.cc: New
	test.
	* testsuite/19_diagnostics/debugging/is_debugger_present-2.cc:
	New test.

Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Use pthread_mutex_clocklock when TSan is active [PR121496]</title>
<updated>2025-08-21T12:26:17+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-08-19T17:02:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=fb7c62f7a8fed8e30c5bd6cbb0fdb26774ba247d'/>
<id>fb7c62f7a8fed8e30c5bd6cbb0fdb26774ba247d</id>
<content type='text'>
This reverts r14-905-g3b7cb33033fbe6 which disabled the use of
pthread_mutex_clocklock when TSan is active. That's no longer needed,
because GCC has TSan interceptors for pthread_mutex_clocklock since GCC
15.1 and Clang has them since 18.1.0 (released March 2024).

The interceptor was added by https://github.com/llvm/llvm-project/pull/75713

libstdc++-v3/ChangeLog:

	PR libstdc++/121496
	* acinclude.m4 (GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK): Do not
	use _GLIBCXX_TSAN in _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK macro.
	* configure: Regenerate.

Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts r14-905-g3b7cb33033fbe6 which disabled the use of
pthread_mutex_clocklock when TSan is active. That's no longer needed,
because GCC has TSan interceptors for pthread_mutex_clocklock since GCC
15.1 and Clang has them since 18.1.0 (released March 2024).

The interceptor was added by https://github.com/llvm/llvm-project/pull/75713

libstdc++-v3/ChangeLog:

	PR libstdc++/121496
	* acinclude.m4 (GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK): Do not
	use _GLIBCXX_TSAN in _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK macro.
	* configure: Regenerate.

Reviewed-by: Tomasz Kamiński &lt;tkaminsk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Rewrite std::counting_semaphore base class [PR118494]</title>
<updated>2025-05-30T09:02:29+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-01-15T09:05:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=3e9fff1b7f9a31e6bc635880b09cbc32f8be353d'/>
<id>3e9fff1b7f9a31e6bc635880b09cbc32f8be353d</id>
<content type='text'>
Remove __platform_semaphore. Replace __atomic_semaphore with
__semaphore_base&lt;bool&gt; and change its counter to be ptrdiff_t when the
count doesn't fit in __platform_wait_t (PR 118494).

Make the std::counting_semaphore constructor constexpr to support
constant initialization (PR 110854).

Add precondition checks to the constructor and release member functions
(PR 98749).

libstdc++-v3/ChangeLog:

	PR libstdc++/118494
	PR libstdc++/110854
	PR libstdc++/98749
	* acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Remove checks for
	sem_timedwait. Do not define _GLIBCXX_HAVE_POSIX_SEMAPHORE.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/bits/semaphore_base.h (__platform_semaphore): Remove.
	(__atomic_semaphore): Replace with __semaphore_base&lt;bool&gt; and
	make type of _M_count depend on template parameter. Fix _S_max
	constant to use correct type.
	(__semaphore_base::_M_try_acquire): Qualify to avoid ADL.
	(__semaphore_base::_M_release): Return old value. Remove FIXME
	comment.
	(__semaphore_impl): Replace typedef with alias template.
	* include/bits/version.def (semaphore): Do not depend on
	_GLIBCXX_HAVE_POSIX_SEMAPHORE.
	* include/bits/version.h: Regenerate.
	* include/std/semaphore (semaphore): Adjust type of _M_sem
	member. Add constexpr to constructor. Add assertions to
	(semaphore::semaphore(ptrdiff_t)): Add constexpr. Add assertion
	for precondition.
	(semaphore::release): Add assertion using value returned from
	_M_release.
	* testsuite/30_threads/semaphore/100806.cc: Increase template
	argument for std::counting_semaphore, so constructor
	precondition is met.
	* testsuite/30_threads/semaphore/cons.cc: New test.
	* testsuite/30_threads/semaphore/try_acquire_posix.cc: Remove.
	* testsuite/30_threads/semaphore/platform_try_acquire_for.cc:
	Removed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove __platform_semaphore. Replace __atomic_semaphore with
__semaphore_base&lt;bool&gt; and change its counter to be ptrdiff_t when the
count doesn't fit in __platform_wait_t (PR 118494).

Make the std::counting_semaphore constructor constexpr to support
constant initialization (PR 110854).

Add precondition checks to the constructor and release member functions
(PR 98749).

libstdc++-v3/ChangeLog:

	PR libstdc++/118494
	PR libstdc++/110854
	PR libstdc++/98749
	* acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Remove checks for
	sem_timedwait. Do not define _GLIBCXX_HAVE_POSIX_SEMAPHORE.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/bits/semaphore_base.h (__platform_semaphore): Remove.
	(__atomic_semaphore): Replace with __semaphore_base&lt;bool&gt; and
	make type of _M_count depend on template parameter. Fix _S_max
	constant to use correct type.
	(__semaphore_base::_M_try_acquire): Qualify to avoid ADL.
	(__semaphore_base::_M_release): Return old value. Remove FIXME
	comment.
	(__semaphore_impl): Replace typedef with alias template.
	* include/bits/version.def (semaphore): Do not depend on
	_GLIBCXX_HAVE_POSIX_SEMAPHORE.
	* include/bits/version.h: Regenerate.
	* include/std/semaphore (semaphore): Adjust type of _M_sem
	member. Add constexpr to constructor. Add assertions to
	(semaphore::semaphore(ptrdiff_t)): Add constexpr. Add assertion
	for precondition.
	(semaphore::release): Add assertion using value returned from
	_M_release.
	* testsuite/30_threads/semaphore/100806.cc: Increase template
	argument for std::counting_semaphore, so constructor
	precondition is met.
	* testsuite/30_threads/semaphore/cons.cc: New test.
	* testsuite/30_threads/semaphore/try_acquire_posix.cc: Remove.
	* testsuite/30_threads/semaphore/platform_try_acquire_for.cc:
	Removed.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Rewrite atomic builtin checks: Fix up 'GLIBCXX_ENABLE_BACKTRACE' check with 'size_t' [PR119667]</title>
<updated>2025-05-12T08:47:33+00:00</updated>
<author>
<name>Thomas Schwinge</name>
<email>tschwinge@baylibre.com</email>
</author>
<published>2025-05-12T08:35:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=4589ccbed5cad42296d4d1810b61e8dec0dadf79'/>
<id>4589ccbed5cad42296d4d1810b61e8dec0dadf79</id>
<content type='text'>
Fix-up for commit 86627faec10da53d7532805019e5296fcf15ac09
"libstdc++: Rewrite atomic builtin checks [PR70560]", which, for example, for
x86_64-pc-linux-gnu lost '-DHAVE_ATOMIC_FUNCTIONS=1' from 'BACKTRACE_CPPFLAGS'
due to:

    configure:53554: checking for atomic builtins for libbacktrace
    configure:53587:  [...]/./gcc/xgcc -shared-libgcc -B[...]/./gcc -nostdinc++ -L[...]/x86_64-pc-linux-gnu/libstdc++-v3/src -L[...]/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L[...]/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -B/x86_64-pc-linux-gnu/bin/ -B/x86_64-pc-linux-gnu/lib/ -isystem /x86_64-pc-linux-gnu/include -isystem /x86_64-pc-linux-gnu/sys-include    -o conftest -O0   conftest.cpp  &gt;&amp;5
    conftest.cpp: In function 'int main()':
    conftest.cpp:265:13: error: 'size_t' was not declared in this scope
      265 |             size_t s = 0;
          |             ^~~~~~
    conftest.cpp:1:1: note: 'size_t' is defined in header '&lt;cstddef&gt;'; this is probably fixable by adding '#include &lt;cstddef&gt;'
        1 | /* confdefs.h */
    conftest.cpp:273:31: error: 's' was not declared in this scope
      273 |             __atomic_store_n(&amp;s, s, __ATOMIC_RELEASE);
          |                               ^
    configure:53587: $? = 1
    configure: failed program was:
    | /* confdefs.h */
    [...]
    | int
    | main ()
    | {
    |[...]
    |          size_t s = 0;
    |[...]
    |          // backtrace_atomic_store_size_t
    |          __atomic_store_n(&amp;s, s, __ATOMIC_RELEASE);
    |[...]
    | }
    configure:53595: result: no

	PR libstdc++/70560
	PR libstdc++/119667
	libstdc++-v3/
	* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Use '__SIZE_TYPE__'
	instead of 'size_t'.
	* configure: Regenerate.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix-up for commit 86627faec10da53d7532805019e5296fcf15ac09
"libstdc++: Rewrite atomic builtin checks [PR70560]", which, for example, for
x86_64-pc-linux-gnu lost '-DHAVE_ATOMIC_FUNCTIONS=1' from 'BACKTRACE_CPPFLAGS'
due to:

    configure:53554: checking for atomic builtins for libbacktrace
    configure:53587:  [...]/./gcc/xgcc -shared-libgcc -B[...]/./gcc -nostdinc++ -L[...]/x86_64-pc-linux-gnu/libstdc++-v3/src -L[...]/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L[...]/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -B/x86_64-pc-linux-gnu/bin/ -B/x86_64-pc-linux-gnu/lib/ -isystem /x86_64-pc-linux-gnu/include -isystem /x86_64-pc-linux-gnu/sys-include    -o conftest -O0   conftest.cpp  &gt;&amp;5
    conftest.cpp: In function 'int main()':
    conftest.cpp:265:13: error: 'size_t' was not declared in this scope
      265 |             size_t s = 0;
          |             ^~~~~~
    conftest.cpp:1:1: note: 'size_t' is defined in header '&lt;cstddef&gt;'; this is probably fixable by adding '#include &lt;cstddef&gt;'
        1 | /* confdefs.h */
    conftest.cpp:273:31: error: 's' was not declared in this scope
      273 |             __atomic_store_n(&amp;s, s, __ATOMIC_RELEASE);
          |                               ^
    configure:53587: $? = 1
    configure: failed program was:
    | /* confdefs.h */
    [...]
    | int
    | main ()
    | {
    |[...]
    |          size_t s = 0;
    |[...]
    |          // backtrace_atomic_store_size_t
    |          __atomic_store_n(&amp;s, s, __ATOMIC_RELEASE);
    |[...]
    | }
    configure:53595: result: no

	PR libstdc++/70560
	PR libstdc++/119667
	libstdc++-v3/
	* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Use '__SIZE_TYPE__'
	instead of 'size_t'.
	* configure: Regenerate.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Remove use of undefined GLIBCXX_LANG_{PUSH,POP} [PR120147]</title>
<updated>2025-05-07T09:47:45+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-05-07T09:44:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=83ef989ee189902ca1d434feb0f3dd50519e92cb'/>
<id>83ef989ee189902ca1d434feb0f3dd50519e92cb</id>
<content type='text'>
Commit r16-427-g86627faec10da5 was using the new GLIBCXX_LANG_PUSH and
GLIBCXX_LANG_POP macros from a change that I haven't pushed yet,
resulting in changes to CXXFLAGS not being restored after the
GLIBCXX_ENABLE_BACKTRACE checks.

libstdc++-v3/ChangeLog:

	PR libstdc++/120147
	* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Restore use of
	AC_LANG_CPLUSPLUS.
	* configure: Regenerate.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit r16-427-g86627faec10da5 was using the new GLIBCXX_LANG_PUSH and
GLIBCXX_LANG_POP macros from a change that I haven't pushed yet,
resulting in changes to CXXFLAGS not being restored after the
GLIBCXX_ENABLE_BACKTRACE checks.

libstdc++-v3/ChangeLog:

	PR libstdc++/120147
	* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Restore use of
	AC_LANG_CPLUSPLUS.
	* configure: Regenerate.
</pre>
</div>
</content>
</entry>
<entry>
<title>libstdc++: Rewrite atomic builtin checks [PR70560]</title>
<updated>2025-05-06T16:19:26+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-04-25T20:09:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=86627faec10da53d7532805019e5296fcf15ac09'/>
<id>86627faec10da53d7532805019e5296fcf15ac09</id>
<content type='text'>
Currently the GLIBCXX_ENABLE_ATOMIC_BUILTINS macro checks for a variety
of __atomic built-ins for bool, short and int. If all those checks pass,
then it defines _GLIBCXX_ATOMIC_BUILTINS and uses the definitions from
config/cpu/generic/atomicity_builtins/atomicity.h for the non-inline
versions of __exchange_and_add and __atomic_add that get compiled into
libsupc++.

However, the config/cpu/generic/atomicity_builtins/atomicity.h
definitions only depend on __atomic_fetch_add not on
__atomic_test_and_set or __atomic_compare_exchange. And they only
operate on a variable of type _Atomic word, which is not necessarily one
of bool, short or int (e.g. for sparcv9 _Atomic_word is 64-bit long).

This means that for a target where _Atomic_word is int but there are no
1-byte or 2-byte atomic instructions, GLIBCXX_ENABLE_ATOMIC_BUILTINS
will fail the checks for bool and short and not define the macro
_GLIBCXX_ATOMIC_BUILTINS. That means that we will use a single global
mutex for reference counting in the COW std::string and std::locale,
even though we could use __atomic_fetch_add to do it lock-free.

This commit removes most of the GLIBCXX_ENABLE_ATOMIC_BUILTINS checks,
so that it only checks __atomic_fetch_add on _Atomic_word. The macro
defined by GLIBCXX_ENABLE_ATOMIC_BUILTINS is renamed from
_GLIBCXX_ATOMIC_BUILTINS to _GLIBCXX_ATOMIC_WORD_BUILTINS to better
reflect what it really means. This will enable the inline versions of
__exchange_and_add and __atomic_add for more targets. This is not an ABI
change, because targets which didn't previously use the inline
definitions of those functions made non-inlined calls to the functions
in the library. If the definitions of those functions now start using
atomics, that doesn't change the semantics for the code calling those
functions.

On affected targets, new code compiled after this change will see the
_GLIBCXX_ATOMIC_WORD_BUILTINS macro and so will use the always-inline
versions of __exchange_and_add and __atomic_add, which use
__atomic_fetch_add directly. That is also compatible with older code
which still calls the non-inline definitions, because those non-inline
definitions now also use __atomic_fetch_add.

The only configuration where this could be an ABI change is for a target
which previously defined _GLIBCXX_ATOMIC_BUILTINS (because all the
atomic built-ins for bool, short and int are supported), but which
defines _Atomic_word to some other type for which __atomic_fetch_add is
/not/ supported. Such a target would have called the inline functions
using __atomic_fetch_add, which would actually have depended on
libatomic (which is what the configure checks were supposed to
prevent!).  After this change, that target would not define the new
macro, _GLIBCXX_ATOMIC_WORD_BUILTINS, and so would make non-inline calls
into the library where __exchange_and_add and __atomic_add would use the
global mutex. That would be an ABI break. I don't consider that a
realistic scenario, because it wouldn't have made any sense to define
_Atomic_word to a wider type than int, when doing so would have required
libatomic to make libstdc++.so work. Surely such a target would have
just used int for its _Atomic_word type.

The GLIBCXX_ENABLE_BACKTRACE macro currently uses the
glibcxx_ac_atomic_int variable defined by the checks that this commit
removes from GLIBCXX_ENABLE_ATOMIC_BUILTINS. That wasn't a good check
anyway, because libbacktrace actually depends on atomic loads+stores for
pointers as well as int, and for atomic stores for size_t. This commit
replaces the glibcxx_ac_atomic_int check with a proper test for all the
required atomic operations on all three of int, void* and size_t. This
ensures that the libbacktrace code used for std::stacktrace will either
use native atomics, or implement those loads and stores only in terms of
__sync_bool_compare_and_swap (possibly requiring that to come from
libatomic or elsewhere).

libstdc++-v3/ChangeLog:

	PR libstdc++/70560
	PR libstdc++/119667
	* acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Only check for
	__atomic_fetch_add on _Atomic_word. Define new macro
	_GLIBCXX_ATOMIC_WORD_BUILTINS and stop defining macro
	_GLIBCXX_ATOMIC_BUILTINS.
	(GLIBCXX_ENABLE_BACKTRACE): Check for __atomic_load_n and
	__atomic_store_n on int, void* and size_t.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.host: Fix typo in comment.
	* include/ext/atomicity.h (__exchange_and_add, __atomic_add):
	Depend on _GLIBCXX_ATOMIC_WORD_BUILTINS macro instead of old
	_GLIBCXX_ATOMIC_BUILTINS macro.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently the GLIBCXX_ENABLE_ATOMIC_BUILTINS macro checks for a variety
of __atomic built-ins for bool, short and int. If all those checks pass,
then it defines _GLIBCXX_ATOMIC_BUILTINS and uses the definitions from
config/cpu/generic/atomicity_builtins/atomicity.h for the non-inline
versions of __exchange_and_add and __atomic_add that get compiled into
libsupc++.

However, the config/cpu/generic/atomicity_builtins/atomicity.h
definitions only depend on __atomic_fetch_add not on
__atomic_test_and_set or __atomic_compare_exchange. And they only
operate on a variable of type _Atomic word, which is not necessarily one
of bool, short or int (e.g. for sparcv9 _Atomic_word is 64-bit long).

This means that for a target where _Atomic_word is int but there are no
1-byte or 2-byte atomic instructions, GLIBCXX_ENABLE_ATOMIC_BUILTINS
will fail the checks for bool and short and not define the macro
_GLIBCXX_ATOMIC_BUILTINS. That means that we will use a single global
mutex for reference counting in the COW std::string and std::locale,
even though we could use __atomic_fetch_add to do it lock-free.

This commit removes most of the GLIBCXX_ENABLE_ATOMIC_BUILTINS checks,
so that it only checks __atomic_fetch_add on _Atomic_word. The macro
defined by GLIBCXX_ENABLE_ATOMIC_BUILTINS is renamed from
_GLIBCXX_ATOMIC_BUILTINS to _GLIBCXX_ATOMIC_WORD_BUILTINS to better
reflect what it really means. This will enable the inline versions of
__exchange_and_add and __atomic_add for more targets. This is not an ABI
change, because targets which didn't previously use the inline
definitions of those functions made non-inlined calls to the functions
in the library. If the definitions of those functions now start using
atomics, that doesn't change the semantics for the code calling those
functions.

On affected targets, new code compiled after this change will see the
_GLIBCXX_ATOMIC_WORD_BUILTINS macro and so will use the always-inline
versions of __exchange_and_add and __atomic_add, which use
__atomic_fetch_add directly. That is also compatible with older code
which still calls the non-inline definitions, because those non-inline
definitions now also use __atomic_fetch_add.

The only configuration where this could be an ABI change is for a target
which previously defined _GLIBCXX_ATOMIC_BUILTINS (because all the
atomic built-ins for bool, short and int are supported), but which
defines _Atomic_word to some other type for which __atomic_fetch_add is
/not/ supported. Such a target would have called the inline functions
using __atomic_fetch_add, which would actually have depended on
libatomic (which is what the configure checks were supposed to
prevent!).  After this change, that target would not define the new
macro, _GLIBCXX_ATOMIC_WORD_BUILTINS, and so would make non-inline calls
into the library where __exchange_and_add and __atomic_add would use the
global mutex. That would be an ABI break. I don't consider that a
realistic scenario, because it wouldn't have made any sense to define
_Atomic_word to a wider type than int, when doing so would have required
libatomic to make libstdc++.so work. Surely such a target would have
just used int for its _Atomic_word type.

The GLIBCXX_ENABLE_BACKTRACE macro currently uses the
glibcxx_ac_atomic_int variable defined by the checks that this commit
removes from GLIBCXX_ENABLE_ATOMIC_BUILTINS. That wasn't a good check
anyway, because libbacktrace actually depends on atomic loads+stores for
pointers as well as int, and for atomic stores for size_t. This commit
replaces the glibcxx_ac_atomic_int check with a proper test for all the
required atomic operations on all three of int, void* and size_t. This
ensures that the libbacktrace code used for std::stacktrace will either
use native atomics, or implement those loads and stores only in terms of
__sync_bool_compare_and_swap (possibly requiring that to come from
libatomic or elsewhere).

libstdc++-v3/ChangeLog:

	PR libstdc++/70560
	PR libstdc++/119667
	* acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Only check for
	__atomic_fetch_add on _Atomic_word. Define new macro
	_GLIBCXX_ATOMIC_WORD_BUILTINS and stop defining macro
	_GLIBCXX_ATOMIC_BUILTINS.
	(GLIBCXX_ENABLE_BACKTRACE): Check for __atomic_load_n and
	__atomic_store_n on int, void* and size_t.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.host: Fix typo in comment.
	* include/ext/atomicity.h (__exchange_and_add, __atomic_add):
	Depend on _GLIBCXX_ATOMIC_WORD_BUILTINS macro instead of old
	_GLIBCXX_ATOMIC_BUILTINS macro.
</pre>
</div>
</content>
</entry>
<entry>
<title>GCN, nvptx libstdc++: Force use of '__atomic' builtins [PR119645]</title>
<updated>2025-04-07T13:57:30+00:00</updated>
<author>
<name>Thomas Schwinge</name>
<email>tschwinge@baylibre.com</email>
</author>
<published>2025-04-05T21:11:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=059b5509c14904b55c37f659170240ae0d2c1c8e'/>
<id>059b5509c14904b55c37f659170240ae0d2c1c8e</id>
<content type='text'>
For both GCN, nvptx, this gets rid of 'configure'-time:

    configure: WARNING: No native atomic operations are provided for this platform.
    configure: WARNING: They will be faked using a mutex.
    configure: WARNING: Performance of certain classes will degrade as a result.

..., and changes:

    -checking for lock policy for shared_ptr reference counts... mutex
    +checking for lock policy for shared_ptr reference counts... atomic

That means, '[...]/[target]/libstdc++-v3/', 'Makefile's change:

    -ATOMICITY_SRCDIR = config/cpu/generic/atomicity_mutex
    +ATOMICITY_SRCDIR = config/cpu/generic/atomicity_builtins

..., and '[...]/[target]/libstdc++-v3/config.h' changes:

    /* Defined if shared_ptr reference counting should use atomic operations. */
    -/* #undef HAVE_ATOMIC_LOCK_POLICY */
    +#define HAVE_ATOMIC_LOCK_POLICY 1

    /* Define if the compiler supports C++11 atomics. */
    -/* #undef _GLIBCXX_ATOMIC_BUILTINS */
    +#define _GLIBCXX_ATOMIC_BUILTINS 1

..., and '[...]/[target]/libstdc++-v3/include/[target]/bits/c++config.h'
changes:

    /* Defined if shared_ptr reference counting should use atomic operations. */
    -/* #undef _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY */
    +#define _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY 1

    /* Define if the compiler supports C++11 atomics. */
    -/* #undef _GLIBCXX_ATOMIC_BUILTINS */
    +#define _GLIBCXX_ATOMIC_BUILTINS 1

This means that '[...]/[target]/libstdc++-v3/libsupc++/atomicity.cc',
'[...]/[target]/libstdc++-v3/libsupc++/atomicity.o' then uses atomic
instructions for synchronization instead of C++ static local variables, which
in turn for their guard variables, via 'libstdc++-v3/libsupc++/guard.cc', used
'libgcc/gthr.h' recursive mutexes, which currently are unsupported for GCN.

For GCN, this turns ~500 libstdc++ execution test FAILs into PASSes, and also
progresses:

    PASS: g++.dg/tree-ssa/pr20458.C  -std=gnu++17 (test for excess errors)
    [-FAIL:-]{+PASS:+} g++.dg/tree-ssa/pr20458.C  -std=gnu++17 execution test
    PASS: g++.dg/tree-ssa/pr20458.C  -std=gnu++26 (test for excess errors)
    [-FAIL:-]{+PASS:+} g++.dg/tree-ssa/pr20458.C  -std=gnu++26 execution test
    UNSUPPORTED: g++.dg/tree-ssa/pr20458.C  -std=gnu++98: exception handling not supported

(For nvptx, there is no effective change, due to other misconfiguration.)

	PR target/119645
	libstdc++-v3/
	* acinclude.m4 (GLIBCXX_ENABLE_LOCK_POLICY) [GCN, nvptx]:
	Hard-code results.
	* configure: Regenerate.
	* configure.host [GCN, nvptx] (atomicity_dir): Set to
	'cpu/generic/atomicity_builtins'.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For both GCN, nvptx, this gets rid of 'configure'-time:

    configure: WARNING: No native atomic operations are provided for this platform.
    configure: WARNING: They will be faked using a mutex.
    configure: WARNING: Performance of certain classes will degrade as a result.

..., and changes:

    -checking for lock policy for shared_ptr reference counts... mutex
    +checking for lock policy for shared_ptr reference counts... atomic

That means, '[...]/[target]/libstdc++-v3/', 'Makefile's change:

    -ATOMICITY_SRCDIR = config/cpu/generic/atomicity_mutex
    +ATOMICITY_SRCDIR = config/cpu/generic/atomicity_builtins

..., and '[...]/[target]/libstdc++-v3/config.h' changes:

    /* Defined if shared_ptr reference counting should use atomic operations. */
    -/* #undef HAVE_ATOMIC_LOCK_POLICY */
    +#define HAVE_ATOMIC_LOCK_POLICY 1

    /* Define if the compiler supports C++11 atomics. */
    -/* #undef _GLIBCXX_ATOMIC_BUILTINS */
    +#define _GLIBCXX_ATOMIC_BUILTINS 1

..., and '[...]/[target]/libstdc++-v3/include/[target]/bits/c++config.h'
changes:

    /* Defined if shared_ptr reference counting should use atomic operations. */
    -/* #undef _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY */
    +#define _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY 1

    /* Define if the compiler supports C++11 atomics. */
    -/* #undef _GLIBCXX_ATOMIC_BUILTINS */
    +#define _GLIBCXX_ATOMIC_BUILTINS 1

This means that '[...]/[target]/libstdc++-v3/libsupc++/atomicity.cc',
'[...]/[target]/libstdc++-v3/libsupc++/atomicity.o' then uses atomic
instructions for synchronization instead of C++ static local variables, which
in turn for their guard variables, via 'libstdc++-v3/libsupc++/guard.cc', used
'libgcc/gthr.h' recursive mutexes, which currently are unsupported for GCN.

For GCN, this turns ~500 libstdc++ execution test FAILs into PASSes, and also
progresses:

    PASS: g++.dg/tree-ssa/pr20458.C  -std=gnu++17 (test for excess errors)
    [-FAIL:-]{+PASS:+} g++.dg/tree-ssa/pr20458.C  -std=gnu++17 execution test
    PASS: g++.dg/tree-ssa/pr20458.C  -std=gnu++26 (test for excess errors)
    [-FAIL:-]{+PASS:+} g++.dg/tree-ssa/pr20458.C  -std=gnu++26 execution test
    UNSUPPORTED: g++.dg/tree-ssa/pr20458.C  -std=gnu++98: exception handling not supported

(For nvptx, there is no effective change, due to other misconfiguration.)

	PR target/119645
	libstdc++-v3/
	* acinclude.m4 (GLIBCXX_ENABLE_LOCK_POLICY) [GCN, nvptx]:
	Hard-code results.
	* configure: Regenerate.
	* configure.host [GCN, nvptx] (atomicity_dir): Set to
	'cpu/generic/atomicity_builtins'.
</pre>
</div>
</content>
</entry>
<entry>
<title>Libstdc++: Fix bootstrap failure for cross without tm.tm_zone [PR119550]</title>
<updated>2025-03-31T21:54:08+00:00</updated>
<author>
<name>Jonathan Wakely</name>
<email>jwakely@redhat.com</email>
</author>
<published>2025-03-31T14:07:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=97cbe3cd5f36470884e940bda4469dc9b5b93cfd'/>
<id>97cbe3cd5f36470884e940bda4469dc9b5b93cfd</id>
<content type='text'>
In r15-8491-g778c28c70f8573 I added a use of the Autoconf macro
AC_STRUCT_TIMEZONE, but that requires a link-test for the global tzname
object if tm.tm_zone isn't supported. That link-test isn't allowed for
cross-compilation, so bootstrap fails if tm.tm_zone isn't supported.

Since libstdc++ only cares about tm.tm_zone and won't use tzname anyway,
we don't need the link-test. Replace AC_STRUCT_TIMEZONE with a custom
macro that only checks for tm.tm_zone. We can improve on the Autoconf
macro by checking it's a suitable type, which isn't actually checked by
AC_STRUCT_TIMEZONE.

libstdc++-v3/ChangeLog:

	PR libstdc++/119550
	* acinclude.m4 (GLIBCXX_STRUCT_TM_TM_ZONE): New macro.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_STRUCT_TM_TM_ZONE.
	* include/bits/chrono_io.h (__formatter_chrono::_M_c): Check
	_GLIBCXX_USE_STRUCT_TM_TM_ZONE instead of
	_GLIBCXX_HAVE_STRUCT_TM_TM_ZONE.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In r15-8491-g778c28c70f8573 I added a use of the Autoconf macro
AC_STRUCT_TIMEZONE, but that requires a link-test for the global tzname
object if tm.tm_zone isn't supported. That link-test isn't allowed for
cross-compilation, so bootstrap fails if tm.tm_zone isn't supported.

Since libstdc++ only cares about tm.tm_zone and won't use tzname anyway,
we don't need the link-test. Replace AC_STRUCT_TIMEZONE with a custom
macro that only checks for tm.tm_zone. We can improve on the Autoconf
macro by checking it's a suitable type, which isn't actually checked by
AC_STRUCT_TIMEZONE.

libstdc++-v3/ChangeLog:

	PR libstdc++/119550
	* acinclude.m4 (GLIBCXX_STRUCT_TM_TM_ZONE): New macro.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_STRUCT_TM_TM_ZONE.
	* include/bits/chrono_io.h (__formatter_chrono::_M_c): Check
	_GLIBCXX_USE_STRUCT_TM_TM_ZONE instead of
	_GLIBCXX_HAVE_STRUCT_TM_TM_ZONE.
</pre>
</div>
</content>
</entry>
</feed>
