Module Name:    src
Committed By:   skrll
Date:           Sun Jun 12 08:55:36 UTC 2022

Modified Files:
        src/tests/usr.bin/c++: asan_common.subr t_call_once.sh t_call_once2.sh
            t_cxxruntime.sh t_fuzzer_oom.sh t_fuzzer_simple.sh
            t_fuzzer_timeout.sh t_hello.sh t_msan_allocated_memory.sh
            t_msan_check_mem.sh t_msan_free.sh t_msan_heap.sh
            t_msan_partial_poison.sh t_msan_poison.sh t_msan_realloc.sh
            t_msan_shadow.sh t_msan_stack.sh t_msan_unpoison.sh
            t_pthread_once.sh t_static_destructor.sh t_tsan_data_race.sh
            t_tsan_heap_use_after_free.sh t_tsan_lock_order_inversion.sh
            t_tsan_locked_mutex_destroy.sh t_tsan_signal_errno.sh
            t_tsan_thread_leak.sh t_tsan_vptr_race.sh ubsan_common.subr
        src/tests/usr.bin/cc: asan_common.subr t_fuzzer_oom.sh
            t_fuzzer_simple.sh t_fuzzer_timeout.sh t_hello.sh
            t_msan_allocated_memory.sh t_msan_check_mem.sh t_msan_free.sh
            t_msan_heap.sh t_msan_partial_poison.sh t_msan_poison.sh
            t_msan_realloc.sh t_msan_shadow.sh t_msan_stack.sh
            t_msan_unpoison.sh t_tsan_data_race.sh
            t_tsan_heap_use_after_free.sh t_tsan_lock_order_inversion.sh
            t_tsan_locked_mutex_destroy.sh t_tsan_signal_errno.sh
            t_tsan_thread_leak.sh ubsan_common.subr

Log Message:
Sprinkle "-static" when using "-pg" as profiling only works with static and
the gcc specs are currently broken.

PR/56876: hppa: "cc -pg" fails with "undefined reference to `mprotect'"


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/c++/asan_common.subr \
    src/tests/usr.bin/c++/t_fuzzer_oom.sh \
    src/tests/usr.bin/c++/t_fuzzer_simple.sh \
    src/tests/usr.bin/c++/t_fuzzer_timeout.sh \
    src/tests/usr.bin/c++/t_msan_allocated_memory.sh \
    src/tests/usr.bin/c++/t_msan_check_mem.sh \
    src/tests/usr.bin/c++/t_msan_free.sh src/tests/usr.bin/c++/t_msan_heap.sh \
    src/tests/usr.bin/c++/t_msan_partial_poison.sh \
    src/tests/usr.bin/c++/t_msan_poison.sh \
    src/tests/usr.bin/c++/t_msan_realloc.sh \
    src/tests/usr.bin/c++/t_msan_shadow.sh \
    src/tests/usr.bin/c++/t_msan_stack.sh \
    src/tests/usr.bin/c++/t_msan_unpoison.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/c++/t_call_once.sh \
    src/tests/usr.bin/c++/t_call_once2.sh \
    src/tests/usr.bin/c++/t_pthread_once.sh \
    src/tests/usr.bin/c++/t_static_destructor.sh
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/c++/t_cxxruntime.sh \
    src/tests/usr.bin/c++/t_hello.sh
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/c++/t_tsan_data_race.sh \
    src/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh \
    src/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh \
    src/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh \
    src/tests/usr.bin/c++/t_tsan_signal_errno.sh \
    src/tests/usr.bin/c++/t_tsan_thread_leak.sh \
    src/tests/usr.bin/c++/t_tsan_vptr_race.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/c++/ubsan_common.subr
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/cc/asan_common.subr
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/cc/t_fuzzer_oom.sh \
    src/tests/usr.bin/cc/t_fuzzer_simple.sh \
    src/tests/usr.bin/cc/t_fuzzer_timeout.sh \
    src/tests/usr.bin/cc/t_msan_allocated_memory.sh \
    src/tests/usr.bin/cc/t_msan_check_mem.sh \
    src/tests/usr.bin/cc/t_msan_free.sh src/tests/usr.bin/cc/t_msan_heap.sh \
    src/tests/usr.bin/cc/t_msan_partial_poison.sh \
    src/tests/usr.bin/cc/t_msan_poison.sh \
    src/tests/usr.bin/cc/t_msan_realloc.sh \
    src/tests/usr.bin/cc/t_msan_shadow.sh \
    src/tests/usr.bin/cc/t_msan_stack.sh \
    src/tests/usr.bin/cc/t_msan_unpoison.sh
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/cc/t_hello.sh
cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/cc/t_tsan_data_race.sh \
    src/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh \
    src/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh \
    src/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh \
    src/tests/usr.bin/cc/t_tsan_signal_errno.sh \
    src/tests/usr.bin/cc/t_tsan_thread_leak.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/cc/ubsan_common.subr

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/c++/asan_common.subr
diff -u src/tests/usr.bin/c++/asan_common.subr:1.3 src/tests/usr.bin/c++/asan_common.subr:1.4
--- src/tests/usr.bin/c++/asan_common.subr:1.3	Tue Oct 12 18:40:01 2021
+++ src/tests/usr.bin/c++/asan_common.subr	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: asan_common.subr,v 1.3 2021/10/12 18:40:01 skrll Exp $
+#	$NetBSD: asan_common.subr,v 1.4 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -93,7 +93,7 @@ asan_test_case() {
 
 	$1_profile_body() {
 		echo \"\$ASAN_CODE\" > test.cpp
-		c++ -fsanitize=address -o test -pg test.cpp
+		c++ -fsanitize=address -static -o test -pg test.cpp
 		paxctl +a test
 		atf_check -s not-exit:0 -o not-match:'CHECK\n' -e match:'$3' ./test
 	}
@@ -148,7 +148,7 @@ asan_test_case() {
 		atf_check -s not-exit:0 -o not-match:'CHECK\n' -e match:'$3' ./df32
 
 # and another test with profile 32bit binaries
-		c++ -fsanitize=address -o test -pg -m32 test.cpp
+		c++ -fsanitize=address -static -o test -pg -m32 test.cpp
 		paxctl +a test
 		atf_check -s not-exit:0 -o not-match:'CHECK\n' -e match:'$3' ./test
 	}"
Index: src/tests/usr.bin/c++/t_fuzzer_oom.sh
diff -u src/tests/usr.bin/c++/t_fuzzer_oom.sh:1.3 src/tests/usr.bin/c++/t_fuzzer_oom.sh:1.4
--- src/tests/usr.bin/c++/t_fuzzer_oom.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_fuzzer_oom.sh	Sun Jun 12 08:55:36 2022
@@ -90,7 +90,7 @@ extern "C" int LLVMFuzzerTestOneInput(co
 }
 EOF
 
-	c++ -fsanitize=fuzzer -o test -pg test.cc
+	c++ -fsanitize=fuzzer -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"ERROR: libFuzzer: out-of-memory" ./test -rss_limit_mb=30
 }
Index: src/tests/usr.bin/c++/t_fuzzer_simple.sh
diff -u src/tests/usr.bin/c++/t_fuzzer_simple.sh:1.3 src/tests/usr.bin/c++/t_fuzzer_simple.sh:1.4
--- src/tests/usr.bin/c++/t_fuzzer_simple.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_fuzzer_simple.sh	Sun Jun 12 08:55:36 2022
@@ -98,7 +98,7 @@ extern "C" int LLVMFuzzerTestOneInput(co
 }
 EOF
 
-	c++ -fsanitize=fuzzer -o test -pg test.cc
+	c++ -fsanitize=fuzzer -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"BINGO" ./test
 }
Index: src/tests/usr.bin/c++/t_fuzzer_timeout.sh
diff -u src/tests/usr.bin/c++/t_fuzzer_timeout.sh:1.3 src/tests/usr.bin/c++/t_fuzzer_timeout.sh:1.4
--- src/tests/usr.bin/c++/t_fuzzer_timeout.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_fuzzer_timeout.sh	Sun Jun 12 08:55:36 2022
@@ -88,7 +88,7 @@ extern "C" int LLVMFuzzerTestOneInput(co
 }
 EOF
 
-	c++ -fsanitize=fuzzer -o test -pg test.cc
+	c++ -fsanitize=fuzzer -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"ERROR: libFuzzer: timeout" ./test -timeout=5
 }
Index: src/tests/usr.bin/c++/t_msan_allocated_memory.sh
diff -u src/tests/usr.bin/c++/t_msan_allocated_memory.sh:1.3 src/tests/usr.bin/c++/t_msan_allocated_memory.sh:1.4
--- src/tests/usr.bin/c++/t_msan_allocated_memory.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_msan_allocated_memory.sh	Sun Jun 12 08:55:36 2022
@@ -90,7 +90,7 @@ int main() {
 }
 EOF
 
-	c++ -fsanitize=memory -o test -pg test.cc
+	c++ -fsanitize=memory -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: MemorySanitizer: use-of-uninitialized-value" ./test
 }
Index: src/tests/usr.bin/c++/t_msan_check_mem.sh
diff -u src/tests/usr.bin/c++/t_msan_check_mem.sh:1.3 src/tests/usr.bin/c++/t_msan_check_mem.sh:1.4
--- src/tests/usr.bin/c++/t_msan_check_mem.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_msan_check_mem.sh	Sun Jun 12 08:55:36 2022
@@ -92,7 +92,7 @@ int main(int argc, char **argv) {
 }
 EOF
 
-	c++ -fsanitize=memory -o test -pg test.cc
+	c++ -fsanitize=memory -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"Uninitialized bytes in __msan_check_mem_is_initialized at offset 0 inside" ./test
 }
Index: src/tests/usr.bin/c++/t_msan_free.sh
diff -u src/tests/usr.bin/c++/t_msan_free.sh:1.3 src/tests/usr.bin/c++/t_msan_free.sh:1.4
--- src/tests/usr.bin/c++/t_msan_free.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_msan_free.sh	Sun Jun 12 08:55:36 2022
@@ -88,7 +88,7 @@ int main() {
 }
 EOF
 
-	c++ -fsanitize=memory -o test -pg test.cc
+	c++ -fsanitize=memory -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: MemorySanitizer: use-of-uninitialized-value" ./test
 }
Index: src/tests/usr.bin/c++/t_msan_heap.sh
diff -u src/tests/usr.bin/c++/t_msan_heap.sh:1.3 src/tests/usr.bin/c++/t_msan_heap.sh:1.4
--- src/tests/usr.bin/c++/t_msan_heap.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_msan_heap.sh	Sun Jun 12 08:55:36 2022
@@ -78,7 +78,7 @@ heap_profile_body(){
 int main() { int *a = (int *)malloc(sizeof(int)); return *a; }
 EOF
 
-	c++ -fsanitize=memory -o test -pg test.cc
+	c++ -fsanitize=memory -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: MemorySanitizer: use-of-uninitialized-value" ./test
 }
Index: src/tests/usr.bin/c++/t_msan_partial_poison.sh
diff -u src/tests/usr.bin/c++/t_msan_partial_poison.sh:1.3 src/tests/usr.bin/c++/t_msan_partial_poison.sh:1.4
--- src/tests/usr.bin/c++/t_msan_partial_poison.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_msan_partial_poison.sh	Sun Jun 12 08:55:36 2022
@@ -94,7 +94,7 @@ int main(void) {
 }
 EOF
 
-	c++ -fsanitize=memory -o test -pg test.cc
+	c++ -fsanitize=memory -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:": 77654321" ./test
 }
Index: src/tests/usr.bin/c++/t_msan_poison.sh
diff -u src/tests/usr.bin/c++/t_msan_poison.sh:1.3 src/tests/usr.bin/c++/t_msan_poison.sh:1.4
--- src/tests/usr.bin/c++/t_msan_poison.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_msan_poison.sh	Sun Jun 12 08:55:36 2022
@@ -92,7 +92,7 @@ int main(void) {
 }
 EOF
 
-	c++ -fsanitize=memory -o test -pg test.cc
+	c++ -fsanitize=memory -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"Uninitialized bytes in __msan_check_mem_is_initialized at offset 5 inside" ./test
 }
Index: src/tests/usr.bin/c++/t_msan_realloc.sh
diff -u src/tests/usr.bin/c++/t_msan_realloc.sh:1.3 src/tests/usr.bin/c++/t_msan_realloc.sh:1.4
--- src/tests/usr.bin/c++/t_msan_realloc.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_msan_realloc.sh	Sun Jun 12 08:55:36 2022
@@ -90,7 +90,7 @@ int main(int argc, char **argv) {
 }
 EOF
 
-	c++ -fsanitize=memory -o test -pg test.cc
+	c++ -fsanitize=memory -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: MemorySanitizer: use-of-uninitialized-value" ./test
 }
Index: src/tests/usr.bin/c++/t_msan_shadow.sh
diff -u src/tests/usr.bin/c++/t_msan_shadow.sh:1.3 src/tests/usr.bin/c++/t_msan_shadow.sh:1.4
--- src/tests/usr.bin/c++/t_msan_shadow.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_msan_shadow.sh	Sun Jun 12 08:55:36 2022
@@ -100,7 +100,7 @@ int main(int argc, char **argv) {
 }
 EOF
 
-	c++ -fsanitize=memory -o test -pg test.cc
+	c++ -fsanitize=memory -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o match:"2" -e match:"00000000 ff000000" ./test
 }
Index: src/tests/usr.bin/c++/t_msan_stack.sh
diff -u src/tests/usr.bin/c++/t_msan_stack.sh:1.3 src/tests/usr.bin/c++/t_msan_stack.sh:1.4
--- src/tests/usr.bin/c++/t_msan_stack.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_msan_stack.sh	Sun Jun 12 08:55:36 2022
@@ -88,7 +88,7 @@ int main() {
 }
 EOF
 
-	c++ -fsanitize=memory -o test -pg test.cc
+	c++ -fsanitize=memory -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"MemorySanitizer: bad pointer" ./test
 }
Index: src/tests/usr.bin/c++/t_msan_unpoison.sh
diff -u src/tests/usr.bin/c++/t_msan_unpoison.sh:1.3 src/tests/usr.bin/c++/t_msan_unpoison.sh:1.4
--- src/tests/usr.bin/c++/t_msan_unpoison.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_msan_unpoison.sh	Sun Jun 12 08:55:36 2022
@@ -100,7 +100,7 @@ int main(void) {
 }
 EOF
 
-	c++ -fsanitize=memory -o test -pg test.cc
+	c++ -fsanitize=memory -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e not-match:"WARNING: MemorySanitizer: use-of-uninitialized-value" ./test
 }

Index: src/tests/usr.bin/c++/t_call_once.sh
diff -u src/tests/usr.bin/c++/t_call_once.sh:1.4 src/tests/usr.bin/c++/t_call_once.sh:1.5
--- src/tests/usr.bin/c++/t_call_once.sh:1.4	Tue Oct 13 06:49:27 2020
+++ src/tests/usr.bin/c++/t_call_once.sh	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_call_once.sh,v 1.4 2020/10/13 06:49:27 rin Exp $
+#	$NetBSD: t_call_once.sh,v 1.5 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2018 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -111,7 +111,7 @@ int main(void) {
         return 0;
 }
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -pg -o call_once test.cpp -pthread
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -pg -o call_once test.cpp -pthread
 	atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
 }
 
@@ -138,7 +138,7 @@ int main(void) {
         return 0;
 }
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -m32 -pg -o call_once test.cpp -pthread
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -m32 -pg -o call_once test.cpp -pthread
 	atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
 }
 
Index: src/tests/usr.bin/c++/t_call_once2.sh
diff -u src/tests/usr.bin/c++/t_call_once2.sh:1.4 src/tests/usr.bin/c++/t_call_once2.sh:1.5
--- src/tests/usr.bin/c++/t_call_once2.sh:1.4	Sat May  7 05:14:09 2022
+++ src/tests/usr.bin/c++/t_call_once2.sh	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_call_once2.sh,v 1.4 2022/05/07 05:14:09 rin Exp $
+#	$NetBSD: t_call_once2.sh,v 1.5 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2018 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -154,7 +154,7 @@ int main(void) {
         return 0;
 }
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -pg -o call_once2 test.cpp -pthread
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -pg -o call_once2 test.cpp -pthread
 	atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once2
 }
 
@@ -198,7 +198,7 @@ int main(void) {
         return 0;
 }
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -m32 -pg -o call_once2 test.cpp -pthread
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -m32 -pg -o call_once2 test.cpp -pthread
 	atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once2
 	atf_expect_fail "The combination of 32-bit and profiling should be fail"
 }
Index: src/tests/usr.bin/c++/t_pthread_once.sh
diff -u src/tests/usr.bin/c++/t_pthread_once.sh:1.4 src/tests/usr.bin/c++/t_pthread_once.sh:1.5
--- src/tests/usr.bin/c++/t_pthread_once.sh:1.4	Tue Oct 13 06:49:27 2020
+++ src/tests/usr.bin/c++/t_pthread_once.sh	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_pthread_once.sh,v 1.4 2020/10/13 06:49:27 rin Exp $
+#	$NetBSD: t_pthread_once.sh,v 1.5 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2018 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -109,7 +109,7 @@ int main(void) {
         return 0;
 }
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -pg -o pthread_once test.cpp -pthread
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -pg -o pthread_once test.cpp -pthread
 	atf_check -s exit:0 -o inline:"hello, world!\n" ./pthread_once
 }
 
@@ -135,7 +135,7 @@ int main(void) {
         return 0;
 }
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -m32 -pg -o pthread_once test.cpp -pthread
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -m32 -pg -o pthread_once test.cpp -pthread
 	atf_check -s exit:0 -o inline:"hello, world!\n" ./pthread_once
 }
 
Index: src/tests/usr.bin/c++/t_static_destructor.sh
diff -u src/tests/usr.bin/c++/t_static_destructor.sh:1.4 src/tests/usr.bin/c++/t_static_destructor.sh:1.5
--- src/tests/usr.bin/c++/t_static_destructor.sh:1.4	Tue Oct 13 06:49:27 2020
+++ src/tests/usr.bin/c++/t_static_destructor.sh	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_static_destructor.sh,v 1.4 2020/10/13 06:49:27 rin Exp $
+#	$NetBSD: t_static_destructor.sh,v 1.5 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -122,7 +122,7 @@ struct B {
 };
 int main(void) {struct B b;return 0;}
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -pg -o hello test.cpp
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -pg -o hello test.cpp
 	atf_check -s exit:0 -o inline:"CTOR A\nCTOR B\nDTOR B:10\nDTOR A:20\n" ./hello
 }
 
@@ -153,7 +153,7 @@ struct B {
 };
 int main(void) {struct B b;return 0;}
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -m32 -pg -o hello test.cpp
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -m32 -pg -o hello test.cpp
 	atf_check -s exit:0 -o inline:"CTOR A\nCTOR B\nDTOR B:10\nDTOR A:20\n" ./hello
 }
 

Index: src/tests/usr.bin/c++/t_cxxruntime.sh
diff -u src/tests/usr.bin/c++/t_cxxruntime.sh:1.5 src/tests/usr.bin/c++/t_cxxruntime.sh:1.6
--- src/tests/usr.bin/c++/t_cxxruntime.sh:1.5	Tue Oct 13 06:49:27 2020
+++ src/tests/usr.bin/c++/t_cxxruntime.sh	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cxxruntime.sh,v 1.5 2020/10/13 06:49:27 rin Exp $
+#	$NetBSD: t_cxxruntime.sh,v 1.6 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -104,7 +104,7 @@ cxxruntime_profile_body() {
 #include <iostream>
 int main(void) {std::cout << "hello world" << std::endl;exit(0);}
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -pg -o hello test.cpp
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -pg -o hello test.cpp
 	atf_check -s exit:0 -o inline:"hello world\n" ./hello
 }
 
@@ -126,7 +126,7 @@ cxxruntime_profile_32_body() {
 #include <iostream>
 int main(void) {std::cout << "hello world" << std::endl;exit(0);}
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -m32 -pg -o hello test.cpp
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -m32 -pg -o hello test.cpp
 	atf_check -s exit:0 -o inline:"hello world\n" ./hello
 }
 
Index: src/tests/usr.bin/c++/t_hello.sh
diff -u src/tests/usr.bin/c++/t_hello.sh:1.5 src/tests/usr.bin/c++/t_hello.sh:1.6
--- src/tests/usr.bin/c++/t_hello.sh:1.5	Tue Oct 13 06:49:27 2020
+++ src/tests/usr.bin/c++/t_hello.sh	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_hello.sh,v 1.5 2020/10/13 06:49:27 rin Exp $
+#	$NetBSD: t_hello.sh,v 1.6 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -101,7 +101,7 @@ hello_profile_body() {
 #include <stdlib.h>
 int main(void) {printf("hello world\n");exit(0);}
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -pg -o hello test.cpp
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -pg -o hello test.cpp
 	atf_check -s exit:0 -o inline:"hello world\n" ./hello
 }
 
@@ -122,7 +122,7 @@ hello_profile_32_body() {
 #include <stdlib.h>
 int main(void) {printf("hello world\n");exit(0);}
 EOF
-	atf_check -s exit:0 -o ignore -e ignore c++ -m32 -pg -o hello test.cpp
+	atf_check -s exit:0 -static -o ignore -e ignore c++ -m32 -pg -o hello test.cpp
 	atf_check -s exit:0 -o inline:"hello world\n" ./hello
 }
 

Index: src/tests/usr.bin/c++/t_tsan_data_race.sh
diff -u src/tests/usr.bin/c++/t_tsan_data_race.sh:1.6 src/tests/usr.bin/c++/t_tsan_data_race.sh:1.7
--- src/tests/usr.bin/c++/t_tsan_data_race.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_tsan_data_race.sh	Sun Jun 12 08:55:36 2022
@@ -95,7 +95,7 @@ int main() {
 }
 EOF
 
-	c++ -fsanitize=thread -o test -pg test.cc
+	c++ -fsanitize=thread -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: data race " ./test
 }
Index: src/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh
diff -u src/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh:1.6 src/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh:1.7
--- src/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh	Sun Jun 12 08:55:36 2022
@@ -130,7 +130,7 @@ int main() {
 }
 EOF
 
-	c++ -fsanitize=thread -o test -pg test.cc
+	c++ -fsanitize=thread -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: heap-use-after-free" ./test
 }
Index: src/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh
diff -u src/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh:1.6 src/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh:1.7
--- src/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh	Sun Jun 12 08:55:36 2022
@@ -106,7 +106,7 @@ int main() {
 }
 EOF
 
-	c++ -fsanitize=thread -o test -pg test.cc
+	c++ -fsanitize=thread -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: lock-order-inversion" ./test
 }
Index: src/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh
diff -u src/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh:1.6 src/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh:1.7
--- src/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh	Sun Jun 12 08:55:36 2022
@@ -114,7 +114,7 @@ int main() {
 }
 EOF
 
-	c++ -fsanitize=thread -o test -pg test.cc
+	c++ -fsanitize=thread -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: destroy of a locked mutex" ./test
 }
Index: src/tests/usr.bin/c++/t_tsan_signal_errno.sh
diff -u src/tests/usr.bin/c++/t_tsan_signal_errno.sh:1.6 src/tests/usr.bin/c++/t_tsan_signal_errno.sh:1.7
--- src/tests/usr.bin/c++/t_tsan_signal_errno.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_tsan_signal_errno.sh	Sun Jun 12 08:55:36 2022
@@ -107,7 +107,7 @@ int main() {
 }
 EOF
 
-	c++ -fsanitize=thread -o test -pg test.cc
+	c++ -fsanitize=thread -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: signal handler spoils errno" ./test
 }
Index: src/tests/usr.bin/c++/t_tsan_thread_leak.sh
diff -u src/tests/usr.bin/c++/t_tsan_thread_leak.sh:1.6 src/tests/usr.bin/c++/t_tsan_thread_leak.sh:1.7
--- src/tests/usr.bin/c++/t_tsan_thread_leak.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_tsan_thread_leak.sh	Sun Jun 12 08:55:36 2022
@@ -107,7 +107,7 @@ int main() {
 }
 EOF
 
-	c++ -fsanitize=thread -o test -pg test.cc
+	c++ -fsanitize=thread -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: thread leak" ./test
 }
Index: src/tests/usr.bin/c++/t_tsan_vptr_race.sh
diff -u src/tests/usr.bin/c++/t_tsan_vptr_race.sh:1.6 src/tests/usr.bin/c++/t_tsan_vptr_race.sh:1.7
--- src/tests/usr.bin/c++/t_tsan_vptr_race.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/c++/t_tsan_vptr_race.sh	Sun Jun 12 08:55:36 2022
@@ -120,7 +120,7 @@ int main() {
 }
 EOF
 
-	c++ -fsanitize=thread -o test -pg test.cc
+	c++ -fsanitize=thread -static -o test -pg test.cc
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: data race on vptr \(ctor/dtor vs virtual call\)" ./test
 }

Index: src/tests/usr.bin/c++/ubsan_common.subr
diff -u src/tests/usr.bin/c++/ubsan_common.subr:1.1 src/tests/usr.bin/c++/ubsan_common.subr:1.2
--- src/tests/usr.bin/c++/ubsan_common.subr:1.1	Tue Jan 29 20:07:03 2019
+++ src/tests/usr.bin/c++/ubsan_common.subr	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: ubsan_common.subr,v 1.1 2019/01/29 20:07:03 mgorny Exp $
+#	$NetBSD: ubsan_common.subr,v 1.2 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -91,7 +91,7 @@ ubsan_test_case() {
 
 	$1_profile_body() {
 		echo \"\$UBSAN_CODE\" > test.cpp
-		c++ -fsanitize=undefined -o test -pg test.cpp
+		c++ -fsanitize=undefined -static -o test -pg test.cpp
 		atf_check -s ignore -e match:'$3' ./test
 	}
 
@@ -142,7 +142,7 @@ ubsan_test_case() {
 		atf_check -s ignore -e match:'$3' ./df32
 
 # and another test with profile 32bit binaries
-		c++ -fsanitize=undefined -o test -pg -m32 test.cpp
+		c++ -fsanitize=undefined -static -o test -pg -m32 test.cpp
 		atf_check -s ignore -e match:'$3' ./test
 	}"
 }

Index: src/tests/usr.bin/cc/asan_common.subr
diff -u src/tests/usr.bin/cc/asan_common.subr:1.2 src/tests/usr.bin/cc/asan_common.subr:1.3
--- src/tests/usr.bin/cc/asan_common.subr:1.2	Tue Oct 12 18:40:01 2021
+++ src/tests/usr.bin/cc/asan_common.subr	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: asan_common.subr,v 1.2 2021/10/12 18:40:01 skrll Exp $
+#	$NetBSD: asan_common.subr,v 1.3 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -93,7 +93,7 @@ asan_test_case() {
 
 	$1_profile_body() {
 		echo \"\$ASAN_CODE\" > test.c
-		cc -fsanitize=address -o test -pg test.c
+		cc -fsanitize=address -static -o test -pg test.c
 		paxctl +a test
 		atf_check -s not-exit:0 -o not-match:'CHECK\n' -e match:'$3' ./test
 	}
@@ -148,7 +148,7 @@ asan_test_case() {
 		atf_check -s not-exit:0 -o not-match:'CHECK\n' -e match:'$3' ./df32
 
 # and another test with profile 32bit binaries
-		cc -fsanitize=address -o test -pg -m32 test.c
+		cc -fsanitize=address -static -o test -pg -m32 test.c
 		paxctl +a test
 		atf_check -s not-exit:0 -o not-match:'CHECK\n' -e match:'$3' ./test
 	}"

Index: src/tests/usr.bin/cc/t_fuzzer_oom.sh
diff -u src/tests/usr.bin/cc/t_fuzzer_oom.sh:1.3 src/tests/usr.bin/cc/t_fuzzer_oom.sh:1.4
--- src/tests/usr.bin/cc/t_fuzzer_oom.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_fuzzer_oom.sh	Sun Jun 12 08:55:36 2022
@@ -90,7 +90,7 @@ int LLVMFuzzerTestOneInput(const uint8_t
 }
 EOF
 
-	cc -fsanitize=fuzzer -o test -pg test.c
+	cc -fsanitize=fuzzer -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"ERROR: libFuzzer: out-of-memory" ./test -rss_limit_mb=30
 }
Index: src/tests/usr.bin/cc/t_fuzzer_simple.sh
diff -u src/tests/usr.bin/cc/t_fuzzer_simple.sh:1.3 src/tests/usr.bin/cc/t_fuzzer_simple.sh:1.4
--- src/tests/usr.bin/cc/t_fuzzer_simple.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_fuzzer_simple.sh	Sun Jun 12 08:55:36 2022
@@ -98,7 +98,7 @@ int LLVMFuzzerTestOneInput(const uint8_t
 }
 EOF
 
-	cc -fsanitize=fuzzer -o test -pg test.c
+	cc -fsanitize=fuzzer -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"BINGO" ./test
 }
Index: src/tests/usr.bin/cc/t_fuzzer_timeout.sh
diff -u src/tests/usr.bin/cc/t_fuzzer_timeout.sh:1.3 src/tests/usr.bin/cc/t_fuzzer_timeout.sh:1.4
--- src/tests/usr.bin/cc/t_fuzzer_timeout.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_fuzzer_timeout.sh	Sun Jun 12 08:55:36 2022
@@ -88,7 +88,7 @@ int LLVMFuzzerTestOneInput(const uint8_t
 }
 EOF
 
-	cc -fsanitize=fuzzer -o test -pg test.c
+	cc -fsanitize=fuzzer -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"ERROR: libFuzzer: timeout" ./test -timeout=5
 }
Index: src/tests/usr.bin/cc/t_msan_allocated_memory.sh
diff -u src/tests/usr.bin/cc/t_msan_allocated_memory.sh:1.3 src/tests/usr.bin/cc/t_msan_allocated_memory.sh:1.4
--- src/tests/usr.bin/cc/t_msan_allocated_memory.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_msan_allocated_memory.sh	Sun Jun 12 08:55:36 2022
@@ -90,7 +90,7 @@ int main() {
 }
 EOF
 
-	cc -fsanitize=memory -o test -pg test.c
+	cc -fsanitize=memory -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: MemorySanitizer: use-of-uninitialized-value" ./test
 }
Index: src/tests/usr.bin/cc/t_msan_check_mem.sh
diff -u src/tests/usr.bin/cc/t_msan_check_mem.sh:1.3 src/tests/usr.bin/cc/t_msan_check_mem.sh:1.4
--- src/tests/usr.bin/cc/t_msan_check_mem.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_msan_check_mem.sh	Sun Jun 12 08:55:36 2022
@@ -92,7 +92,7 @@ int main(int argc, char **argv) {
 }
 EOF
 
-	cc -fsanitize=memory -o test -pg test.c
+	cc -fsanitize=memory -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"Uninitialized bytes in __msan_check_mem_is_initialized at offset 0 inside" ./test
 }
Index: src/tests/usr.bin/cc/t_msan_free.sh
diff -u src/tests/usr.bin/cc/t_msan_free.sh:1.3 src/tests/usr.bin/cc/t_msan_free.sh:1.4
--- src/tests/usr.bin/cc/t_msan_free.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_msan_free.sh	Sun Jun 12 08:55:36 2022
@@ -88,7 +88,7 @@ int main() {
 }
 EOF
 
-	cc -fsanitize=memory -o test -pg test.c
+	cc -fsanitize=memory -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: MemorySanitizer: use-of-uninitialized-value" ./test
 }
Index: src/tests/usr.bin/cc/t_msan_heap.sh
diff -u src/tests/usr.bin/cc/t_msan_heap.sh:1.3 src/tests/usr.bin/cc/t_msan_heap.sh:1.4
--- src/tests/usr.bin/cc/t_msan_heap.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_msan_heap.sh	Sun Jun 12 08:55:36 2022
@@ -78,7 +78,7 @@ heap_profile_body(){
 int main() { int *a = (int *)malloc(sizeof(int)); return *a; }
 EOF
 
-	cc -fsanitize=memory -o test -pg test.c
+	cc -fsanitize=memory -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: MemorySanitizer: use-of-uninitialized-value" ./test
 }
Index: src/tests/usr.bin/cc/t_msan_partial_poison.sh
diff -u src/tests/usr.bin/cc/t_msan_partial_poison.sh:1.3 src/tests/usr.bin/cc/t_msan_partial_poison.sh:1.4
--- src/tests/usr.bin/cc/t_msan_partial_poison.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_msan_partial_poison.sh	Sun Jun 12 08:55:36 2022
@@ -94,7 +94,7 @@ int main(void) {
 }
 EOF
 
-	cc -fsanitize=memory -o test -pg test.c
+	cc -fsanitize=memory -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:": 77654321" ./test
 }
Index: src/tests/usr.bin/cc/t_msan_poison.sh
diff -u src/tests/usr.bin/cc/t_msan_poison.sh:1.3 src/tests/usr.bin/cc/t_msan_poison.sh:1.4
--- src/tests/usr.bin/cc/t_msan_poison.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_msan_poison.sh	Sun Jun 12 08:55:36 2022
@@ -92,7 +92,7 @@ int main(void) {
 }
 EOF
 
-	cc -fsanitize=memory -o test -pg test.c
+	cc -fsanitize=memory -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"Uninitialized bytes in __msan_check_mem_is_initialized at offset 5 inside" ./test
 }
Index: src/tests/usr.bin/cc/t_msan_realloc.sh
diff -u src/tests/usr.bin/cc/t_msan_realloc.sh:1.3 src/tests/usr.bin/cc/t_msan_realloc.sh:1.4
--- src/tests/usr.bin/cc/t_msan_realloc.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_msan_realloc.sh	Sun Jun 12 08:55:36 2022
@@ -90,7 +90,7 @@ int main(int argc, char **argv) {
 }
 EOF
 
-	cc -fsanitize=memory -o test -pg test.c
+	cc -fsanitize=memory -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: MemorySanitizer: use-of-uninitialized-value" ./test
 }
Index: src/tests/usr.bin/cc/t_msan_shadow.sh
diff -u src/tests/usr.bin/cc/t_msan_shadow.sh:1.3 src/tests/usr.bin/cc/t_msan_shadow.sh:1.4
--- src/tests/usr.bin/cc/t_msan_shadow.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_msan_shadow.sh	Sun Jun 12 08:55:36 2022
@@ -100,7 +100,7 @@ int main(int argc, char **argv) {
 }
 EOF
 
-	cc -fsanitize=memory -o test -pg test.c
+	cc -fsanitize=memory -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o match:"2" -e match:"00000000 ff000000" ./test
 }
Index: src/tests/usr.bin/cc/t_msan_stack.sh
diff -u src/tests/usr.bin/cc/t_msan_stack.sh:1.3 src/tests/usr.bin/cc/t_msan_stack.sh:1.4
--- src/tests/usr.bin/cc/t_msan_stack.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_msan_stack.sh	Sun Jun 12 08:55:36 2022
@@ -88,7 +88,7 @@ int main() {
 }
 EOF
 
-	cc -fsanitize=memory -o test -pg test.c
+	cc -fsanitize=memory -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"MemorySanitizer: bad pointer" ./test
 }
Index: src/tests/usr.bin/cc/t_msan_unpoison.sh
diff -u src/tests/usr.bin/cc/t_msan_unpoison.sh:1.3 src/tests/usr.bin/cc/t_msan_unpoison.sh:1.4
--- src/tests/usr.bin/cc/t_msan_unpoison.sh:1.3	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_msan_unpoison.sh	Sun Jun 12 08:55:36 2022
@@ -100,7 +100,7 @@ int main(void) {
 }
 EOF
 
-	cc -fsanitize=memory -o test -pg test.c
+	cc -fsanitize=memory -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e not-match:"WARNING: MemorySanitizer: use-of-uninitialized-value" ./test
 }

Index: src/tests/usr.bin/cc/t_hello.sh
diff -u src/tests/usr.bin/cc/t_hello.sh:1.10 src/tests/usr.bin/cc/t_hello.sh:1.11
--- src/tests/usr.bin/cc/t_hello.sh:1.10	Tue Oct 13 06:49:27 2020
+++ src/tests/usr.bin/cc/t_hello.sh	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_hello.sh,v 1.10 2020/10/13 06:49:27 rin Exp $
+#	$NetBSD: t_hello.sh,v 1.11 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -71,7 +71,7 @@ hello_profile_body() {
 #include <stdlib.h>
 int main(void) {printf("hello world\n");exit(0);}
 EOF
-	atf_check -s exit:0 -o ignore -e ignore cc -o hello -pg test.c
+	atf_check -s exit:0 -static -o ignore -e ignore cc -o hello -pg test.c
 	atf_check -s exit:0 -o inline:"hello world\n" ./hello
 	atf_check -s exit:0 -o ignore -e ignore cc -o hello2 -fprofile-generate test.c
 	atf_check -s exit:0 -o inline:"hello world\n" ./hello2

Index: src/tests/usr.bin/cc/t_tsan_data_race.sh
diff -u src/tests/usr.bin/cc/t_tsan_data_race.sh:1.6 src/tests/usr.bin/cc/t_tsan_data_race.sh:1.7
--- src/tests/usr.bin/cc/t_tsan_data_race.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_tsan_data_race.sh	Sun Jun 12 08:55:36 2022
@@ -95,7 +95,7 @@ int main() {
 }
 EOF
 
-	cc -fsanitize=thread -o test -pg test.c
+	cc -fsanitize=thread -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: data race " ./test
 }
Index: src/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh
diff -u src/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh:1.6 src/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh:1.7
--- src/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh	Sun Jun 12 08:55:36 2022
@@ -113,7 +113,7 @@ int main() {
 }
 EOF
 
-	cc -fsanitize=thread -o test -pg test.c
+	cc -fsanitize=thread -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: heap-use-after-free" ./test
 }
Index: src/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh
diff -u src/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh:1.6 src/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh:1.7
--- src/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh	Sun Jun 12 08:55:36 2022
@@ -105,7 +105,7 @@ int main() {
 }
 EOF
 
-	cc -fsanitize=thread -o test -pg test.c
+	cc -fsanitize=thread -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: lock-order-inversion" ./test
 }
Index: src/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh
diff -u src/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh:1.6 src/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh:1.7
--- src/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh	Sun Jun 12 08:55:36 2022
@@ -113,7 +113,7 @@ int main() {
 }
 EOF
 
-	cc -fsanitize=thread -o test -pg test.c
+	cc -fsanitize=thread -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: destroy of a locked mutex" ./test
 }
Index: src/tests/usr.bin/cc/t_tsan_signal_errno.sh
diff -u src/tests/usr.bin/cc/t_tsan_signal_errno.sh:1.6 src/tests/usr.bin/cc/t_tsan_signal_errno.sh:1.7
--- src/tests/usr.bin/cc/t_tsan_signal_errno.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_tsan_signal_errno.sh	Sun Jun 12 08:55:36 2022
@@ -107,7 +107,7 @@ int main() {
 }
 EOF
 
-	cc -fsanitize=thread -o test -pg test.c
+	cc -fsanitize=thread -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: signal handler spoils errno" ./test
 }
Index: src/tests/usr.bin/cc/t_tsan_thread_leak.sh
diff -u src/tests/usr.bin/cc/t_tsan_thread_leak.sh:1.6 src/tests/usr.bin/cc/t_tsan_thread_leak.sh:1.7
--- src/tests/usr.bin/cc/t_tsan_thread_leak.sh:1.6	Thu Jun  2 07:31:35 2022
+++ src/tests/usr.bin/cc/t_tsan_thread_leak.sh	Sun Jun 12 08:55:36 2022
@@ -107,7 +107,7 @@ int main() {
 }
 EOF
 
-	cc -fsanitize=thread -o test -pg test.c
+	cc -fsanitize=thread -static -o test -pg test.c
 	paxctl +a test
 	atf_check -s ignore -o ignore -e match:"WARNING: ThreadSanitizer: thread leak" ./test
 }

Index: src/tests/usr.bin/cc/ubsan_common.subr
diff -u src/tests/usr.bin/cc/ubsan_common.subr:1.1 src/tests/usr.bin/cc/ubsan_common.subr:1.2
--- src/tests/usr.bin/cc/ubsan_common.subr:1.1	Tue Jan 29 19:59:10 2019
+++ src/tests/usr.bin/cc/ubsan_common.subr	Sun Jun 12 08:55:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: ubsan_common.subr,v 1.1 2019/01/29 19:59:10 mgorny Exp $
+#	$NetBSD: ubsan_common.subr,v 1.2 2022/06/12 08:55:36 skrll Exp $
 #
 # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -91,7 +91,7 @@ ubsan_test_case() {
 
 	$1_profile_body() {
 		echo \"\$UBSAN_CODE\" > test.c
-		cc -fsanitize=undefined -o test -pg test.c
+		cc -fsanitize=undefined -static -o test -pg test.c
 		atf_check -s ignore -e match:'$3' ./test
 	}
 
@@ -142,7 +142,7 @@ ubsan_test_case() {
 		atf_check -s ignore -e match:'$3' ./df32
 
 # and another test with profile 32bit binaries
-		cc -fsanitize=undefined -o test -pg -m32 test.c
+		cc -fsanitize=undefined -static -o test -pg -m32 test.c
 		atf_check -s ignore -e match:'$3' ./test
 	}"
 }

Reply via email to