Remove perror from ld_assemble, ld_compile and ld_nm
[deliverable/binutils-gdb.git] / ld / testsuite / ld-scripts / defined.exp
... / ...
CommitLineData
1# Test DEFINED in a linker script.
2# By Ian Lance Taylor, Cygnus Support.
3# Copyright (C) 2001-2020 Free Software Foundation, Inc.
4#
5# This file is part of the GNU Binutils.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20# MA 02110-1301, USA.
21
22set testname "DEFINED"
23set prms_id 5699
24
25if ![ld_assemble $as $srcdir/$subdir/defined.s tmpdir/def.o] {
26 unresolved $testname
27 return
28}
29
30set saved_LDFLAGS "$LDFLAGS"
31if [istarget "x86_64-*-mingw*"] then {
32 set LDFLAGS "$LDFLAGS --image-base 0"
33}
34
35if { ![ld_link $ld tmpdir/def "$LDFLAGS -T $srcdir/$subdir/defined.t tmpdir/def.o"] } {
36 fail $testname
37} elseif { ![ld_nm $nm "" tmpdir/def] } {
38 fail $testname
39} elseif { ![info exists nm_output(value1)]
40 || ![info exists nm_output(value2)]} {
41 send_log "bad output from nm\n"
42 verbose "bad output from nm"
43 fail $testname
44} elseif {$nm_output(value1) != 1} {
45 send_log "value1 == $nm_output(value1)\n"
46 verbose "value1 == $nm_output(value1)"
47 fail $testname
48} elseif {$nm_output(value2) != 2} {
49 send_log "value2 == $nm_output(value2)\n"
50 verbose "value2 == $nm_output(value2)"
51 fail $testname
52} else {
53 pass $testname
54}
55
56set saved_ASFLAGS "$ASFLAGS"
57if { [is_elf_format] \
58 && ([istarget "i?86-*-*"] || [istarget "x86_64-*-*"]) } {
59 set ASFLAGS "$ASFLAGS -mx86-used-note=no"
60}
61
62set prms_id 0
63run_dump_test "defined2"
64run_dump_test "defined3"
65run_dump_test "defined4"
66if ![is_aout_format] {
67 run_dump_test "defined5"
68}
69if [is_elf_format] {
70 run_dump_test "defined6"
71}
72run_dump_test "pr24008"
73set LDFLAGS "$saved_LDFLAGS"
74set ASFLAGS "$saved_ASFLAGS"
This page took 0.023035 seconds and 4 git commands to generate.