Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | # Test DEFINED in a linker script. |
2 | # By Ian Lance Taylor, Cygnus Support. | |
aa820537 | 3 | # Copyright 2001, 2003. 2005, 2006, 2007 |
a2b64bed NC |
4 | # Free Software Foundation, Inc. |
5 | # | |
f96b4a7b NC |
6 | # This file is part of the GNU Binutils. |
7 | # | |
8 | # This program is free software; you can redistribute it and/or modify | |
a2b64bed | 9 | # it under the terms of the GNU General Public License as published by |
f96b4a7b | 10 | # the Free Software Foundation; either version 3 of the License, or |
a2b64bed | 11 | # (at your option) any later version. |
f96b4a7b | 12 | # |
a2b64bed NC |
13 | # This program is distributed in the hope that it will be useful, |
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | # GNU General Public License for more details. | |
f96b4a7b | 17 | # |
a2b64bed NC |
18 | # You should have received a copy of the GNU General Public License |
19 | # along with this program; if not, write to the Free Software | |
f96b4a7b NC |
20 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
21 | # MA 02110-1301, USA. | |
252b5132 RH |
22 | |
23 | set testname "DEFINED" | |
24 | set prms_id 5699 | |
25 | ||
26 | if ![ld_assemble $as $srcdir/$subdir/defined.s tmpdir/def.o] { | |
27 | unresolved $testname | |
28 | return | |
29 | } | |
30 | ||
99ad8390 NC |
31 | global LDFLAGS |
32 | set saved_LDFLAGS "$LDFLAGS" | |
42037fe5 | 33 | if [istarget "x86_64-*-mingw*"] then { |
99ad8390 NC |
34 | set LDFLAGS "$LDFLAGS --image-base 0" |
35 | } | |
36 | ||
37 | if ![ld_simple_link $ld tmpdir/def "$LDFLAGS -T $srcdir/$subdir/defined.t tmpdir/def.o"] { | |
252b5132 RH |
38 | fail $testname |
39 | } else { | |
992c450d | 40 | if ![ld_nm $nm "" tmpdir/def] { |
252b5132 RH |
41 | unresolved $testname |
42 | } else { | |
43 | if {![info exists nm_output(value1)] \ | |
44 | || ![info exists nm_output(value2)]} { | |
45 | send_log "bad output from nm\n" | |
46 | verbose "bad output from nm" | |
47 | fail $testname | |
48 | } else { | |
49 | if {$nm_output(value1) != 1} { | |
50 | send_log "value1 == $nm_output(value1)\n" | |
51 | verbose "value1 == $nm_output(value1)" | |
52 | fail $testname | |
53 | } else { | |
54 | if {$nm_output(value2) != 2} { | |
55 | send_log "value2 == $nm_output(value2)\n" | |
56 | verbose "value2 == $nm_output(value2)" | |
57 | fail $testname | |
58 | } else { | |
59 | pass $testname | |
60 | } | |
61 | } | |
62 | } | |
63 | } | |
64 | } | |
b8fe28d4 HPN |
65 | |
66 | set prms_id 0 | |
67 | run_dump_test "defined2" | |
8e919164 | 68 | run_dump_test "defined3" |
99ad8390 | 69 | set LDFLAGS "$saved_LDFLAGS" |