On 20/05/19 21:41 -0700, Thomas Rodgers wrote:
With the addition of "-ltbb" to the v3_target_compile flags (so as to,
you know, actually try to link tbb).
Tested x86_64-linux, committed to trunk.
This didn't work, I still get a FAIL for every pstl test when
tbb.x86_64 and tbb-devel.x86_64 are installed but not tbb.i686.
Adding -v to RUNTESTFLAGS shows -ltbb wasn't being added to the
command, and because the test program didn't actually refer to any TBB
symbols, it still linked successfully.
This patch uses additional_flags=-ltbb to pass that flag, which seems
to work correctly. I've also cached the result of the effective-target
check, because it's pretty slow and was being run again for each of
the 56 pstl tests, multiplied by the number of test permutations. Now
it runs once per permutation, e.g. once for "unix" and once for
"unix/-m32".
Tested x86_64-linux (with 64-bit tbb only, 32-bit tbb only, and both
32-bit and 64-bit tbb), and powerpc64le-linux (with no tbb installed).
Committed to trunk. I'll backport it to gcc-9-branch too.
commit cab777300b4d549d5dd43152c5d2a5b77fe554bd
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Tue May 21 12:32:24 2019 +0100
PR libstdc++/90252 fix effective-target check for TBB
PR libstdc++/90252
* testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend):
Use "additional_flags" to pass -ltbb to v3_target_compile command.
Use check_v3_target_prop_cached to cache the result of the test.
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 26f3d46e089..868a7cf7aec 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1581,34 +1581,33 @@ proc check_effective_target_random_device { } {
# Return 1 if tbb parallel backend is available
proc check_effective_target_tbb-backend { } {
- global cxxflags
+ return [check_v3_target_prop_cached et_tbb {
+ # Set up and compile a C++ test program that depends on tbb
+ set src tbb_backend[pid].cc
+ set exe tbb_backend[pid].x
- # Set up and preprocess a C++ test program that depends
- # on tbb
- set src tbb_backend[pid].cc
- set exe tbb_backend[pid].x
-
- set f [open $src "w"]
- puts $f "#include <tbb/tbb.h>"
- puts $f "#if TBB_INTERFACE_VERSION < 10000"
- puts $f "# error Intel(R) Threading Building Blocks 2018 is required; older versions are not supported."
- puts $f "#endif"
- puts $f "int main ()"
- puts $f "{"
- puts $f " return 0;"
- puts $f "}"
- close $f
-
- set lines [v3_target_compile $src $exe executable "-ltbb"]
- file delete $src
+ set f [open $src "w"]
+ puts $f "#include <tbb/tbb.h>"
+ puts $f "#if TBB_INTERFACE_VERSION < 10000"
+ puts $f "# error Intel(R) Threading Building Blocks 2018 is required; older versions are not supported."
+ puts $f "#endif"
+ puts $f "int main ()"
+ puts $f "{"
+ puts $f " return 0;"
+ puts $f "}"
+ close $f
- if [string match "" $lines] {
- # No error message, preprocessing succeeded.
- verbose "check_v3_tbb-backend: `1'" 2
- return 1
- }
- verbose "check_v3_tbb-backend: `0'" 2
- return 0
+ set lines [v3_target_compile $src $exe executable "additional_flags=-std=c++17 additional_flags=-ltbb"]
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, compilation succeeded.
+ verbose "check_v3_tbb-backend: `1'" 2
+ return 1
+ }
+ verbose "check_v3_tbb-backend: `0'" 2
+ return 0
+ }]
}
set additional_prunes ""