https://gcc.gnu.org/g:094d994ebc2b5d7b8672ce96c375ea00bd7ae361
commit 094d994ebc2b5d7b8672ce96c375ea00bd7ae361 Author: Alexandre Oliva <ol...@adacore.com> Date: Thu May 8 02:18:38 2025 -0300 libstdc++-v3: no -latomic on vxworks libatomic is disabled on vxworks because it's part of libc, and not very granular there, so a separately-built libatomic often triggers link errors over duplicate definitions. So, don't link with -latomic, but keep atomic tests enabled. Unfortunately, some fence and flag primitives that are declared as functions and then defined as macros are not defined as functions in libc, so the tests for non-macro calls fail. Expect those failures. for gcc/testsuite/ChangeLog * gcc.dg/atomic/stdatomic-fence-2.c: Xfail on vxworks. * gcc.dg/atomic/stdatomic-flag-2.c: Likewise. * lib/atomic-dg.exp (atomic_init): Don't add -latomic on vxworks. Diff: --- gcc/testsuite/gcc.dg/atomic/stdatomic-fence-2.c | 1 + gcc/testsuite/gcc.dg/atomic/stdatomic-flag-2.c | 1 + gcc/testsuite/lib/atomic-dg.exp | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/atomic/stdatomic-fence-2.c b/gcc/testsuite/gcc.dg/atomic/stdatomic-fence-2.c index 6916e89576c3..44d3c33dd50b 100644 --- a/gcc/testsuite/gcc.dg/atomic/stdatomic-fence-2.c +++ b/gcc/testsuite/gcc.dg/atomic/stdatomic-fence-2.c @@ -1,6 +1,7 @@ /* Test atomic_*_fence routines for existence and execution with each valid memory model. Out-of-line function calls. */ /* { dg-do run } */ +/* { dg-do-if compile { target *-*-vxworks* } } */ /* { dg-options "-std=c11 -pedantic-errors" } */ #include <stdatomic.h> diff --git a/gcc/testsuite/gcc.dg/atomic/stdatomic-flag-2.c b/gcc/testsuite/gcc.dg/atomic/stdatomic-flag-2.c index e4e3a6ef33d7..b74a54e95918 100644 --- a/gcc/testsuite/gcc.dg/atomic/stdatomic-flag-2.c +++ b/gcc/testsuite/gcc.dg/atomic/stdatomic-flag-2.c @@ -2,6 +2,7 @@ function calls. */ /* The test needs a lockless atomic implementation. */ /* { dg-do run } */ +/* { dg-do-if compile { target *-*-vxworks* } } */ /* { dg-options "-std=c11 -pedantic-errors" } */ #include <stdatomic.h> diff --git a/gcc/testsuite/lib/atomic-dg.exp b/gcc/testsuite/lib/atomic-dg.exp index 83b225a4d3cc..b47282c50587 100644 --- a/gcc/testsuite/lib/atomic-dg.exp +++ b/gcc/testsuite/lib/atomic-dg.exp @@ -71,7 +71,11 @@ proc atomic_init { args } { } } - append link_flags " -latomic " + if { [istarget *-*-vxworks*] } { + # vxworks provides libatomic as part of libc. + } else { + append link_flags " -latomic " + } if [info exists TEST_ALWAYS_FLAGS] { set atomic_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS