]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/testsuite/ld-elf/binutils.exp
*** empty log message ***
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-elf / binutils.exp
CommitLineData
24718e3b
L
1# Expect script for binutils tests
2# Copyright 2006 Free Software Foundation, Inc.
3#
4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
17#
18# Written by H.J. Lu (hongjiu.lu@intel.com)
19#
20
21# Make sure that binutils can correctly handle ld output in ELF.
22
1224efb8
L
23# Run on Linux only.
24if { ![istarget *-*-linux*] } {
24718e3b
L
25 return
26}
27
1224efb8
L
28if { [istarget *-*-linux*aout*]
29 || [istarget *-*-linux*oldld*] } {
30 return
31}
32
33proc binutils_test { prog_name ld_options test } {
24718e3b
L
34 global as
35 global ld
36 global READELF
1224efb8 37 global objcopy
24718e3b
L
38 global strip
39 global srcdir
40 global subdir
1224efb8
L
41 global link_output
42
43 eval set prog \$$prog_name
44 set test_name "$prog_name $ld_options ($test)"
24718e3b
L
45
46 if { ![ld_assemble $as $srcdir/$subdir/$test.s tmpdir/$test.o ] } {
1224efb8 47 unresolved "$test_name"
24718e3b
L
48 return
49 }
50
51 if { ![ld_simple_link $ld tmpdir/$test "$ld_options tmpdir/$test.o"] } {
1224efb8
L
52 if { [string match "*not supported*" $link_output]
53 || [string match "*unrecognized option*" $link_output] } {
54 unsupported "$ld_options is not supported by this target"
55 } else {
56 unresolved "$test_name"
57 }
24718e3b
L
58 return
59 }
60
61 send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.exp\n"
62 catch "exec $READELF -l --wide tmpdir/$test > tmpdir/$test.exp" got
63 if ![string match "" $got] then {
64 send_log "$got\n"
1224efb8 65 unresolved "$test_name"
24718e3b
L
66 return
67 }
68
1224efb8
L
69 send_log "$prog tmpdir/$test\n"
70 catch "exec $prog tmpdir/$test" got
24718e3b
L
71 if ![string match "" $got] then {
72 send_log "$got\n"
1224efb8 73 fail "$test_name"
24718e3b
L
74 return
75 }
76
77 send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.out\n"
78 catch "exec $READELF -l --wide tmpdir/$test > tmpdir/$test.out" got
79 if ![string match "" $got] then {
80 send_log "$got\n"
1224efb8 81 unresolved "$test_name"
24718e3b
L
82 return
83 }
84
85 if { [catch {exec cmp tmpdir/$test.exp tmpdir/$test.out}] } then {
86 send_log "tmpdir/$test.exp tmpdir/$test.out differ.\n"
1224efb8 87 fail "$test_name"
24718e3b
L
88 return
89 }
90
1224efb8 91 pass "$test_name"
24718e3b
L
92}
93
1224efb8
L
94binutils_test strip "-z max-page-size=0x200000" maxpage1
95binutils_test strip "-z max-page-size=0x200000 -z common-page-size=0x100000" maxpage1
96binutils_test strip "-z max-page-size=0x100000" maxpage1
97binutils_test strip "-z max-page-size=0x100000 -z common-page-size=0x1000" maxpage1
98
99binutils_test strip "" maxpage1
100binutils_test strip "-shared" maxpage1
101binutils_test objcopy "" maxpage1
102binutils_test objcopy "-shared" maxpage1
103
104binutils_test objcopy "" tbss1
105binutils_test objcopy "-shared" tbss1
106binutils_test objcopy "-z max-page-size=0x100000" tbss1
107binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tbss1
108binutils_test objcopy "" tdata1
109binutils_test objcopy "-shared" tdata1
110binutils_test objcopy "-z max-page-size=0x100000" tdata1
111binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata1
112binutils_test objcopy "" tbss2
113binutils_test objcopy "-shared" tbss2
114binutils_test objcopy "-z max-page-size=0x100000" tbss2
115binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tbss2
116binutils_test objcopy "-z max-page-size=0x100000" tdata2
117binutils_test objcopy "" tdata2
118binutils_test objcopy "-shared" tdata2
119binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata2