1 # Expect script for binutils tests
2 # Copyright 2006, 2007 Free Software Foundation, Inc.
4 # This file is part of the GNU Binutils.
6 # This program 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 3 of the License, or
9 # (at your option) any later version.
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.
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
18 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 # Written by H.J. Lu (hongjiu.lu@intel.com)
24 # Make sure that binutils can correctly handle ld output in ELF.
27 if { ![istarget *-*-linux*] } {
31 if { [istarget *-*-linux*aout*]
32 || [istarget *-*-linux*oldld*] } {
36 proc binutils_test { prog_name ld_options test } {
46 eval set prog \$$prog_name
47 set test_name "$prog_name $ld_options ($test)"
49 if { ![ld_assemble $as $srcdir/$subdir/$test.s tmpdir/$test.o ] } {
50 unresolved "$test_name"
54 if { ![ld_simple_link $ld tmpdir/$test "$ld_options tmpdir/$test.o"] } {
55 if { [string match "*not supported*" $link_output]
56 || [string match "*unrecognized option*" $link_output] } {
57 unsupported "$ld_options is not supported by this target"
59 unresolved "$test_name"
64 send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.exp\n"
65 set got [remote_exec host "$READELF -l --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.exp"]
66 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
68 unresolved "$test_name"
72 send_log "$prog tmpdir/$test\n"
73 set got [remote_exec host "$prog tmpdir/$test"]
74 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
80 send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.out\n"
81 set got [remote_exec host "$READELF -l --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.out"]
82 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
84 unresolved "$test_name"
88 if { [catch {exec cmp tmpdir/$test.exp tmpdir/$test.out}] } then {
89 send_log "tmpdir/$test.exp tmpdir/$test.out differ.\n"
97 binutils_test strip "-z max-page-size=0x200000" maxpage1
98 binutils_test strip "-z max-page-size=0x200000 -z common-page-size=0x100000" maxpage1
99 binutils_test strip "-z max-page-size=0x100000" maxpage1
100 binutils_test strip "-z max-page-size=0x100000 -z common-page-size=0x1000" maxpage1
102 binutils_test strip "" maxpage1
103 binutils_test strip "-shared" maxpage1
104 binutils_test objcopy "" maxpage1
105 binutils_test objcopy "-shared" maxpage1
107 binutils_test strip "-z relro" maxpage1
108 binutils_test strip "-z relro -shared" maxpage1
109 binutils_test objcopy "-z relro" maxpage1
110 binutils_test objcopy "-z relro -shared" maxpage1
112 binutils_test objcopy "" tbss1
113 binutils_test objcopy "-shared" tbss1
114 binutils_test objcopy "-z max-page-size=0x100000" tbss1
115 binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tbss1
116 binutils_test objcopy "" tdata1
117 binutils_test objcopy "-shared" tdata1
118 binutils_test objcopy "-z max-page-size=0x100000" tdata1
119 binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata1
120 binutils_test objcopy "" tbss2
121 binutils_test objcopy "-shared" tbss2
122 binutils_test objcopy "-z max-page-size=0x100000" tbss2
123 binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tbss2
124 binutils_test objcopy "-z max-page-size=0x100000" tdata2
125 binutils_test objcopy "" tdata2
126 binutils_test objcopy "-shared" tdata2
127 binutils_test objcopy "-z max-page-size=0x100000 -z common-page-size=0x1000" tdata2