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