aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite/lib/binutils-common.exp
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/testsuite/lib/binutils-common.exp')
-rw-r--r--binutils/testsuite/lib/binutils-common.exp87
1 files changed, 73 insertions, 14 deletions
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index 41d94d2..fb12607 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -32,7 +32,6 @@ proc is_elf_format {} {
# && ![istarget *-*-windiss*]
if { ![istarget *-*-chorus*]
- && ![istarget *-*-cloudabi*]
&& ![istarget *-*-eabi*]
&& ![istarget *-*-*elf*]
&& ![istarget *-*-*freebsd*]
@@ -44,7 +43,6 @@ proc is_elf_format {} {
&& ![istarget kvx-*-*]
&& ![istarget *-*-*linux*]
&& ![istarget *-*-lynxos*]
- && ![istarget *-*-nacl*]
&& ![istarget *-*-netbsd*]
&& ![istarget *-*-nto*]
&& ![istarget *-*-openbsd*]
@@ -238,7 +236,6 @@ proc match_target { target } {
proc supports_gnu_osabi {} {
if { [istarget *-*-gnu*]
|| [istarget *-*-linux*]
- || [istarget *-*-nacl*]
|| ( [istarget *-*-*bsd*] && ![istarget arm*-*-netbsd*] )
|| [istarget *-*-lynxos]
|| ( [istarget *-*-nto*] && ![istarget arm*-*-*] )
@@ -480,6 +477,36 @@ proc supports_dt_relr {} {
return 0
}
+# Whether a target assembler supports --gsframe.
+proc gas_sframe_check {} {
+ global check_as_sframe_result
+ global AS
+ global ASFLAGS
+ if [info exists check_as_sframe_result] {
+ return $check_as_sframe_result
+ }
+
+ set as_file "tmpdir/check_as_sframe.s"
+ set as_fh [open $as_file w 0666]
+ puts $as_fh "# Generated file. DO NOT EDIT"
+ puts $as_fh "\t.cfi_startproc"
+ puts $as_fh "\t.cfi_endproc"
+ close $as_fh
+ remote_download host $as_file
+ verbose -log "Checking SFrame support in AS:"
+
+ set status [remote_exec host "$AS $ASFLAGS --gsframe $as_file"]
+
+ if { [lindex $status 0] != 0 } then {
+ verbose -log "SFrame not supported in AS"
+ set check_as_sframe_result 0
+ } else {
+ verbose -log "SFrame supported in AS"
+ set check_as_sframe_result 1
+ }
+ return $check_as_sframe_result
+}
+
# get_relative_path FROM TO
#
# Return a relative path to TO starting from FROM, which is usually
@@ -1147,17 +1174,17 @@ proc run_dump_test { name {extra_options {}} } {
[big_or_little_endian] opts(ld)
if { $opts(name) == "" } {
- set testname "$subdir/$name"
+ set base_testname "$subdir/$name"
} else {
- set testname $opts(name)
+ set base_testname $opts(name)
}
set err_warn 0
foreach opt { warning error warning_output error_output } {
if { $opts($opt) != "" } {
if { $err_warn } {
- perror "$testname: bad mix of warning and error test directives"
- unresolved $testname
+ perror "$base_testname: bad mix of warning and error test directives"
+ unresolved $base_testname
return
}
set err_warn 1
@@ -1196,19 +1223,19 @@ proc run_dump_test { name {extra_options {}} } {
}
}
if { $targmatch == 0 } {
- unsupported $testname
+ unsupported $base_testname
return
}
}
foreach targ $opts(alltargets) {
if ![match_target $targ] {
- unsupported $testname
+ unsupported $base_testname
return
}
}
foreach targ $opts(notarget) {
if [match_target $targ] {
- unsupported $testname
+ unsupported $base_testname
return
}
}
@@ -1226,7 +1253,7 @@ proc run_dump_test { name {extra_options {}} } {
size { set dumpprogram size }
default {
perror "unrecognized DUMPPROG option $opts(DUMPPROG) in $file.d"
- unresolved $testname
+ unresolved $base_testname
return
}
}
@@ -1236,7 +1263,7 @@ proc run_dump_test { name {extra_options {}} } {
if {$opts($p) != ""} {
if {$dumpprogram != ""} {
perror "ambiguous dump program in $file.d"
- unresolved $testname
+ unresolved $base_testname
return
} else {
set dumpprogram $p
@@ -1246,7 +1273,7 @@ proc run_dump_test { name {extra_options {}} } {
}
if { $dumpprogram == "" && $opts(map) == "" && !$err_warn } {
perror "dump program unspecified in $file.d"
- unresolved $testname
+ unresolved $base_testname
return
}
}
@@ -1285,7 +1312,7 @@ proc run_dump_test { name {extra_options {}} } {
if { $cmdret != 0} {
send_log "compilation of $cfile failed, exit status $cmdret with <$comp_output>"
# Should this be 'unresolved', or is that too silent?
- fail $testname
+ fail $base_testname
return 0
}
}
@@ -1328,6 +1355,11 @@ proc run_dump_test { name {extra_options {}} } {
}
foreach as_flags $as_final_flags {
+ if { [llength $as_final_flags] > 1 } {
+ set testname [concat $base_testname $as_flags]
+ } else {
+ set testname $base_testname
+ }
# Assemble each file.
set objfiles {}
for { set i 0 } { $i < [llength $sourcefiles] } { incr i } {
@@ -1783,3 +1815,30 @@ proc get_standard_section_names {} {
}
return
}
+
+set llvm_plug_opt ""
+if { [isnative] } then {
+ if ![info exists CLANG_FOR_TARGET] then {
+ catch "exec clang -v" got
+ if [regexp "clang version" $got] then {
+ set CLANG_FOR_TARGET clang
+ }
+ }
+ if [info exists CLANG_FOR_TARGET] then {
+ set llvm_plug_so [string trim [exec $CLANG_FOR_TARGET -print-file-name=LLVMgold.so]]
+ if { $llvm_plug_so ne "LLVMgold.so" } then {
+ set llvm_plug_opt "--plugin $llvm_plug_so"
+ }
+
+ if { $llvm_plug_opt eq "" } then {
+ # If it is still blank, try llvm-config --libdir. Clang
+ # searches CLANG_INSTALL_LIBDIR_BASENAME which corresponds
+ # to this.
+ catch "exec llvm-config --libdir" got
+ if {[file isdirectory $got] \
+ && [file isfile $got/LLVMgold.so]} then {
+ set llvm_plug_opt "--plugin $got/LLVMgold.so"
+ }
+ }
+ }
+}