x86: Run GNU2 TLS tests with working GNU2 TLS support
Check if GNU2 TLS really works before running GNU2 TLS tests. * testsuite/ld-i386/tls.exp: Run GNU2 TLS tests only if there is working GNU2 TLS support. * testsuite/ld-x86-64/tls.exp: Likewise. * testsuite/lib/ld-lib.exp (check_gnu2_tls_available): New proc.
This commit is contained in:
parent
3f380b5027
commit
0aae7e72a2
@ -1,3 +1,10 @@
|
|||||||
|
2017-05-01 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* testsuite/ld-i386/tls.exp: Run GNU2 TLS tests only if there
|
||||||
|
is working GNU2 TLS support.
|
||||||
|
* testsuite/ld-x86-64/tls.exp: Likewise.
|
||||||
|
* testsuite/lib/ld-lib.exp (check_gnu2_tls_available): New proc.
|
||||||
|
|
||||||
2017-04-28 H.J. Lu <hongjiu.lu@intel.com>
|
2017-04-28 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* testsuite/config/default.exp (GNU2_CFLAGS): New. Set
|
* testsuite/config/default.exp (GNU2_CFLAGS): New. Set
|
||||||
|
@ -177,6 +177,11 @@ run_ld_link_exec_tests [list \
|
|||||||
] \
|
] \
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Run-time tests which require working GNU2 TLS support.
|
||||||
|
if { ![check_gnu2_tls_available] } {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
run_cc_link_tests [list \
|
run_cc_link_tests [list \
|
||||||
[list \
|
[list \
|
||||||
"Build libtlsdesc1.so" \
|
"Build libtlsdesc1.so" \
|
||||||
|
@ -201,6 +201,11 @@ run_cc_link_tests [list \
|
|||||||
] \
|
] \
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Run-time tests which require working GNU2 TLS support.
|
||||||
|
if { ![check_gnu2_tls_available] } {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
run_ld_link_exec_tests [list \
|
run_ld_link_exec_tests [list \
|
||||||
[list \
|
[list \
|
||||||
"Run tlsdesc1" \
|
"Run tlsdesc1" \
|
||||||
|
@ -2210,3 +2210,67 @@ proc check_libdl_available { } {
|
|||||||
}
|
}
|
||||||
return $libdl_available_saved
|
return $libdl_available_saved
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Returns true if GNU2 TLS works.
|
||||||
|
|
||||||
|
proc check_gnu2_tls_available { } {
|
||||||
|
global gnu2_tls_available_saved
|
||||||
|
global CC
|
||||||
|
global GNU2_CFLAGS
|
||||||
|
|
||||||
|
if {![info exists gnu2_tls_available_saved]} {
|
||||||
|
if { [which $CC] == 0 || "$GNU2_CFLAGS" == "" } {
|
||||||
|
set gnu2_tls_available_saved 0
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
# Check if GNU2 TLS works.
|
||||||
|
set flags "$GNU2_CFLAGS"
|
||||||
|
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/gnu2_tls[pid]"
|
||||||
|
set src1 ${basename}1.c
|
||||||
|
set output1 ${basename}.so
|
||||||
|
set f [open $src1 "w"]
|
||||||
|
puts $f "extern __thread int zzz;"
|
||||||
|
puts $f "int foo (void)"
|
||||||
|
puts $f "{"
|
||||||
|
puts $f " return zzz;"
|
||||||
|
puts $f "}"
|
||||||
|
close $f
|
||||||
|
if [is_remote host] {
|
||||||
|
set src1 [remote_download host $src1]
|
||||||
|
}
|
||||||
|
set src2 ${basename}2.c
|
||||||
|
set output2 ${basename}.exe
|
||||||
|
set f [open $src2 "w"]
|
||||||
|
puts $f "__thread int zzz = 20;"
|
||||||
|
puts $f "extern int foo (void);"
|
||||||
|
puts $f "int main (void)"
|
||||||
|
puts $f "{"
|
||||||
|
puts $f " if (foo () != 20) __builtin_abort ();"
|
||||||
|
puts $f " return 0; "
|
||||||
|
puts $f "}"
|
||||||
|
close $f
|
||||||
|
if [is_remote host] {
|
||||||
|
set src2 [remote_download host $src2]
|
||||||
|
}
|
||||||
|
set gnu2_tls_available_saved [run_host_cmd_yesno "$CC" "-fPIC -shared $flags $src1 -o $output1"]
|
||||||
|
if { $gnu2_tls_available_saved == 1 } {
|
||||||
|
set gnu2_tls_available_saved [run_host_cmd_yesno "$CC" "$flags $src2 $output1 -o $output2"]
|
||||||
|
if { $gnu2_tls_available_saved == 1 } {
|
||||||
|
set gnu2_tls_available_saved [run_host_cmd_yesno "$output2" ""]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
remote_file host delete $src1
|
||||||
|
remote_file host delete $output1
|
||||||
|
remote_file host delete $src2
|
||||||
|
remote_file host delete $output2
|
||||||
|
file delete $src1 $src2
|
||||||
|
}
|
||||||
|
return $gnu2_tls_available_saved
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user