daily update
[binutils.git] / ld / testsuite / ld-scripts / phdrs2.exp
blob48f24c550da209faa762604e09d8d435fe7f01f2
1 # Test PHDRS with empty sections in a linker script.
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.
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.
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.
17 # PHDRS2 is only meaningful for ELF.
18 if { ![istarget *-*-sysv4*] \
19 && ![istarget *-*-unixware*] \
20 && ![istarget *-*-elf*] \
21 && ![istarget *-*-eabi*] \
22 && ![istarget hppa*64*-*-hpux*] \
23 && ![istarget *-*-linux*] \
24 && ![istarget *-*-irix5*] \
25 && ![istarget *-*-irix6*] \
26 && ![istarget *-*-solaris2*] } {
27 return
30 if { [istarget *-*-linux*aout*] \
31 || [istarget *-*-linux*oldld*] } {
32 return
35 # This is a very simplistic test.
37 set testname "PHDRS2"
39 if ![ld_assemble $as $srcdir/$subdir/phdrs2.s tmpdir/phdrs2.o] {
40 unresolved $testname
41 return
44 set phdrs_regexp \
45 ".*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.*"
47 if ![ld_simple_link $ld tmpdir/phdrs2 "-T $srcdir/$subdir/phdrs2.t tmpdir/phdrs2.o"] {
48 fail $testname
49 } else {
50 if {[which $objdump] == 0} {
51 unresolved $testname
52 return
55 verbose -log "$objdump --private tmpdir/phdrs2"
56 catch "exec $objdump --private tmpdir/phdrs2" exec_output
57 set exec_output [prune_warnings $exec_output]
58 verbose -log $exec_output
60 if [regexp $phdrs_regexp $exec_output] {
61 pass $testname
62 } else {
63 fail $testname