* elf.c (bfd_section_from_shdr): Remove extraneous breaks.
[binutils.git] / ld / testsuite / ld-scripts / phdrs2.exp
blob8c41ffe31799769112395c11aef8925eb08c6445
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, 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 set ldopt ""
40 if { [istarget spu*-*-*] } {
41 set ldopt "--local-store 0:0"
44 if ![ld_assemble $as $srcdir/$subdir/phdrs2.s tmpdir/phdrs2.o] {
45 unresolved $testname
46 return
49 set phdrs_regexp \
50 ".*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.*"
52 set ldopt "$ldopt -T $srcdir/$subdir/phdrs2.t tmpdir/phdrs2.o"
53 if ![ld_simple_link $ld tmpdir/phdrs2 $ldopt] {
54 fail $testname
55 } else {
56 if {[which $objdump] == 0} {
57 unresolved $testname
58 return
61 verbose -log "$objdump --private tmpdir/phdrs2"
62 catch "exec $objdump --private tmpdir/phdrs2" exec_output
63 set exec_output [prune_warnings $exec_output]
64 verbose -log $exec_output
66 if [regexp $phdrs_regexp $exec_output] {
67 pass $testname
68 } else {
69 fail $testname