1 # Test PHDRS in a linker script.
2 # By Ian Lance Taylor
, Cygnus Support.
4 # PHDRS is only meaningful
for ELF.
5 if { ![istarget
*-*-sysv4
*] \
6 && ![istarget
*-*-unixware
*] \
7 && ![istarget
*-*-elf
*] \
8 && ![istarget
*-*-eabi
*] \
9 && ![istarget
*-*-linux
*] \
10 && ![istarget
*-*-irix5
*] \
11 && ![istarget
*-*-irix6
*] \
12 && ![istarget
*-*-solaris2
*] } {
16 if { [istarget
*-*-linux
*aout
*] \
17 ||
[istarget
*-*-linux
*oldld
*] } {
21 # This is a very simplistic test.
25 if ![ld_assemble $as $srcdir
/$subdir
/phdrs.s tmpdir
/phdrs.o
] {
31 ".*Program Header:.*PHDR *off *0x00*34 *vaddr *0x00*80034 *paddr *0x00*80034.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* flags r--.*LOAD *off *0x00* *vaddr *0x00*80000 *paddr *0x00*80000.*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-.*"
33 #
On a
64 bit ELF format
, we need different numbers.
34 if { [istarget alpha
*-*-*] ||
[istarget
"ia64*-*-*"]
35 ||
[istarget
"hppa*64*-*-*"] } then {
37 ".*Program Header:.*PHDR *off *0x00*40 *vaddr *0x00*80040 *paddr *0x00*80040.*filesz *0x0\[0-9a-f\]* *memsz *0x0\[0-9a-f\]* flags r--.*LOAD *off *0x00* *vaddr *0x00*80000 *paddr *0x00*80000.*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-.*"
40 if ![ld_simple_link $
ld tmpdir
/phdrs
"-T $srcdir/$subdir/phdrs.t tmpdir/phdrs.o"] {
43 if {[which $objdump
] == 0} {
48 verbose
-log "$objdump --private tmpdir/phdrs"
49 catch
"exec $objdump --private tmpdir/phdrs" exec_output
50 set exec_output
[prune_warnings $exec_output
]
51 verbose
-log $exec_output
53 if [regexp $phdrs_regexp $exec_output
] {