# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
-proc load_common_lib { name } {
- global srcdir
- load_file $srcdir/../../binutils/testsuite/lib/$name
-}
-
-load_common_lib binutils-common.exp
+load_file $srcdir/../../binutils/testsuite/lib/binutils-common.exp
# Returns 1 if the gcc for the target is at least version MAJOR.MINOR
# Returns 0 otherwise.
set prog $gccexe
}
set gccexe [string replace $gccexe 0 [string last "/" $gccexe] ""]
- if {[string match "*cc*" $gccexe] || [string match "*++*" $gccexe]} then {
+ if {[string match "*cc*" $gccexe] ||
+ [string match "*++*" $gccexe] ||
+ [string match "clang*" $gccexe]} then {
set gccflags "$gcc_B_opt $gccflags $ld_L_opt"
if {![info exists gcc_ld_B_opt_tested]} {
set gcc_ld_B_opt_tested 1
set ld_version_message [run_host_cmd "$ld" "--version"]
- set gcc_ld_version_message [run_host_cmd "$prog" "$gccflags -Wl,--version"]
+ set ver "-Wl,--version"
+ if [check_lto_available] {
+ set ver "-fno-lto $ver"
+ }
+ set gcc_ld_version_message [run_host_cmd "$prog" "$gccflags $ver"]
if {[string first $ld_version_message $gcc_ld_version_message] < 0} {
perror "************************************************************************"
perror "Your compiler driver ignores -B when choosing ld."
perror "You will not be testing the new ld in many of the following tests."
set gcc_ld_version [run_host_cmd "$prog" "$gccflags --print-prog-name=ld"]
if {![string match "" $gcc_ld_version] && ![string match "ld" $gcc_ld_version]} {
-
perror "It seems you will be testing $gcc_ld_version instead."
}
perror "************************************************************************"
proc is_endian_output_format { object_flags } {
if {[string match "*-oformat binary*" $object_flags] || \
- [string match "*-oformat ieee*" $object_flags] || \
- [string match "*-oformat ihex*" $object_flags] || \
+ [string match "*-oformat ieee*" $object_flags] || \
+ [string match "*-oformat ihex*" $object_flags] || \
[string match "*-oformat netbsd-core*" $object_flags] || \
- [string match "*-oformat srec*" $object_flags] || \
+ [string match "*-oformat srec*" $object_flags] || \
[string match "*-oformat tekhex*" $object_flags] || \
[string match "*-oformat trad-core*" $object_flags] } then {
- return 0
+ return 0
} else {
return 1
}
}
if [board_info [target_info name] exists cflags] {
- append flags " [board_info [target_info name] cflags]"
+ append flags " [board_info [target_info name] cflags]"
}
if [board_info [target_info name] exists multilib_flags] {
while { [gets $file line] != -1 } {
verbose "$line" 2
if [regexp "^(\[0-9a-fA-F\]+) \[a-zA-Z0-9\] \\.*(.+)$" $line whole value name] {
- set name [string trimleft $name "_"]
+ set name [string trimleft $name "_"]
verbose "Setting nm_output($name) to 0x$value" 2
set nm_output($name) 0x$value
}
# ARM targets call __gccmain
if {[istarget arm*-*-*]} {
- append flags " --defsym __gccmain=0"
+ append flags " --defsym __gccmain=0"
}
# Windows targets need __main, some prefixed with underscore.
if {[istarget *-*-cygwin* ] || [istarget *-*-mingw*]} {
- append flags " --defsym __main=main --defsym ___main=main"
+ append flags " --defsym __main=main --defsym ___main=main"
}
# PowerPC EABI code calls __eabi.
set dump_prog ""
switch -- $action {
objdump
- { set dump_prog $objdump }
+ { set dump_prog $objdump }
nm
- { set dump_prog $nm }
+ { set dump_prog $nm }
readelf
- { set dump_prog $READELF }
+ { set dump_prog $READELF }
ld
- { set dump_prog "ld" }
+ { set dump_prog "ld" }
default
{
perror "Unrecognized action $action"
}
set env(LC_ALL) "C"
set cmd "$binary $progopts $binfile"
- set status [remote_exec host [concat sh -c [list "$cmd >dump.out 2>ld.stderr"]] "" "/dev/null"]
+ set status [remote_exec host [concat sh -c [list "$cmd >dump.out 2>ld.stderr"]] "" "/dev/null"]
send_log "$cmd\n"
- remote_upload host "ld.stderr"
- set comp_output [prune_warnings [file_contents "ld.stderr"]]
- remote_file host delete "ld.stderr"
- remote_file build delete "ld.stderr"
+ remote_upload host "ld.stderr"
+ set comp_output [prune_warnings [file_contents "ld.stderr"]]
+ remote_file host delete "ld.stderr"
+ remote_file build delete "ld.stderr"
if {[info exists old_lc_all]} {
set env(LC_ALL) $old_lc_all
if { [regexp_diff "dump.out" "$srcdir/$subdir/$dumpfile"] } then {
verbose "output is [file_contents "dump.out"]" 2
set failed 1
- remote_file build delete "dump.out"
- remote_file host delete "dump.out"
+ remote_file build delete "dump.out"
+ remote_file host delete "dump.out"
break
}
remote_file build delete "dump.out"
# linker options are included in GCC spec files then we need the -specs
# option.
if [board_info [target_info name] exists cflags] {
- set board_cflags " [board_info [target_info name] cflags]"
+ set board_cflags " [board_info [target_info name] cflags]"
} else {
set board_cflags ""
}
global STATIC_LDFLAGS
if [board_info [target_info name] exists cflags] {
- set board_cflags " [board_info [target_info name] cflags]"
+ set board_cflags " [board_info [target_info name] cflags]"
} else {
set board_cflags ""
}
# Find actions related to error/warning processing.
switch -- $action {
- error
- {
- set check_ld(source) "regexp"
- set check_ld(regexp) $progopts
- set check_ld(terminal) 1
- }
- warning
- {
- set check_ld(source) "regexp"
- set check_ld(regexp) $progopts
- }
- error_output
- {
- set check_ld(source) "file"
- set check_ld(file) $progopts
- set check_ld(terminal) 1
- }
- warning_output
- {
- set check_ld(source) "file"
- set check_ld(file) $progopts
- }
+ error
+ {
+ set check_ld(source) "regexp"
+ set check_ld(regexp) $progopts
+ set check_ld(terminal) 1
+ }
+ warning
+ {
+ set check_ld(source) "regexp"
+ set check_ld(regexp) $progopts
+ }
+ error_output
+ {
+ set check_ld(source) "file"
+ set check_ld(file) $progopts
+ set check_ld(terminal) 1
+ }
+ warning_output
+ {
+ set check_ld(source) "file"
+ set check_ld(file) $progopts
+ }
}
}
}
if { $check_ld(source) != "" } then {
- if { $ld_output == "" } then {
- verbose -log "Linker was expected to give error or warning"
- set failed 1
- }
+ if { $ld_output == "" } then {
+ verbose -log "Linker was expected to give error or warning"
+ set failed 1
+ }
} else {
- if { $ld_output != "" } then {
- verbose -log "Unexpected linker warning or error"
- set failed 1
- }
+ if { $ld_output != "" } then {
+ verbose -log "Unexpected linker warning or error"
+ set failed 1
+ }
}
}
set dump_prog ""
switch -- $action {
objdump
- { set dump_prog $objdump }
+ { set dump_prog $objdump }
nm
- { set dump_prog $nm }
+ { set dump_prog $nm }
readelf
- { set dump_prog $READELF }
+ { set dump_prog $READELF }
error {}
warning {}
error_output {}
# Some targets don't support gc-sections despite whatever's
# advertised by ld's options.
if { [istarget alpha-*-*]
- || [istarget bpf-*-*]
+ || [istarget bpf-*-*]
|| [istarget d30v-*-*]
|| [istarget dlx-*-*]
|| [istarget hppa*64-*-*]
global CC
if {![info exists compiler_available_saved]} {
- if { [which $CC] == 0 } {
+ if { [which $CC] == 0 } {
set compiler_available_saved 0
return 0
}
global CC
if {![info exists lto_available_saved]} {
- if { ![check_gcc_plugin_enabled] } {
+ if { ![check_gcc_plugin_enabled] } {
set lto_available_saved 0
return 0
}
global CC
if {![info exists lto_fat_available_saved]} {
- if { ![check_gcc_plugin_enabled] } {
+ if { ![check_gcc_plugin_enabled] } {
set lto_fat_available_saved 0
return 0
}
global CC
if {![info exists lto_shared_available_saved]} {
- if { ![check_gcc_plugin_enabled] } {
+ if { ![check_gcc_plugin_enabled] } {
set lto_shared_available_saved 0
return 0
}
global CC
if {![info exists ifunc_available_saved]} {
- if { ![check_compiler_available] } {
+ if { ![check_compiler_available] } {
set ifunc_available_saved 0
return 0
}
global CC
if {![info exists ifunc_attribute_available_saved]} {
- if { ![check_compiler_available] } {
+ if { ![check_compiler_available] } {
set ifunc_attribute_available_saved 0
return 0
}
global CC
if {![info exists libdl_available_saved]} {
- if { ![check_compiler_available] } {
+ if { ![check_compiler_available] } {
set libdl_available_saved 0
return 0
}
global GNU2_CFLAGS
if {![info exists gnu2_tls_available_saved]} {
- if { ![check_compiler_available] || "$GNU2_CFLAGS" == "" } {
+ if { ![check_compiler_available] || "$GNU2_CFLAGS" == "" } {
set gnu2_tls_available_saved 0
return 0
}