bbe36d08e91a88cfd3d12992d1e17329bf6d2d6c
[deliverable/binutils-gdb.git] / ld / testsuite / ld-scripts / phdrs2.exp
1 # Test PHDRS with empty sections in a linker script.
2 #
3 # This file is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # PHDRS2 is only meaningful for ELF.
18 if { ![istarget *-*-sysv4*] \
19 && ![istarget *-*-unixware*] \
20 && ![istarget *-*-elf*] \
21 && ![istarget *-*-eabi*] \
22 && ![istarget *-*-linux*] \
23 && ![istarget *-*-irix5*] \
24 && ![istarget *-*-irix6*] \
25 && ![istarget *-*-solaris2*] } {
26 return
27 }
28
29 if { [istarget *-*-linux*aout*] \
30 || [istarget *-*-linux*oldld*] } {
31 return
32 }
33
34 # This is a very simplistic test.
35
36 set testname "PHDRS2"
37
38 if ![ld_assemble $as $srcdir/$subdir/phdrs2.s tmpdir/phdrs2.o] {
39 unresolved $testname
40 return
41 }
42
43 set phdrs_regexp \
44 ".*Program Header:.*LOAD *off *0x00\[0-9a-f\]* *vaddr *0x00*800000 *paddr *0x00*800000.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]*.*LOAD *off *0x00\[0-9a-f\]* *vaddr *0x00*800004 *paddr *0x00*800004.*filesz *0x00*\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags rw.*"
45
46 if ![ld_simple_link $ld tmpdir/phdrs2 "-T $srcdir/$subdir/phdrs2.t tmpdir/phdrs2.o"] {
47 fail $testname
48 } else {
49 if {[which $objdump] == 0} {
50 unresolved $testname
51 return
52 }
53
54 verbose -log "$objdump --private tmpdir/phdrs2"
55 catch "exec $objdump --private tmpdir/phdrs2" exec_output
56 set exec_output [prune_warnings $exec_output]
57 verbose -log $exec_output
58
59 if [regexp $phdrs_regexp $exec_output] {
60 pass $testname
61 } else {
62 fail $testname
63 }
64 }
This page took 0.032649 seconds and 3 git commands to generate.