Compare commits

...

2 Commits

Author SHA1 Message Date
H.J. Lu
2ceac9a8a5 Add ld-elfvers/vers-gold.exp 2015-07-22 04:44:33 -07:00
H.J. Lu
7d066bc6aa Add gold, GOLD and gcc_B_opt_gold 2015-07-22 04:44:23 -07:00
4 changed files with 83 additions and 5 deletions

View File

@@ -278,3 +278,11 @@ if ![info exists LD] then {
if ![info exists LDFLAGS] then {
set LDFLAGS {}
}
if { ![info exists gold] \
&& [file exists ../gold/ld-new] \
&& [file exists ../gold/testsuite/gcctestdir/ld] } then {
set gold [findfile $base_dir/../gold/ld-new $base_dir/../gold/ld-new [transform gold]]
set GOLD "$gold"
set gcc_B_opt_gold "-B[pwd]/../gold/testsuite/gcctestdir/ld/ $gcc_B_opt"
}

View File

@@ -0,0 +1,24 @@
# Expect script for gold-version tests
# Copyright (C) 2015 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
#
set test_gold "yes"
load_lib ../ld-elfvers/vers.exp
unset test_gold

View File

@@ -105,6 +105,17 @@ case $target_triplet in {
default { set as_options "" }
}
global test_gold
if { [info exists test_gold] && $test_gold == yes } then {
if { ![info exists gold] } then {
unsupported "gold symbol version tests"
return
}
set linker "$gold"
} else {
set linker "$ld"
}
proc test_ar { test lib object expect } {
global ar
global nm
@@ -502,7 +513,7 @@ proc objdump_versionstuff { objdump object expectfile } {
}
proc build_binary { shared pic test source libname other mapfile verexp versymexp symexp ldargs } {
global ld
global linker
global srcdir
global subdir
global exec_output
@@ -538,7 +549,7 @@ proc build_binary { shared pic test source libname other mapfile verexp versymex
set script_arg "$script $srcdir/$subdir/$mapfile"
}
if {![ld_simple_link $ld $tmpdir/$libname.so "$shared $tmpdir/$libname.o $other_lib $script_arg $ldargs"]} {
if {![ld_simple_link $linker $tmpdir/$libname.so "$shared $tmpdir/$libname.o $other_lib $script_arg $ldargs"]} {
fail "$test"
return
}

View File

@@ -81,6 +81,18 @@ proc run_host_cmd { prog command } {
global link_output
global gcc_B_opt
global ld_L_opt
global gcc_B_opt_gold
global test_gold
if { [info exists test_gold] && $test_gold == yes } then {
if { ![info exists gcc_B_opt_gold] } then {
perror "gold does not exist"
return 0
}
set B_opt "$gcc_B_opt_gold"
} else {
set B_opt "$gcc_B_opt"
}
if { ![is_remote host] && [which "$prog"] == 0 } then {
perror "$prog does not exist"
@@ -101,7 +113,7 @@ proc run_host_cmd { prog command } {
}
set gccexe [string replace $gccexe 0 [string last "/" $gccexe] ""]
if {[string match "*cc*" $gccexe] || [string match "*++*" $gccexe]} then {
set gccflags "$gcc_B_opt $gccflags $ld_L_opt"
set gccflags "$B_opt $gccflags $ld_L_opt"
}
verbose -log "$prog $gccflags $command"
@@ -254,6 +266,18 @@ proc default_ld_compile { cc source object } {
global subdir
global host_triplet
global gcc_B_opt
global gcc_B_opt_gold
global test_gold
if { [info exists test_gold] && $test_gold == yes } then {
if { ![info exists gcc_B_opt_gold] } then {
perror "gold does not exist"
return 0
}
set B_opt "$gcc_B_opt_gold"
} else {
set B_opt "$gcc_B_opt"
}
set cc_prog $cc
if {[llength $cc_prog] > 1} then {
@@ -267,7 +291,7 @@ proc default_ld_compile { cc source object } {
remote_file build delete "$object"
remote_file host delete "$object"
set flags "$gcc_B_opt -I$srcdir/$subdir"
set flags "$B_opt -I$srcdir/$subdir"
# If we are compiling with gcc, we want to add gcc_B_opt to flags.
# However, if $prog already has -B options, which might be the
@@ -576,6 +600,17 @@ proc run_dump_test { name {extra_options {}} } {
global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS LDFLAGS
global host_triplet runtests
global env verbose
global GOLD test_gold
if { [info exists test_gold] && $test_gold == yes } then {
if { ![info exists GOLD] } then {
perror "gold does not exist"
return 0
}
set linker "$GOLD"
} else {
set linker "$LD"
}
if [string match "*/*" $name] {
set file $name
@@ -860,7 +895,7 @@ proc run_dump_test { name {extra_options {}} } {
# Add -L$srcdir/$subdir so that the linker command can use
# linker scripts in the source directory.
set cmd "$LD $LDFLAGS -L$srcdir/$subdir \
set cmd "$linker $LDFLAGS -L$srcdir/$subdir \
$opts(ld) -o $objfile $objfiles $opts(ld_after_inputfiles)"
# If needed then check for, or add a -Map option.