Commit | Line | Data |
---|---|---|
1ed89aa9 | 1 | # Test PHDRS with empty sections in a linker script. |
b3adc24a | 2 | # Copyright (C) 2005-2020 Free Software Foundation, Inc. |
1ed89aa9 | 3 | # |
f96b4a7b NC |
4 | # This file is part of the GNU Binutils. |
5 | # | |
6 | # This program is free software; you can redistribute it and/or modify | |
1ed89aa9 | 7 | # it under the terms of the GNU General Public License as published by |
f96b4a7b | 8 | # the Free Software Foundation; either version 3 of the License, or |
1ed89aa9 NC |
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 | |
f96b4a7b NC |
18 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
19 | # MA 02110-1301, USA. | |
1ed89aa9 NC |
20 | |
21 | # PHDRS2 is only meaningful for ELF. | |
22 | if { ![istarget *-*-sysv4*] \ | |
23 | && ![istarget *-*-unixware*] \ | |
24 | && ![istarget *-*-elf*] \ | |
25 | && ![istarget *-*-eabi*] \ | |
19c7c582 | 26 | && ![istarget hppa*64*-*-hpux*] \ |
1ed89aa9 | 27 | && ![istarget *-*-linux*] \ |
f1ac0afe | 28 | && ![istarget arm*-*-uclinuxfdpiceabi] \ |
5940a93c | 29 | && ![istarget *-*-gnu*] \ |
1ed89aa9 NC |
30 | && ![istarget *-*-irix5*] \ |
31 | && ![istarget *-*-irix6*] \ | |
32 | && ![istarget *-*-solaris2*] } { | |
33 | return | |
1ed89aa9 NC |
34 | } |
35 | ||
36 | # This is a very simplistic test. | |
37 | ||
38 | set testname "PHDRS2" | |
39 | ||
e9f53129 AM |
40 | set ldopt "" |
41 | if { [istarget spu*-*-*] } { | |
42 | set ldopt "--local-store 0:0" | |
43 | } | |
44 | ||
1ed89aa9 NC |
45 | if ![ld_assemble $as $srcdir/$subdir/phdrs2.s tmpdir/phdrs2.o] { |
46 | unresolved $testname | |
47 | return | |
48 | } | |
49 | ||
50 | set phdrs_regexp \ | |
51 | ".*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.*" | |
52 | ||
e9f53129 | 53 | set ldopt "$ldopt -T $srcdir/$subdir/phdrs2.t tmpdir/phdrs2.o" |
d9816402 | 54 | if ![ld_link $ld tmpdir/phdrs2 $ldopt] { |
1ed89aa9 NC |
55 | fail $testname |
56 | } else { | |
7f6a71ff | 57 | if {![is_remote host] && [which $objdump] == 0} { |
1ed89aa9 NC |
58 | unresolved $testname |
59 | return | |
60 | } | |
61 | ||
e3b66208 | 62 | set exec_output [run_host_cmd "$objdump" "--private-headers tmpdir/phdrs2"] |
1ed89aa9 NC |
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 | } |