return 0;
}
+proc run_host_noleak { prog command } {
+ global env
+ if [info exists env(ASAN_OPTIONS)] {
+ set old_asan "$env(ASAN_OPTIONS)"
+ }
+ # don't fail the test due to gcc plugin or ld memory leaks
+ set env(ASAN_OPTIONS) "detect_leaks=0"
+ set result [run_host_cmd_yesno "$prog" "$command"]
+ if [info exists old_asan] {
+ set env(ASAN_OPTIONS) "$old_asan"
+ } else {
+ unset env(ASAN_OPTIONS)
+ }
+ return $result
+}
+
# Link an object using relocation.
#
proc default_ld_relocate { ld target objects } {
if [is_remote host] {
set src [remote_download host $src]
}
- set compiler_available_saved [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $src -o $output"]
+ set compiler_available_saved [run_host_noleak "$CC_FOR_TARGET" "$flags $src -o $output"]
remote_file host delete $src
remote_file host delete $output
file delete $src
if [is_remote host] {
set src [remote_download host $src]
}
- set lto_available_saved [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags -flto -fuse-linker-plugin $src -o $output"]
+ set lto_available_saved [run_host_noleak "$CC_FOR_TARGET" "$flags -flto -fuse-linker-plugin $src -o $output"]
remote_file host delete $src
remote_file host delete $output
file delete $src
if [is_remote host] {
set src [remote_download host $src]
}
- set lto_fat_available_saved [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags -flto -ffat-lto-objects -fuse-linker-plugin $src -o $output"]
+ set lto_fat_available_saved [run_host_noleak "$CC_FOR_TARGET" "$flags -flto -ffat-lto-objects -fuse-linker-plugin $src -o $output"]
remote_file host delete $src
remote_file host delete $output
file delete $src
if [is_remote host] {
set src [remote_download host $src]
}
- set lto_shared_available_saved [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags -shared -fPIC -flto -fuse-linker-plugin $src -o $output"]
+ set lto_shared_available_saved [run_host_noleak "$CC_FOR_TARGET" "$flags -shared -fPIC -flto -fuse-linker-plugin $src -o $output"]
remote_file host delete $src
remote_file host delete $output
file delete $src
if [is_remote host] {
set src [remote_download host $src]
}
- set ifunc_available_saved [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $src -o $output"]
+ set ifunc_available_saved [run_host_noleak "$CC_FOR_TARGET" "$flags $src -o $output"]
if { [isnative] && $ifunc_available_saved == 1 } {
set ifunc_available_saved [run_host_cmd_yesno "$output" ""]
}
if [is_remote host] {
set src [remote_download host $src]
}
- set ifunc_attribute_available_saved [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $src -o $output"]
+ set ifunc_attribute_available_saved [run_host_noleak "$CC_FOR_TARGET" "$flags $src -o $output"]
if { [isnative] && $ifunc_attribute_available_saved == 1 } {
set ifunc_attribute_available_saved [run_host_cmd_yesno "$output" ""]
}
if [is_remote host] {
set src [remote_download host $src]
}
- set libdl_available_saved [run_host_cmd_yesno "$CC_FOR_TARGET" "$src -o $output -ldl"]
+ set libdl_available_saved [run_host_noleak "$CC_FOR_TARGET" "$src -o $output -ldl"]
remote_file host delete $src
remote_file host delete $output
file delete $src
if [is_remote host] {
set src2 [remote_download host $src2]
}
- set gnu2_tls_available_saved [run_host_cmd_yesno "$CC_FOR_TARGET" "-fPIC -shared $flags $src1 -o $output1"]
+ set gnu2_tls_available_saved [run_host_noleak "$CC_FOR_TARGET" "-fPIC -shared $flags $src1 -o $output1"]
if { $gnu2_tls_available_saved == 1 } {
- set gnu2_tls_available_saved [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $src2 $output1 -o $output2"]
+ set gnu2_tls_available_saved [run_host_noleak "$CC_FOR_TARGET" "$flags $src2 $output1 -o $output2"]
if { $gnu2_tls_available_saved == 1 } {
- set gnu2_tls_available_saved [run_host_cmd_yesno "$output2" ""]
+ set gnu2_tls_available_saved [run_host_noleak "$output2" ""]
}
}
remote_file host delete $src1
if [is_remote host] {
set src [remote_download host $src]
}
- return [run_host_cmd_yesno "$CC_FOR_TARGET" "$flags $CFLAGS_FOR_TARGET $additional_flags $src -o $output"]
+ return [run_host_noleak "$CC_FOR_TARGET" "$flags $CFLAGS_FOR_TARGET $additional_flags $src -o $output"]
}
# Returns true if the target compiler supports -gctf.