2002-06-06 10:03:38 +00:00
|
|
|
# Test PHDRS with empty sections in a linker script.
|
2007-07-06 14:09:45 +00:00
|
|
|
# Copyright 2007 Free Software Foundation, Inc,
|
2002-06-06 10:03:38 +00:00
|
|
|
#
|
2007-07-06 14:09:45 +00:00
|
|
|
# This file is part of the GNU Binutils.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
2002-06-06 10:03:38 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-06 14:09:45 +00:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
2002-06-06 10:03:38 +00:00
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2007-07-06 14:09:45 +00:00
|
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301, USA.
|
2002-06-06 10:03:38 +00:00
|
|
|
|
|
|
|
# PHDRS2 is only meaningful for ELF.
|
|
|
|
if { ![istarget *-*-sysv4*] \
|
|
|
|
&& ![istarget *-*-unixware*] \
|
|
|
|
&& ![istarget *-*-elf*] \
|
|
|
|
&& ![istarget *-*-eabi*] \
|
* ld-discard/discard.exp, ld-scripts/phdrs.exp, ld-scripts/phdrs2.exp,
ld-selective/sel-dump.exp: Test hppa*64*-*-hpux* target.
* ld-elfvers/vers.exp, ld-elfvsb/elfvsb.exp, ld-elfweak/elfweak.exp,
ld-linkonce/linkonce.exp, ld-shared/shared.exp,
ld-undefined/weak-undef.exp: Test hppa*64*-*-hpux* and hppa*-*-linux*
targets.
* ld-discard/exit.s, ld-discard/extern.s, ld-discard/start.s,
ld-discard/static.s: Add whitespace before assembler directives.
2002-07-30 07:41:15 +00:00
|
|
|
&& ![istarget hppa*64*-*-hpux*] \
|
2002-06-06 10:03:38 +00:00
|
|
|
&& ![istarget *-*-linux*] \
|
|
|
|
&& ![istarget *-*-irix5*] \
|
|
|
|
&& ![istarget *-*-irix6*] \
|
|
|
|
&& ![istarget *-*-solaris2*] } {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if { [istarget *-*-linux*aout*] \
|
|
|
|
|| [istarget *-*-linux*oldld*] } {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
# This is a very simplistic test.
|
|
|
|
|
|
|
|
set testname "PHDRS2"
|
|
|
|
|
2006-10-25 06:49:21 +00:00
|
|
|
set ldopt ""
|
|
|
|
if { [istarget spu*-*-*] } {
|
|
|
|
set ldopt "--local-store 0:0"
|
|
|
|
}
|
|
|
|
|
2002-06-06 10:03:38 +00:00
|
|
|
if ![ld_assemble $as $srcdir/$subdir/phdrs2.s tmpdir/phdrs2.o] {
|
|
|
|
unresolved $testname
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
set phdrs_regexp \
|
|
|
|
".*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.*"
|
|
|
|
|
2006-10-25 06:49:21 +00:00
|
|
|
set ldopt "$ldopt -T $srcdir/$subdir/phdrs2.t tmpdir/phdrs2.o"
|
|
|
|
if ![ld_simple_link $ld tmpdir/phdrs2 $ldopt] {
|
2002-06-06 10:03:38 +00:00
|
|
|
fail $testname
|
|
|
|
} else {
|
2007-08-28 13:21:58 +00:00
|
|
|
if {![is_remote host] && [which $objdump] == 0} {
|
2002-06-06 10:03:38 +00:00
|
|
|
unresolved $testname
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2007-08-28 13:21:58 +00:00
|
|
|
set exec_output [run_host_cmd "$objdump" "--private tmpdir/phdrs2"]
|
2002-06-06 10:03:38 +00:00
|
|
|
set exec_output [prune_warnings $exec_output]
|
|
|
|
verbose -log $exec_output
|
|
|
|
|
|
|
|
if [regexp $phdrs_regexp $exec_output] {
|
|
|
|
pass $testname
|
|
|
|
} else {
|
|
|
|
fail $testname
|
|
|
|
}
|
|
|
|
}
|