# Support routines for LD testsuite.
-# Copyright (C) 1994-2019 Free Software Foundation, Inc.
+# Copyright (C) 1994-2020 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
global CFLAGS
global runtests
global exec_output
- global ld_elf_shared_opt
- if { [is_elf_format] && [check_shared_lib_support] } {
- set ld_extra_opt "$ld_elf_shared_opt"
- } else {
- set ld_extra_opt ""
+ set ld_extra_opt ""
+ if [check_relro_support] {
+ set ld_extra_opt "-z norelro"
}
foreach testitem $ldtests {
}
foreach target $args {
- setup_xfail $target
+ if [match_target $target] {
+ setup_xfail "*-*-*"
+ break
+ }
}
set ld_options [lindex $testitem 1]
}
foreach testitem $ldtests {
- foreach target $args {
- setup_xfail $target
- }
set testname [lindex $testitem 0]
set ld_options [lindex $testitem 1]
set as_options [lindex $testitem 2]
continue
}
+ foreach target $args {
+ if [match_target $target] {
+ setup_xfail "*-*-*"
+ break
+ }
+ }
+
# verbose -log "Testname is $testname"
# verbose -log "ld_options is $ld_options"
# verbose -log "as_options is $as_options"
verbose "$exec_output" 1
set failed 1
} else {
- send_log "diff $binfile.out $srcdir/$subdir/$expfile\n"
- verbose "diff $binfile.out $srcdir/$subdir/$expfile"
- catch "exec diff $binfile.out $srcdir/$subdir/$expfile" exec_output
- set exec_output [prune_warnings $exec_output]
-
- if ![string match "" $exec_output] then {
- send_log "$exec_output\n"
- verbose "$exec_output" 1
+ send_log [file_contents $binfile.out]
+ verbose [file_contents $binfile.out] 2
+ if [regexp_diff "$binfile.out" "$srcdir/$subdir/$expfile"] {
set failed 1
}
}
if { $binfile eq "tmpdir/" } {
# compile only
+ set binfile $objfile
} elseif { [regexp ".*\\.a$" $binfile] } {
if { ![ar_simple_create $ar $ldflags $binfile "$objfiles"] } {
set failed 1
|| [istarget pj*-*-*]
|| [istarget pru*-*-*]
|| [istarget s12z-*-*]
- || [istarget xgate-*-*] } {
+ || [istarget xgate-*-*]
+ || [istarget z80-*-*] } {
set gc_sections_available_saved 0
return 0
}
return $gc_sections_available_saved
}
-# Return true if target uses genelf.em (assuming it is ELF).
-proc is_generic_elf { } {
+# Return true if target uses genelf.em.
+proc uses_genelf { } {
if { [istarget "d30v-*-*"]
|| [istarget "dlx-*-*"]
|| [istarget "fr30-*-*"]
|| [istarget "ft32-*-*"]
|| [istarget "iq2000-*-*"]
|| [istarget "mn10200-*-*"]
- || [istarget "moxie-*-*"]
|| [istarget "msp430-*-*"]
|| [istarget "mt-*-*"]
|| [istarget "pj*-*-*"]
+ || [istarget "s12z-*-*"]
|| [istarget "xgate-*-*"] } {
- return 1;
+ return 1
}
- return 0;
+ return 0
}
proc is_underscore_target { } {
if {![info exists plugin_api_available_saved]} {
# Check if the ld used by gcc supports --plugin.
set ld_output [remote_exec host $ld "--help"]
- if { [ string first "-plugin PLUGIN" $ld_output ] >= 0 } {
+ if { [regexp -- "-plugin PLUGIN \[^\n\r\]*" $ld_output line]
+ && ![regexp "ignored" $line] } {
set plugin_api_available_saved 1
} else {
set plugin_api_available_saved 0