On 09/03/19 12:46 -0500, John David Anglin wrote:
The hppa*-*-hpux* target has no builtin atomic support, so we need to 
explicitly link
applications requiring atomic support against libatomic.

Okay?

Dave
--
John David Anglin  dave.ang...@bell.net

2019-03-09  John David Anglin  <dave.ang...@bell.net>

        PR libstdc++/89461
        * testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc: Link
        against libatomic on hppa*-*-hpux*.
        * testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise.
        * testsuite/experimental/net/timer/waitable/cons.cc: Likewise.
        * testsuite/experimental/net/timer/waitable/dest.cc: Likewise.
        * testsuite/experimental/net/timer/waitable/ops.cc: Likewise.
        * testsuite/lib/libstdc++.exp: Locate libatomic.


What do you think about adding the following?

--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -257,6 +257,15 @@ proc add_options_for_net_ts { flags } {
    return $flags
}

+# Add to FLAGS all the target-specific flags to link to libatomic, if required.
+
+proc add_options_for_libatomic { flags } {
+    if { [istarget hppa*-*-hpux*] } {
+       return "$flags -L../../libatomic/.libs -latomic"
+    }
+    return $flags
+}
+
# Like dg-options, but adds to the default options rather than replacing them.

proc dg-additional-options { args } {




Index: testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
===================================================================
--- testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc (revision 
269442)
+++ testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc (working copy)
@@ -22,6 +22,7 @@
// { dg-require-effective-target c++11 }
// { dg-require-effective-target pthread }
// { dg-require-cstdint "" }
+// { dg-additional-options "-L../../libatomic/.libs -latomic" { target 
hppa*-*-hpux* } }

And then this would be:

--- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc
@@ -19,6 +19,7 @@

// { dg-do run }
// { dg-options "-pthread"  }
+// { dg-add-options libatomic }
// { dg-require-effective-target c++11 }
// { dg-require-effective-target pthread }
// { dg-require-cstdint "" }


Reply via email to