> This is causing all the tests being run on all targets,
> even if libsanitizer is not supported,
> most of them failing due to link errors.

Thanks for the info and sorry about this. I should probably check non-sanitized platforms as well before commiting patches. Does the attached patch make sense to you? Worked for me on x64 and x64 with manually disabled libsanitizer.

-Y
diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp
index 1e6c7dd..8990677 100644
--- a/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc/testsuite/lib/asan-dg.exp
@@ -39,9 +39,9 @@ proc asan_link_flags { paths } {
     set shlib_ext [get_shlib_extension]
 
     if { $gccpath != "" } {
-      append flags " -B${gccpath}/libsanitizer/ "
       if { [file exists "${gccpath}/libsanitizer/asan/.libs/libasan.a"]
 	   || [file exists "${gccpath}/libsanitizer/asan/.libs/libasan.${shlib_ext}"] } {
+	  append flags " -B${gccpath}/libsanitizer/ "
 	  append flags " -B${gccpath}/libsanitizer/asan/ "
 	  append flags " -L${gccpath}/libsanitizer/asan/.libs "
 	  append ld_library_path ":${gccpath}/libsanitizer/asan/.libs"
diff --git a/gcc/testsuite/lib/ubsan-dg.exp b/gcc/testsuite/lib/ubsan-dg.exp
index 2e6b272..aa01988 100644
--- a/gcc/testsuite/lib/ubsan-dg.exp
+++ b/gcc/testsuite/lib/ubsan-dg.exp
@@ -30,9 +30,10 @@ proc ubsan_link_flags { paths } {
     set shlib_ext [get_shlib_extension]
 
     if { $gccpath != "" } {
-      append flags " -B${gccpath}/libsanitizer/ubsan/ "
       if { [file exists "${gccpath}/libsanitizer/ubsan/.libs/libubsan.a"]
 	   || [file exists "${gccpath}/libsanitizer/ubsan/.libs/libubsan.${shlib_ext}"] } {
+	  append flags " -B${gccpath}/libsanitizer/ "
+	  append flags " -B${gccpath}/libsanitizer/ubsan/ "
 	  append flags " -L${gccpath}/libsanitizer/ubsan/.libs"
 	  append ld_library_path ":${gccpath}/libsanitizer/ubsan/.libs"
       }

Reply via email to