diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp index d3f61cb52671..0102acf65a28 100644 --- a/libstdc++-v3/testsuite/lib/dg-options.exp +++ b/libstdc++-v3/testsuite/lib/dg-options.exp @@ -257,13 +257,14 @@ proc add_options_for_net_ts { flags } { return $flags } -# Add to FLAGS all the target-specific flags to link to libatomic, if required. +# Add to FLAGS all the target-specific flags to link to libatomic, +# if required for atomics on pointers and 64-bit types. proc add_options_for_libatomic { flags } { if { [istarget hppa*-*-hpux*] - || [istarget powerpc-ibm-aix*] - || [istarget powerpc*-*-darwin*] - || [istarget riscv*-*-*] } { + || ([istarget powerpc*-*-*] && [check_effective_target_ilp32]) + || [istarget riscv*-*-*] + } { return "$flags -L../../libatomic/.libs -latomic" } return $flags