diff options
Diffstat (limited to 'ld/testsuite/config/default.exp')
-rw-r--r-- | ld/testsuite/config/default.exp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp index 5b7ca7a..4f0b76d 100644 --- a/ld/testsuite/config/default.exp +++ b/ld/testsuite/config/default.exp @@ -579,3 +579,41 @@ if { ![info exists STATIC_PIE_LDFLAGS] } then { set STATIC_PIE_LDFLAGS "" } } + +# Set NOSANTIZE_CFLAGS to "-fno-sanitize=all" if target compiler +# supports it. + +if { ![info exists NOSANTIZE_CFLAGS] } then { + if { [check_compiler_available] } { + # Check if gcc supports -fno-sanitize=all. + set flags "" + if [board_info [target_info name] exists cflags] { + append flags " [board_info [target_info name] cflags]" + } + if [board_info [target_info name] exists ldflags] { + append flags " [board_info [target_info name] ldflags]" + } + + set basename "tmpdir/available[pid]" + set src ${basename}.c + set output ${basename} + set f [open $src "w"] + puts $f "int main (void) { return 0; }" + close $f + if [is_remote host] { + set src [remote_download host $src] + } + set available [run_host_cmd_yesno "$CC" "$flags -fno-sanitize=all $src -o $output"] + remote_file host delete $src + remote_file host delete $output + file delete $src + + if { $available == 1 } then { + set NOSANTIZE_CFLAGS "-fno-sanitize=all" + } else { + set NOSANTIZE_CFLAGS "" + } + } else { + set NOSANTIZE_CFLAGS "" + } +} |