* ld-discard/discard.exp, ld-scripts/phdrs.exp, ld-scripts/phdrs2.exp,
[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 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 if ![ld_assemble $as $srcdir/$subdir/phdrs2.s tmpdir/phdrs2.o] {
40 unresolved $testname
41 return
42 }
43
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.*"
46
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
53 }
54
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
59
60 if [regexp $phdrs_regexp $exec_output] {
61 pass $testname
62 } else {
63 fail $testname
64 }
65 }
This page took 0.05879 seconds and 4 git commands to generate.