]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - ld/testsuite/ld-scripts/phdrs2.exp
New Cell SPU port.
[thirdparty/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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
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
28 }
29
30 if { [istarget *-*-linux*aout*] \
31 || [istarget *-*-linux*oldld*] } {
32 return
33 }
34
35 # This is a very simplistic test.
36
37 set testname "PHDRS2"
38
39 set ldopt ""
40 if { [istarget spu*-*-*] } {
41 set ldopt "--local-store 0:0"
42 }
43
44 if ![ld_assemble $as $srcdir/$subdir/phdrs2.s tmpdir/phdrs2.o] {
45 unresolved $testname
46 return
47 }
48
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.*"
51
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
59 }
60
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
65
66 if [regexp $phdrs_regexp $exec_output] {
67 pass $testname
68 } else {
69 fail $testname
70 }
71 }