Provide dummy libraries for alpha-vms
alpha-dec-vms always loads a number of libraries, -limagelib, -lstarlet, and -lsys$public_vectors. When running the ld testsuite without a full cross-build environment, those libraries are missing and cause fails. This patch provides dummies, and tidies default.exp a little. * testsuite/config/default.exp: Provide dummy libraries for alpha-dec-vms. (compiler_supports): New proc. Use it for compiler tests. * testsuite/lib/ld-lib.exp (default_ld_assemble): Don't die if subdir not set. (run_ld_link_tests): Pass LDFLAGS to ld. * testsuite/ld-checks/checks.exp (section_check): Likewise. * testsuite/ld-scripts/assert.exp: Likewise. * testsuite/ld-scripts/extern.exp: Likewise. * testsuite/ld-scripts/log2.exp: Likewise. * testsuite/ld-scripts/map-address.exp: Likewise. * testsuite/ld-scripts/script.exp: Likewise. * testsuite/ld-scripts/sizeof.exp: Likewise.
This commit is contained in:
parent
13e86dcf7a
commit
740341b9be
10 changed files with 108 additions and 286 deletions
16
ld/ChangeLog
16
ld/ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2020-10-19 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* testsuite/config/default.exp: Provide dummy libraries for
|
||||||
|
alpha-dec-vms.
|
||||||
|
(compiler_supports): New proc. Use it for compiler tests.
|
||||||
|
* testsuite/lib/ld-lib.exp (default_ld_assemble): Don't die if
|
||||||
|
subdir not set.
|
||||||
|
(run_ld_link_tests): Pass LDFLAGS to ld.
|
||||||
|
* testsuite/ld-checks/checks.exp (section_check): Likewise.
|
||||||
|
* testsuite/ld-scripts/assert.exp: Likewise.
|
||||||
|
* testsuite/ld-scripts/extern.exp: Likewise.
|
||||||
|
* testsuite/ld-scripts/log2.exp: Likewise.
|
||||||
|
* testsuite/ld-scripts/map-address.exp: Likewise.
|
||||||
|
* testsuite/ld-scripts/script.exp: Likewise.
|
||||||
|
* testsuite/ld-scripts/sizeof.exp: Likewise.
|
||||||
|
|
||||||
2020-10-16 Andrew Burgess <andrew.burgess@embecosm.com>
|
2020-10-16 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
* ldlang.c (lang_process): Add extra call to
|
* ldlang.c (lang_process): Add extra call to
|
||||||
|
|
|
@ -312,304 +312,108 @@ if { ![info exists LD_CLASS] } then {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set PLT_CFLAGS to "-fplt" if target compiler supports it.
|
# Compiler tests
|
||||||
|
proc compiler_supports { flag args } {
|
||||||
|
if { [check_compiler_available] } {
|
||||||
|
global CC
|
||||||
|
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 fn "cs[pid].c"
|
||||||
|
set f [open $fn "w"]
|
||||||
|
if { [llength $args] > 0 } {
|
||||||
|
puts $f [lindex $args 0]
|
||||||
|
} else {
|
||||||
|
puts $f "int main (void) { return 0; }"
|
||||||
|
}
|
||||||
|
close $f
|
||||||
|
set rfn [remote_download host $fn]
|
||||||
|
set avail [run_host_cmd_yesno "$CC" "$flags $flag $rfn -o /dev/null"]
|
||||||
|
remote_file host delete $rfn
|
||||||
|
file delete $fn
|
||||||
|
return $avail
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
if { ![info exists PLT_CFLAGS] } then {
|
if { ![info exists PLT_CFLAGS] } then {
|
||||||
if { [check_compiler_available] } {
|
set PLT_CFLAGS ""
|
||||||
# Check if gcc supports -fplt
|
if [compiler_supports "-c -fplt"] {
|
||||||
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/plt[pid]"
|
|
||||||
set src ${basename}.c
|
|
||||||
set output ${basename}.o
|
|
||||||
set f [open $src "w"]
|
|
||||||
puts $f ""
|
|
||||||
close $f
|
|
||||||
if [is_remote host] {
|
|
||||||
set src [remote_download host $src]
|
|
||||||
}
|
|
||||||
set plt_available [run_host_cmd_yesno "$CC" "$flags -c -fplt $src -o $output"]
|
|
||||||
remote_file host delete $src
|
|
||||||
remote_file host delete $output
|
|
||||||
file delete $src
|
|
||||||
|
|
||||||
if { $plt_available == 1 } then {
|
|
||||||
set PLT_CFLAGS "-fplt"
|
set PLT_CFLAGS "-fplt"
|
||||||
} else {
|
|
||||||
set PLT_CFLAGS ""
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
set PLT_CFLAGS ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set NOPIE_CFLAGS to "-fno-PIE" and NOPIE_LDFLAGS to "-no-pie" if
|
|
||||||
# target compiler supports them.
|
|
||||||
|
|
||||||
if { ![info exists NOPIE_CFLAGS] || ![info exists NOPIE_LDFLAGS] } then {
|
if { ![info exists NOPIE_CFLAGS] || ![info exists NOPIE_LDFLAGS] } then {
|
||||||
if { [check_compiler_available] } {
|
set NOPIE_CFLAGS ""
|
||||||
# Check if gcc supports -fno-PIE -no-pie.
|
set NOPIE_LDFLAGS ""
|
||||||
set flags ""
|
if [compiler_supports "-fno-PIE -no-pie"] {
|
||||||
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/nopie[pid]"
|
|
||||||
set src ${basename}.c
|
|
||||||
set output ${basename}
|
|
||||||
set f [open $src "w"]
|
|
||||||
puts $f "int main (void) { return 0; }"
|
|
||||||
close $f
|
|
||||||
if [is_remote host] {
|
|
||||||
set src [remote_download host $src]
|
|
||||||
}
|
|
||||||
set nopie_available [run_host_cmd_yesno "$CC" "$flags -fno-PIE -no-pie $src -o $output"]
|
|
||||||
remote_file host delete $src
|
|
||||||
remote_file host delete $output
|
|
||||||
file delete $src
|
|
||||||
|
|
||||||
if { $nopie_available == 1 } then {
|
|
||||||
set NOPIE_CFLAGS "-fno-PIE"
|
set NOPIE_CFLAGS "-fno-PIE"
|
||||||
set NOPIE_LDFLAGS "-no-pie"
|
set NOPIE_LDFLAGS "-no-pie"
|
||||||
} else {
|
|
||||||
set NOPIE_CFLAGS ""
|
|
||||||
set NOPIE_LDFLAGS ""
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
set NOPIE_CFLAGS ""
|
|
||||||
set NOPIE_LDFLAGS ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set NOCF_PROTECTION_CFLAGS to "-fcf-protection=none" if target compiler
|
|
||||||
# supports it.
|
|
||||||
|
|
||||||
if { ![info exists NOCF_PROTECTION_CFLAGS] } then {
|
if { ![info exists NOCF_PROTECTION_CFLAGS] } then {
|
||||||
if { [check_compiler_available] } {
|
set NOCF_PROTECTION_CFLAGS ""
|
||||||
# Check if gcc supports -fcf-protection=none.
|
if [compiler_supports "-fcf-protection=none"] {
|
||||||
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/available[pid]"
|
|
||||||
set src ${basename}.c
|
|
||||||
set output ${basename}
|
|
||||||
set f [open $src "w"]
|
|
||||||
puts $f "int main (void) { return 0; }"
|
|
||||||
close $f
|
|
||||||
if [is_remote host] {
|
|
||||||
set src [remote_download host $src]
|
|
||||||
}
|
|
||||||
set available [run_host_cmd_yesno "$CC" "$flags -fcf-protection=none $src -o $output"]
|
|
||||||
remote_file host delete $src
|
|
||||||
remote_file host delete $output
|
|
||||||
file delete $src
|
|
||||||
|
|
||||||
if { $available == 1 } then {
|
|
||||||
set NOCF_PROTECTION_CFLAGS "-fcf-protection=none"
|
set NOCF_PROTECTION_CFLAGS "-fcf-protection=none"
|
||||||
} else {
|
|
||||||
set NOCF_PROTECTION_CFLAGS ""
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
set NOCF_PROTECTION_CFLAGS ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set GNU2_CFLAGS to "-mtls-dialect=gnu2" if target compiler supports it.
|
|
||||||
|
|
||||||
if { ![info exists GNU2_CFLAGS] } then {
|
if { ![info exists GNU2_CFLAGS] } then {
|
||||||
if { [check_compiler_available] } {
|
set GNU2_CFLAGS ""
|
||||||
# Check if gcc supports -mtls-dialect=gnu2
|
if [compiler_supports "-c -mtls-dialect=gnu2" "__thread int y = 1;"] {
|
||||||
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/gnu2[pid]"
|
|
||||||
set src ${basename}.c
|
|
||||||
set output ${basename}.o
|
|
||||||
set f [open $src "w"]
|
|
||||||
puts $f "__thread int yyy = 100;"
|
|
||||||
close $f
|
|
||||||
if [is_remote host] {
|
|
||||||
set src [remote_download host $src]
|
|
||||||
}
|
|
||||||
set gnu2_available [run_host_cmd_yesno "$CC" "$flags -c -mtls-dialect=gnu2 $src -o $output"]
|
|
||||||
remote_file host delete $src
|
|
||||||
remote_file host delete $output
|
|
||||||
file delete $src
|
|
||||||
|
|
||||||
if { $gnu2_available == 1 } then {
|
|
||||||
set GNU2_CFLAGS "-mtls-dialect=gnu2"
|
set GNU2_CFLAGS "-mtls-dialect=gnu2"
|
||||||
} else {
|
|
||||||
set GNU2_CFLAGS ""
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
set GNU2_CFLAGS ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set INT128_CFLAGS to "-DHAS_INT128" if target compiler supports __int128.
|
|
||||||
|
|
||||||
if { ![info exists INT128_CFLAGS] } then {
|
if { ![info exists INT128_CFLAGS] } then {
|
||||||
if { [check_compiler_available] } {
|
set INT128_CFLAGS ""
|
||||||
# Check if gcc supports __int128.
|
if [compiler_supports "-c" "__int128 a = 42;"] {
|
||||||
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/int128[pid]"
|
|
||||||
set src ${basename}.c
|
|
||||||
set output ${basename}.o
|
|
||||||
set f [open $src "w"]
|
|
||||||
puts $f "__int128 a = 42;"
|
|
||||||
close $f
|
|
||||||
if [is_remote host] {
|
|
||||||
set src [remote_download host $src]
|
|
||||||
}
|
|
||||||
set int128_available [run_host_cmd_yesno "$CC" "$flags -c $src -o $output"]
|
|
||||||
remote_file host delete $src
|
|
||||||
remote_file host delete $output
|
|
||||||
file delete $src
|
|
||||||
|
|
||||||
if { $int128_available == 1 } then {
|
|
||||||
set INT128_CFLAGS "-DHAS_INT128"
|
set INT128_CFLAGS "-DHAS_INT128"
|
||||||
} else {
|
|
||||||
set INT128_CFLAGS ""
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
set INT128_CFLAGS ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set STATIC_LDFLAGS to "-static" if target compiler supports it.
|
|
||||||
|
|
||||||
if { ![info exists STATIC_LDFLAGS] } then {
|
if { ![info exists STATIC_LDFLAGS] } then {
|
||||||
if { [check_compiler_available] } {
|
set STATIC_LDFLAGS ""
|
||||||
# Check if gcc supports -static.
|
if [compiler_supports "-static"] {
|
||||||
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/static[pid]"
|
|
||||||
set src ${basename}.c
|
|
||||||
set output ${basename}
|
|
||||||
set f [open $src "w"]
|
|
||||||
puts $f "int main (void) { return 0; }"
|
|
||||||
close $f
|
|
||||||
if [is_remote host] {
|
|
||||||
set src [remote_download host $src]
|
|
||||||
}
|
|
||||||
set static_available [run_host_cmd_yesno "$CC" "-static $flags $src -o $output"]
|
|
||||||
remote_file host delete $src
|
|
||||||
remote_file host delete $output
|
|
||||||
file delete $src
|
|
||||||
|
|
||||||
if { $static_available == 1 } then {
|
|
||||||
set STATIC_LDFLAGS "-static"
|
set STATIC_LDFLAGS "-static"
|
||||||
} else {
|
|
||||||
set STATIC_LDFLAGS ""
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
set STATIC_LDFLAGS ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set STATIC_PIE_LDFLAGS to "-static-pie" if target compiler supports it.
|
|
||||||
|
|
||||||
if { ![info exists STATIC_PIE_LDFLAGS] } then {
|
if { ![info exists STATIC_PIE_LDFLAGS] } then {
|
||||||
if { [check_compiler_available] } {
|
set STATIC_PIE_LDFLAGS ""
|
||||||
# Check if gcc supports -static-pie.
|
if [compiler_supports "-static-pie"] {
|
||||||
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/static[pid]"
|
|
||||||
set src ${basename}.c
|
|
||||||
set output ${basename}
|
|
||||||
set f [open $src "w"]
|
|
||||||
puts $f "int main (void) { return 0; }"
|
|
||||||
close $f
|
|
||||||
if [is_remote host] {
|
|
||||||
set src [remote_download host $src]
|
|
||||||
}
|
|
||||||
set static_available [run_host_cmd_yesno "$CC" "-static-pie $flags $src -o $output"]
|
|
||||||
remote_file host delete $src
|
|
||||||
remote_file host delete $output
|
|
||||||
file delete $src
|
|
||||||
|
|
||||||
if { $static_available == 1 } then {
|
|
||||||
set STATIC_PIE_LDFLAGS "-static-pie"
|
set STATIC_PIE_LDFLAGS "-static-pie"
|
||||||
} else {
|
|
||||||
set STATIC_PIE_LDFLAGS ""
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
set STATIC_PIE_LDFLAGS ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set NOSANITIZE_CFLAGS to "-fno-sanitize=all" if target compiler
|
|
||||||
# supports it.
|
|
||||||
|
|
||||||
if { ![info exists NOSANITIZE_CFLAGS] } then {
|
if { ![info exists NOSANITIZE_CFLAGS] } then {
|
||||||
if { [check_compiler_available] } {
|
set NOSANITIZE_CFLAGS ""
|
||||||
# Check if gcc supports -fno-sanitize=all.
|
if [compiler_supports "-fno-sanitize=all"] {
|
||||||
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/available[pid]"
|
|
||||||
set src ${basename}.c
|
|
||||||
set output ${basename}
|
|
||||||
set f [open $src "w"]
|
|
||||||
puts $f "int main (void) { return 0; }"
|
|
||||||
close $f
|
|
||||||
if [is_remote host] {
|
|
||||||
set src [remote_download host $src]
|
|
||||||
}
|
|
||||||
set available [run_host_cmd_yesno "$CC" "$flags -fno-sanitize=all $src -o $output"]
|
|
||||||
remote_file host delete $src
|
|
||||||
remote_file host delete $output
|
|
||||||
file delete $src
|
|
||||||
|
|
||||||
if { $available == 1 } then {
|
|
||||||
set NOSANITIZE_CFLAGS "-fno-sanitize=all"
|
set NOSANITIZE_CFLAGS "-fno-sanitize=all"
|
||||||
} else {
|
|
||||||
set NOSANITIZE_CFLAGS ""
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
set NOSANITIZE_CFLAGS ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Provide dummy libraries that alpha-vms-ld always loads
|
||||||
|
if { [istarget alpha*-*-*vms*] } {
|
||||||
|
set src tmpdir/empty.s
|
||||||
|
set f [open $src "w"]
|
||||||
|
close $f
|
||||||
|
if { [ld_assemble $as $src tmpdir/empty.o]
|
||||||
|
&& ![ld_link $LD tmpdir/empty tmpdir/empty.o]
|
||||||
|
&& [regsub -all {[^\n]*: cannot find -l([^\n]*)} $exec_output {tmpdir/lib\1.a } missing_libs] } {
|
||||||
|
regsub -all {\$} $missing_libs {\\\$} missing_libs
|
||||||
|
for { set i 0 } { $i < [llength $missing_libs] } { incr i } {
|
||||||
|
set f [lindex $missing_libs $i]
|
||||||
|
verbose -log "creating dummy $f"
|
||||||
|
ar_simple_create $ar {} $f tmpdir/empty.o
|
||||||
|
}
|
||||||
|
append LDFLAGS " -Ltmpdir"
|
||||||
|
unset i missing_libs
|
||||||
|
}
|
||||||
|
unset f src
|
||||||
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
# Written by Nick Clifton (nickc@cygnus.com)
|
# Written by Nick Clifton (nickc@cygnus.com)
|
||||||
|
|
||||||
proc section_check {} {
|
proc section_check {} {
|
||||||
global ld_flags
|
global LDFLAGS
|
||||||
global as
|
global as
|
||||||
global ld
|
global ld
|
||||||
global srcdir
|
global srcdir
|
||||||
|
@ -33,7 +33,7 @@ proc section_check {} {
|
||||||
}
|
}
|
||||||
set test "check sections 1"
|
set test "check sections 1"
|
||||||
|
|
||||||
set ldflags "--check-sections -e foo"
|
set ldflags "$LDFLAGS --check-sections -e foo"
|
||||||
|
|
||||||
if { ![ld_assemble $as $srcdir/$subdir/asm.s tmpdir/asm.o]} {
|
if { ![ld_assemble $as $srcdir/$subdir/asm.s tmpdir/asm.o]} {
|
||||||
unresolved $test
|
unresolved $test
|
||||||
|
@ -50,7 +50,7 @@ proc section_check {} {
|
||||||
|
|
||||||
# Change the linker flags so that our "buggy" linker
|
# Change the linker flags so that our "buggy" linker
|
||||||
# script is used.
|
# script is used.
|
||||||
set ldflags "--check-sections -T $srcdir/$subdir/script -e foo"
|
set ldflags "$LDFLAGS --check-sections -T $srcdir/$subdir/script -e foo"
|
||||||
|
|
||||||
# Perform the equivalent of invoking ld_link
|
# Perform the equivalent of invoking ld_link
|
||||||
# except that we need to massage the output further.
|
# except that we need to massage the output further.
|
||||||
|
|
|
@ -26,7 +26,7 @@ if ![ld_assemble $as $srcdir/$subdir/assert.s tmpdir/assert.o] {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ![ld_link $ld tmpdir/assert "-T $srcdir/$subdir/assert.t tmpdir/assert.o"] {
|
if ![ld_link $ld tmpdir/assert "$LDFLAGS -T $srcdir/$subdir/assert.t tmpdir/assert.o"] {
|
||||||
fail $testname
|
fail $testname
|
||||||
} else {
|
} else {
|
||||||
pass $testname
|
pass $testname
|
||||||
|
|
|
@ -26,7 +26,7 @@ if ![ld_assemble $as $srcdir/$subdir/extern.s tmpdir/extern.o] {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ![ld_link $ld tmpdir/extern "-T $srcdir/$subdir/extern.t tmpdir/extern.o"] {
|
if ![ld_link $ld tmpdir/extern "$LDFLAGS -T $srcdir/$subdir/extern.t tmpdir/extern.o"] {
|
||||||
fail $testname
|
fail $testname
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ if {![ld_assemble $as $srcdir/$subdir/log2.s tmpdir/log2.o]} {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if {![ld_link $ld tmpdir/log2 "-T $srcdir/$subdir/log2.t tmpdir/log2.o"]} {
|
if {![ld_link $ld tmpdir/log2 "$LDFLAGS -T $srcdir/$subdir/log2.t tmpdir/log2.o"]} {
|
||||||
fail $testname
|
fail $testname
|
||||||
} else {
|
} else {
|
||||||
pass $testname
|
pass $testname
|
||||||
|
|
|
@ -27,7 +27,7 @@ if {![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/map-address.o]} {
|
||||||
}
|
}
|
||||||
|
|
||||||
if {![ld_link $ld tmpdir/map-address \
|
if {![ld_link $ld tmpdir/map-address \
|
||||||
"-T $srcdir/$subdir/map-address.t \
|
"$LDFLAGS -T $srcdir/$subdir/map-address.t \
|
||||||
tmpdir/map-address.o \
|
tmpdir/map-address.o \
|
||||||
-Map tmpdir/map-address.map"]} {
|
-Map tmpdir/map-address.map"]} {
|
||||||
fail $testname
|
fail $testname
|
||||||
|
@ -49,7 +49,7 @@ if {[regexp_diff \
|
||||||
set testname "map to directory"
|
set testname "map to directory"
|
||||||
|
|
||||||
if {![ld_link $ld tmpdir/map-address \
|
if {![ld_link $ld tmpdir/map-address \
|
||||||
"-T $srcdir/$subdir/map-address.t \
|
"$LDFLAGS -T $srcdir/$subdir/map-address.t \
|
||||||
tmpdir/map-address.o \
|
tmpdir/map-address.o \
|
||||||
-Map tmpdir --output fred"]} {
|
-Map tmpdir --output fred"]} {
|
||||||
fail $testname
|
fail $testname
|
||||||
|
|
|
@ -182,15 +182,13 @@ proc extract_symbol_test { testfile testname } {
|
||||||
}
|
}
|
||||||
|
|
||||||
# PE targets need to set the image base to 0 to avoid complications from nm.
|
# PE targets need to set the image base to 0 to avoid complications from nm.
|
||||||
set flags ""
|
|
||||||
set old_LDFLAGS $LDFLAGS
|
set old_LDFLAGS $LDFLAGS
|
||||||
if { [is_pecoff_format] } then {
|
if { [is_pecoff_format] } then {
|
||||||
set flags "--image-base 0"
|
append LDFLAGS " --image-base 0"
|
||||||
set LDFLAGS "$LDFLAGS --image-base 0"
|
|
||||||
} elseif { [is_xcoff_format] } then {
|
} elseif { [is_xcoff_format] } then {
|
||||||
set flags "-bnogc"
|
append LDFLAGS " -bnogc"
|
||||||
set LDFLAGS "$LDFLAGS -bnogc"
|
|
||||||
}
|
}
|
||||||
|
set flags $LDFLAGS
|
||||||
|
|
||||||
if ![ld_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
|
if ![ld_link $ld tmpdir/script "$flags -T $srcdir/$subdir/script.t tmpdir/script.o"] {
|
||||||
fail $testname
|
fail $testname
|
||||||
|
|
|
@ -27,7 +27,7 @@ if ![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/sizeof.o] {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ![ld_link $ld tmpdir/sizeof "-T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] {
|
if ![ld_link $ld tmpdir/sizeof "$LDFLAGS -T $srcdir/$subdir/sizeof.t tmpdir/sizeof.o"] {
|
||||||
fail $testname
|
fail $testname
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,7 +305,10 @@ proc default_ld_assemble { as in_flags source object } {
|
||||||
|
|
||||||
if ![info exists ASFLAGS] { set ASFLAGS "" }
|
if ![info exists ASFLAGS] { set ASFLAGS "" }
|
||||||
|
|
||||||
set flags "[big_or_little_endian] -I$srcdir/$subdir"
|
set flags [big_or_little_endian]
|
||||||
|
if [info exists subdir] {
|
||||||
|
append flags " -I$srcdir/$subdir"
|
||||||
|
}
|
||||||
set exec_output [run_host_cmd "$as" "$flags $in_flags $ASFLAGS -o $object $source"]
|
set exec_output [run_host_cmd "$as" "$flags $in_flags $ASFLAGS -o $object $source"]
|
||||||
set exec_output [prune_warnings $exec_output]
|
set exec_output [prune_warnings $exec_output]
|
||||||
if [string match "" $exec_output] then {
|
if [string match "" $exec_output] then {
|
||||||
|
@ -450,6 +453,7 @@ proc ar_simple_create { ar aropts target objects } {
|
||||||
#
|
#
|
||||||
proc run_ld_link_tests { ldtests args } {
|
proc run_ld_link_tests { ldtests args } {
|
||||||
global ld
|
global ld
|
||||||
|
global LDFLAGS
|
||||||
global as
|
global as
|
||||||
global nm
|
global nm
|
||||||
global ar
|
global ar
|
||||||
|
@ -463,9 +467,9 @@ proc run_ld_link_tests { ldtests args } {
|
||||||
global runtests
|
global runtests
|
||||||
global exec_output
|
global exec_output
|
||||||
|
|
||||||
set ld_extra_opt ""
|
set ld_extra_opt $LDFLAGS
|
||||||
if [check_relro_support] {
|
if [check_relro_support] {
|
||||||
set ld_extra_opt "-z norelro"
|
append ld_extra_opt " -z norelro"
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach testitem $ldtests {
|
foreach testitem $ldtests {
|
||||||
|
|
Loading…
Add table
Reference in a new issue