source: trunk/binutils/ld/testsuite/ld-scripts/phdrs.exp

Last change on this file was 610, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r609,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 3.0 KB
Line 
1# Test PHDRS in a linker script.
2# By Ian Lance Taylor, Cygnus Support.
3# Copyright 2001
4# Free Software Foundation, Inc.
5#
6# This file is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20# PHDRS is only meaningful for ELF.
21if { ![istarget *-*-sysv4*] \
22 && ![istarget *-*-unixware*] \
23 && ![istarget *-*-elf*] \
24 && ![istarget *-*-eabi*] \
25 && ![istarget hppa*64*-*-hpux*] \
26 && ![istarget *-*-linux*] \
27 && ![istarget *-*-irix5*] \
28 && ![istarget *-*-irix6*] \
29 && ![istarget *-*-solaris2*] } {
30 return
31}
32
33if { [istarget *-*-linux*aout*] \
34 || [istarget *-*-linux*oldld*] } {
35 return
36}
37
38# This is a very simplistic test.
39
40set testname "PHDRS"
41
42if ![ld_assemble $as $srcdir/$subdir/phdrs.s tmpdir/phdrs.o] {
43 unresolved $testname
44 return
45}
46
47set phdrs_regexp \
48".*Program Header:.*PHDR *off *0x00*34 *vaddr *0x00*800034 *paddr *0x00*800034.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* flags r--.*LOAD *off *0x00* *vaddr *0x00*800000 *paddr *0x00*800000.*filesz *0x00*\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags r-x.*LOAD *off *0x0\[0-9a-f\]* *vaddr *0x00*80*\[0-9a-f\]* *paddr *0x00*80*\[0-9a-f\]*.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags *rw-.*"
49
50# On a 64 bit ELF format, we need different numbers.
51if { [istarget alpha*-*-*] || [istarget "ia64*-*-*"]
52 || [istarget "hppa*64*-*-*"] || [istarget "x86_64*-*-*"]
53 || [istarget "s390x*-*-*"] || [istarget "sparc64*-*-*"]
54 || [istarget "powerpc64*-*-*"] || [istarget "*-*-*elf64*"] } then {
55 set phdrs_regexp \
56".*Program Header:.*PHDR *off *0x00*40 *vaddr *0x00*800040 *paddr *0x00*800040.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* flags r--.*LOAD *off *0x00* *vaddr *0x00*800000 *paddr *0x00*800000.*filesz *0x00*\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags r-x.*LOAD *off *0x0\[0-9a-f\]* *vaddr *0x00*80*\[0-9a-f\]* *paddr *0x00*80*\[0-9a-f\]*.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* *flags *rw-.*"
57}
58
59if ![ld_simple_link $ld tmpdir/phdrs "-T $srcdir/$subdir/phdrs.t tmpdir/phdrs.o"] {
60 fail $testname
61} else {
62 if {[which $objdump] == 0} {
63 unresolved $testname
64 return
65 }
66
67 verbose -log "$objdump --private tmpdir/phdrs"
68 catch "exec $objdump --private tmpdir/phdrs" exec_output
69 set exec_output [prune_warnings $exec_output]
70 verbose -log $exec_output
71
72 if [regexp $phdrs_regexp $exec_output] {
73 pass $testname
74 } else {
75 fail $testname
76 }
77}
Note: See TracBrowser for help on using the repository browser.