mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-03-01 13:26:47 +08:00
Use better test for usable compiler in ld testsuite.
The ld testsuite includes numerous tests that depend on being able to compile and link programs with the C compiler. Some of these tests use [which $CC] to check for the presence of the compiler before proceeding with the test, but run_ld_link_exec_tests and run_cc_link_tests give ERRORs if compilation fails. Also, even if $CC is defined and present, it may not be usable due to missing libraries, etc. This patch adds a new procedure check_compiler_available that attempts to build an empty program and caches the result. Uses of [which $CC] are replaced with calls to this procedure, and run_ld_link_exec_tests and run_cc_link_tests now also guard attempts to use $CC. 2019-04-24 Sandra Loosemore <sandra@codesourcery.com> ld/ * testsuite/config/default.exp: Use [check_compiler_available] instead of [which $CC]. * testsuite/ld-auto-import/auto-import.exp: Likewise. * testsuite/ld-cygwin/exe-export.exp: Likewise. * testsuite/ld-elf/audit.exp: Likewise. * testsuite/ld-elf/compress.exp: Likewise. * testsuite/ld-elf/dwarf.exp: Likewise. * testsuite/ld-elf/elf.exp: Likewise. * testsuite/ld-elf/indirect.exp: Likewise. * testsuite/ld-elf/linux-x86.exp: Likewise. * testsuite/ld-elf/shared.exp: Likewise. * testsuite/ld-elf/tls.exp: Likewise. * testsuite/ld-elf/wrap.exp: Likewise. * testsuite/ld-elfcomm/elfcomm.exp: Likewise. * testsuite/ld-elfvers/vers.exp: Likewise. * testsuite/ld-elfvsb/elfvsb.exp: Likewise. * testsuite/ld-elfweak/elfweak.exp: Likewise. * testsuite/ld-gc/gc.exp: Likewise. * testsuite/ld-i386/i386.exp: Likewise. * testsuite/ld-i386/no-plt.exp: Likewise. * testsuite/ld-i386/tls.exp: Likewise. * testsuite/ld-ifunc/ifunc.exp: Likewise. * testsuite/ld-mn10300/mn10300.exp: Likewise. * testsuite/ld-pe/pe-compile.exp: Likewise. * testsuite/ld-pe/pe-run.exp: Likewise. * testsuite/ld-pe/pe-run2.exp: Likewise. * testsuite/ld-pie/pie.exp: Likewise. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-plugin/plugin.exp: Likewise. * testsuite/ld-scripts/crossref.exp: Likewise. * testsuite/ld-sh/sh.exp: Likewise. * testsuite/ld-shared/shared.exp: Likewise. * testsuite/ld-size/size.exp: Likewise. * testsuite/ld-srec/srec.exp: Likewise. * testsuite/ld-undefined/undefined.exp: Likewise. * testsuite/ld-unique/unique.exp: Likewise. * testsuite/ld-x86-64/mpx.exp: Likewise. * testsuite/ld-x86-64/no-plt.exp: Likewise. * testsuite/ld-x86-64/tls.exp: Likewise. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Call check_compiler_available before trying to use the compiler. (run_cc_link_tests): Likewise. (check_compiler_available): New. Use it instead of [which $CC].
This commit is contained in:
parent
596179f77c
commit
44ed80923a
47
ld/ChangeLog
47
ld/ChangeLog
@ -1,3 +1,50 @@
|
||||
2019-04-24 Sandra Loosemore <sandra@codesourcery.com>
|
||||
|
||||
* testsuite/config/default.exp: Use [check_compiler_available]
|
||||
instead of [which $CC].
|
||||
* testsuite/ld-auto-import/auto-import.exp: Likewise.
|
||||
* testsuite/ld-cygwin/exe-export.exp: Likewise.
|
||||
* testsuite/ld-elf/audit.exp: Likewise.
|
||||
* testsuite/ld-elf/compress.exp: Likewise.
|
||||
* testsuite/ld-elf/dwarf.exp: Likewise.
|
||||
* testsuite/ld-elf/elf.exp: Likewise.
|
||||
* testsuite/ld-elf/indirect.exp: Likewise.
|
||||
* testsuite/ld-elf/linux-x86.exp: Likewise.
|
||||
* testsuite/ld-elf/shared.exp: Likewise.
|
||||
* testsuite/ld-elf/tls.exp: Likewise.
|
||||
* testsuite/ld-elf/wrap.exp: Likewise.
|
||||
* testsuite/ld-elfcomm/elfcomm.exp: Likewise.
|
||||
* testsuite/ld-elfvers/vers.exp: Likewise.
|
||||
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
|
||||
* testsuite/ld-elfweak/elfweak.exp: Likewise.
|
||||
* testsuite/ld-gc/gc.exp: Likewise.
|
||||
* testsuite/ld-i386/i386.exp: Likewise.
|
||||
* testsuite/ld-i386/no-plt.exp: Likewise.
|
||||
* testsuite/ld-i386/tls.exp: Likewise.
|
||||
* testsuite/ld-ifunc/ifunc.exp: Likewise.
|
||||
* testsuite/ld-mn10300/mn10300.exp: Likewise.
|
||||
* testsuite/ld-pe/pe-compile.exp: Likewise.
|
||||
* testsuite/ld-pe/pe-run.exp: Likewise.
|
||||
* testsuite/ld-pe/pe-run2.exp: Likewise.
|
||||
* testsuite/ld-pie/pie.exp: Likewise.
|
||||
* testsuite/ld-plugin/lto.exp: Likewise.
|
||||
* testsuite/ld-plugin/plugin.exp: Likewise.
|
||||
* testsuite/ld-scripts/crossref.exp: Likewise.
|
||||
* testsuite/ld-sh/sh.exp: Likewise.
|
||||
* testsuite/ld-shared/shared.exp: Likewise.
|
||||
* testsuite/ld-size/size.exp: Likewise.
|
||||
* testsuite/ld-srec/srec.exp: Likewise.
|
||||
* testsuite/ld-undefined/undefined.exp: Likewise.
|
||||
* testsuite/ld-unique/unique.exp: Likewise.
|
||||
* testsuite/ld-x86-64/mpx.exp: Likewise.
|
||||
* testsuite/ld-x86-64/no-plt.exp: Likewise.
|
||||
* testsuite/ld-x86-64/tls.exp: Likewise.
|
||||
* testsuite/ld-x86-64/x86-64.exp: Likewise.
|
||||
* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Call
|
||||
check_compiler_available before trying to use the compiler.
|
||||
(run_cc_link_tests): Likewise.
|
||||
(check_compiler_available): New. Use it instead of [which $CC].
|
||||
|
||||
2019-04-23 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* Makefile.am (GENDEPDIR): New var, used..
|
||||
|
@ -269,7 +269,7 @@ if { ![info exists LD_CLASS] } then {
|
||||
# Set PLT_CFLAGS to "-fplt" if target compiler supports it.
|
||||
|
||||
if { ![info exists PLT_CFLAGS] } then {
|
||||
if { [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
# Check if gcc supports -fplt
|
||||
set flags ""
|
||||
if [board_info [target_info name] exists cflags] {
|
||||
@ -307,7 +307,7 @@ if { ![info exists PLT_CFLAGS] } then {
|
||||
# target compiler supports them.
|
||||
|
||||
if { ![info exists NOPIE_CFLAGS] || ![info exists NOPIE_LDFLAGS] } then {
|
||||
if { [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
# Check if gcc supports -fno-PIE -no-pie.
|
||||
set flags ""
|
||||
if [board_info [target_info name] exists cflags] {
|
||||
@ -347,7 +347,7 @@ if { ![info exists NOPIE_CFLAGS] || ![info exists NOPIE_LDFLAGS] } then {
|
||||
# Set GNU2_CFLAGS to "-mtls-dialect=gnu2" if target compiler supports it.
|
||||
|
||||
if { ![info exists GNU2_CFLAGS] } then {
|
||||
if { [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
# Check if gcc supports -mtls-dialect=gnu2
|
||||
set flags ""
|
||||
if [board_info [target_info name] exists cflags] {
|
||||
@ -384,7 +384,7 @@ if { ![info exists GNU2_CFLAGS] } then {
|
||||
# Set INT128_CFLAGS to "-DHAS_INT128" if target compiler supports __int128.
|
||||
|
||||
if { ![info exists INT128_CFLAGS] } then {
|
||||
if { [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
# Check if gcc supports __int128.
|
||||
set flags ""
|
||||
if [board_info [target_info name] exists cflags] {
|
||||
@ -421,7 +421,7 @@ if { ![info exists INT128_CFLAGS] } then {
|
||||
# Set STATIC_LDFLAGS to "-static" if target compiler supports it.
|
||||
|
||||
if { ![info exists STATIC_LDFLAGS] } then {
|
||||
if { [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
# Check if gcc supports -static.
|
||||
set flags ""
|
||||
if [board_info [target_info name] exists cflags] {
|
||||
@ -458,7 +458,7 @@ if { ![info exists STATIC_LDFLAGS] } then {
|
||||
# Set STATIC_PIE_LDFLAGS to "-static-pie" if target compiler supports it.
|
||||
|
||||
if { ![info exists STATIC_PIE_LDFLAGS] } then {
|
||||
if { [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
# Check if gcc supports -static-pie.
|
||||
set flags ""
|
||||
if [board_info [target_info name] exists cflags] {
|
||||
|
@ -67,7 +67,7 @@ if [istarget *-pc-mingw*] {
|
||||
}
|
||||
|
||||
# No compiler, no test.
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
untested "Auto import test (compiler not found)"
|
||||
return
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ if {![istarget *-pc-cygwin]} {
|
||||
}
|
||||
|
||||
# No compiler, no test.
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
untested "Exe export test (no compiler available)"
|
||||
return
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ if ![check_shared_lib_support] {
|
||||
}
|
||||
|
||||
# Check if compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ if ![check_shared_lib_support] {
|
||||
}
|
||||
|
||||
# Check if compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ if ![check_shared_lib_support] {
|
||||
}
|
||||
|
||||
# Check if compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ set LDFLAGS $old_ldflags
|
||||
set ASFLAGS $old_asflags
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ if ![check_shared_lib_support] {
|
||||
}
|
||||
|
||||
# Check if compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#
|
||||
|
||||
# Test very simple native Linux/x86 programs with linux-x86.S.
|
||||
if { ![isnative] || [which $CC] == 0 \
|
||||
if { ![isnative] || ![check_compiler_available] \
|
||||
|| (![istarget "i?86-*-linux*"] \
|
||||
&& ![istarget "x86_64-*-linux*"] \
|
||||
&& ![istarget "amd64-*-linux*"]) } {
|
||||
|
@ -498,7 +498,7 @@ if { [istarget *-*-linux*]
|
||||
}
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ if { ![istarget *-*-linux*]
|
||||
}
|
||||
|
||||
# Check to see if the C compiler works.
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ if ![check_shared_lib_support] {
|
||||
}
|
||||
|
||||
# Check if compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ set test1w2 "$test1 (warning 2)"
|
||||
set test1c1 "$test1 (change 1)"
|
||||
set test1c2 "$test1 (change 2)"
|
||||
|
||||
if { ![is_remote host] && [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
untested $test1w1
|
||||
untested $test1w2
|
||||
untested $test1c1
|
||||
|
@ -23,7 +23,7 @@
|
||||
#
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
# Make sure that ld can generate ELF shared libraries with visibility.
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ if { [istarget m681*-*-*] || [istarget m68hc1*-*-*] } {
|
||||
set cflags "$cflags -fomit-frame-pointer -mshort"
|
||||
}
|
||||
|
||||
if { [is_remote host] || [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/gc.c $objfile
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ if { [is_elf_format] && [check_shared_lib_support] } then {
|
||||
set LDFLAGS $old_ldflags
|
||||
}
|
||||
|
||||
if { [is_remote host] || [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
if { [istarget "*-*-linux*"]
|
||||
|| [istarget "*-*-nacl*"]
|
||||
|| [istarget "*-*-gnu*"] } {
|
||||
@ -141,24 +141,24 @@ if { [is_remote host] || [which $CC] != 0 } {
|
||||
}
|
||||
}
|
||||
|
||||
if { [is_remote host] || [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
ld_compile "$CC $CFLAGS $cflags" $srcdir/$subdir/pr13683.c tmpdir/pr13683.o
|
||||
run_dump_test "pr13683"
|
||||
}
|
||||
|
||||
if { [is_remote host] || [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
ld_compile "$CC $CFLAGS $cflags $NOPIE_CFLAGS" $srcdir/$subdir/pr14265.c tmpdir/pr14265.o
|
||||
run_dump_test "pr14265"
|
||||
}
|
||||
|
||||
if { [is_remote host] || [which $CC] != 0 } {
|
||||
if { [check_compiler_available] } {
|
||||
ld_compile "$CC $CFLAGS $cflags -O0" $srcdir/$subdir/pr19161-1.c tmpdir/pr19161-1.o
|
||||
ld_compile "$CC $CFLAGS $cflags -O0" $srcdir/$subdir/pr19161-2.c tmpdir/pr19161-2.o
|
||||
run_dump_test "pr19161"
|
||||
}
|
||||
|
||||
if { [is_elf_format] && [check_shared_lib_support] \
|
||||
&& ([is_remote host] || [which $CC] != 0) } {
|
||||
&& [check_compiler_available] } {
|
||||
run_cc_link_tests [list \
|
||||
[list \
|
||||
"Build libpr20306.so" \
|
||||
|
@ -581,7 +581,7 @@ global PLT_CFLAGS
|
||||
# Must be Linux native with the C compiler
|
||||
if { [isnative]
|
||||
&& [istarget "i?86-*-linux*"]
|
||||
&& [which $CC] != 0 } {
|
||||
&& [check_compiler_available] } {
|
||||
run_cc_link_tests [list \
|
||||
[list \
|
||||
"Build plt-lib.so" \
|
||||
@ -1193,7 +1193,7 @@ global NOPIE_CFLAGS NOPIE_LDFLAGS
|
||||
if { [isnative]
|
||||
&& [check_ifunc_available]
|
||||
&& [istarget "i?86-*-*"]
|
||||
&& [which $CC] != 0 } {
|
||||
&& [check_compiler_available] } {
|
||||
run_cc_link_tests [list \
|
||||
[list \
|
||||
"Build ifunc-1a.o ifunc-1b.o ifunc-1c.o ifunc-1d.o" \
|
||||
@ -1310,7 +1310,7 @@ if { [isnative]
|
||||
# Must be native with the C compiler.
|
||||
if { [isnative]
|
||||
&& [istarget "i?86-*-*"]
|
||||
&& [which $CC] != 0 } {
|
||||
&& [check_compiler_available] } {
|
||||
run_cc_link_tests [list \
|
||||
[list \
|
||||
"Build pr22001-1.so" \
|
||||
|
@ -35,7 +35,7 @@ if ![istarget "i?86-*-*"] {
|
||||
}
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ if ![istarget "i?86-*-linux*"] {
|
||||
}
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ foreach t $test_list {
|
||||
|
||||
# We need a working compiler. (Strictly speaking this is
|
||||
# not true, we could use target specific assembler files).
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
verbose "IFUNC tests not run - no compiler available"
|
||||
return
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ proc i126256-test { } {
|
||||
set tmpdir tmpdir
|
||||
set testname "Seg fault whilst linking one shared library into another when relaxation is enabled."
|
||||
|
||||
if {![is_remote host] && [which $CC] == 0} then {
|
||||
if { ![check_compiler_available] } then {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ if {![is_pecoff_format]} {
|
||||
}
|
||||
|
||||
# No compiler, no test.
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
untested "PE version scripts"
|
||||
untested "aligned common tests"
|
||||
# Add more "untested" directives here when adding more tests below.
|
||||
|
@ -54,7 +54,7 @@ if {![is_pecoff_format]} {
|
||||
}
|
||||
|
||||
# No compiler, no test.
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
untested "Direct linking to dll test"
|
||||
return
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ if {![is_pecoff_format]} {
|
||||
}
|
||||
|
||||
# No compiler, no test.
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
untested "Direct linking to dll fastcall/stdcall test"
|
||||
return
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ if { ![istarget *-*-linux*]
|
||||
}
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
# MA 02110-1301, USA.
|
||||
|
||||
# Check to see if the C and C++ compilers work
|
||||
if { [which $CC] == 0 || [which $CXX] == 0 } {
|
||||
if { ![check_compiler_available] || [which $CXX] == 0 } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ if ![check_plugin_api_available] {
|
||||
# And a compiler to be available.
|
||||
set can_compile 1
|
||||
set failure_kind "unresolved"
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
# Don't fail immediately,
|
||||
set can_compile 0
|
||||
set failure_kind "unsupported"
|
||||
|
@ -27,7 +27,7 @@ set test5 "NOCROSSREFS_TO 2"
|
||||
set test6 "NOCROSSREFS_TO 3"
|
||||
set test7 "NOCROSSREFS_TO 4"
|
||||
|
||||
if { ![is_remote host] && [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
untested $test1
|
||||
untested $test2
|
||||
untested $test3
|
||||
|
@ -129,7 +129,7 @@ set testlink "SH relaxing"
|
||||
set testjsr "SH confirm relaxing"
|
||||
set testrun "SH relaxing execution"
|
||||
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
untested $testlink
|
||||
untested $testjsr
|
||||
untested $testrun
|
||||
|
@ -26,7 +26,7 @@
|
||||
# bootstrap test.
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ foreach t $test_list {
|
||||
}
|
||||
|
||||
# We need a working compiler.
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
verbose "Native size relocation tests not run - no compiler available"
|
||||
return
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ set sizeof_headers [string match "*SIZEOF_HEADERS*" $exec_output]
|
||||
# directly to the S-record format, and require that the two files
|
||||
# contain the same data.
|
||||
|
||||
if { ![is_remote host] && [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
untested $test1
|
||||
untested $test2
|
||||
return
|
||||
|
@ -24,7 +24,7 @@ set testund "undefined"
|
||||
set testfn "undefined function"
|
||||
set testline "undefined line"
|
||||
|
||||
if { ![is_remote host] && [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
verbose "Could not find C compiler!" 1
|
||||
untested $testund
|
||||
untested $testfn
|
||||
|
@ -44,7 +44,7 @@ foreach t $test_list {
|
||||
|
||||
# We need a working compiler. (Strictly speaking this is
|
||||
# not true, we could use target specific assembler files).
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
verbose "UNIQUE compiled tests not run - no compiler available"
|
||||
return
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ if ![istarget "x86_64-*-linux*"] {
|
||||
}
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ if ![istarget "x86_64-*-*"] {
|
||||
}
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ if ![istarget "x86_64-*-linux*"] {
|
||||
}
|
||||
|
||||
# Check to see if the C compiler works
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ global PLT_CFLAGS
|
||||
global NOPIE_CFLAGS NOPIE_LDFLAGS
|
||||
|
||||
# Must be native with the C compiler
|
||||
if { [isnative] && [which $CC] != 0 } {
|
||||
if { [isnative] && [check_compiler_available] } {
|
||||
run_cc_link_tests {
|
||||
{"Helper X32 DSO from x86-64 object" "" "-m64 -fPIC -g"
|
||||
{simple.c} {} "libsimple.a"}
|
||||
|
@ -688,6 +688,11 @@ proc run_ld_link_exec_tests { ldtests args } {
|
||||
set objfiles {}
|
||||
set failed 0
|
||||
|
||||
if { ![check_compiler_available] } {
|
||||
unsupported $testname
|
||||
continue
|
||||
}
|
||||
|
||||
# verbose -log "Testname is $testname"
|
||||
# verbose -log "ld_options is $ld_options"
|
||||
# verbose -log "as_options is $as_options"
|
||||
@ -840,6 +845,11 @@ proc run_cc_link_tests { ldtests } {
|
||||
set check_ld(terminal) 0
|
||||
set check_ld(source) ""
|
||||
|
||||
if { ![check_compiler_available] } {
|
||||
unsupported $testname
|
||||
continue
|
||||
}
|
||||
|
||||
#verbose -log "testname is $testname"
|
||||
#verbose -log "ldflags is $ldflags"
|
||||
#verbose -log "cflags is $cflags"
|
||||
@ -1140,6 +1150,49 @@ proc check_sysroot_available { } {
|
||||
return $ld_sysroot_available_saved
|
||||
}
|
||||
|
||||
# Return true if we can build a program with the compiler.
|
||||
# On some targets, CC might be defined, but libraries and startup
|
||||
# code might be missing or require special options that the ld test
|
||||
# harness doesn't know about.
|
||||
|
||||
proc check_compiler_available { } {
|
||||
global compiler_available_saved
|
||||
global CC
|
||||
|
||||
if {![info exists compiler_available_saved]} {
|
||||
if { [which $CC] == 0 } {
|
||||
set compiler_available_saved 0
|
||||
return 0
|
||||
}
|
||||
|
||||
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/compiler[pid]"
|
||||
set src ${basename}.c
|
||||
set output ${basename}.out
|
||||
set f [open $src "w"]
|
||||
puts $f "int main (void)"
|
||||
puts $f "{"
|
||||
puts $f " return 0; "
|
||||
puts $f "}"
|
||||
close $f
|
||||
if [is_remote host] {
|
||||
set src [remote_download host $src]
|
||||
}
|
||||
set compiler_available_saved [run_host_cmd_yesno "$CC" "$flags $src -o $output"]
|
||||
remote_file host delete $src
|
||||
remote_file host delete $output
|
||||
file delete $src
|
||||
}
|
||||
return $compiler_available_saved
|
||||
}
|
||||
|
||||
# Returns 1 if plugin is enabled in gcc. Returns 0 otherwise.
|
||||
proc check_gcc_plugin_enabled { } {
|
||||
global CC
|
||||
@ -1327,7 +1380,7 @@ proc check_ifunc_available { } {
|
||||
global CC
|
||||
|
||||
if {![info exists ifunc_available_saved]} {
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
set ifunc_available_saved 0
|
||||
return 0
|
||||
}
|
||||
@ -1376,7 +1429,7 @@ proc check_ifunc_attribute_available { } {
|
||||
global CC
|
||||
|
||||
if {![info exists ifunc_attribute_available_saved]} {
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
set ifunc_attribute_available_saved 0
|
||||
return 0
|
||||
}
|
||||
@ -1423,7 +1476,7 @@ proc check_libdl_available { } {
|
||||
global CC
|
||||
|
||||
if {![info exists libdl_available_saved]} {
|
||||
if { [which $CC] == 0 } {
|
||||
if { ![check_compiler_available] } {
|
||||
set libdl_available_saved 0
|
||||
return 0
|
||||
}
|
||||
@ -1459,7 +1512,7 @@ proc check_gnu2_tls_available { } {
|
||||
global GNU2_CFLAGS
|
||||
|
||||
if {![info exists gnu2_tls_available_saved]} {
|
||||
if { [which $CC] == 0 || "$GNU2_CFLAGS" == "" } {
|
||||
if { ![check_compiler_available] || "$GNU2_CFLAGS" == "" } {
|
||||
set gnu2_tls_available_saved 0
|
||||
return 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user