]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/testsuite/ld-scripts/phdrs.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-scripts / phdrs.exp
index 5a37fa0e1fc01d876aca1ff216e9c6928f6ff09f..e14851bbc3e549cb7b1d8316ef67fc258ed6f286 100644 (file)
@@ -1,20 +1,26 @@
 # Test PHDRS in a linker script.
 # By Ian Lance Taylor, Cygnus Support.
+#   Copyright (C) 1999-2021 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (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
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
 
 # PHDRS is only meaningful for ELF.
-if { ![istarget *-*-sysv4*] \
-     && ![istarget *-*-unixware*] \
-     && ![istarget *-*-elf*] \
-     && ![istarget *-*-eabi*] \
-     && ![istarget *-*-linux*] \
-     && ![istarget *-*-irix5*] \
-     && ![istarget *-*-irix6*] \
-     && ![istarget *-*-solaris2*] } {
-    return
-}
-
-if { [istarget *-*-linux*aout*] \
-     || [istarget *-*-linux*oldld*] } {
+if ![is_elf_format] {
     return
 }
 
@@ -22,30 +28,34 @@ if { [istarget *-*-linux*aout*] \
 
 set testname "PHDRS"
 
+set ldopt ""
+if { [istarget spu*-*-*] } {
+    set ldopt "--local-store 0:0"
+}
+
 if ![ld_assemble $as $srcdir/$subdir/phdrs.s tmpdir/phdrs.o] {
     unresolved $testname
     return
 }
 
 set phdrs_regexp \
-".*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-.*"
+".*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-.*"
 
 # On a 64 bit ELF format, we need different numbers.
-if { [istarget alpha*-*-*] } then {
-  set phdrs_regexp \
-".*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-.*"
+if [is_elf64 tmpdir/phdrs.o] {
+    set phdrs_regexp \
+".*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-.*"
 }
 
-if ![ld_simple_link $ld tmpdir/phdrs "-T $srcdir/$subdir/phdrs.t tmpdir/phdrs.o"] {
+set ldopt "$ldopt -T $srcdir/$subdir/phdrs.t tmpdir/phdrs.o"
+if ![ld_link $ld tmpdir/phdrs $ldopt] {
     fail $testname
 } else {
-    if {[which $objdump] == 0} {
+    if {![is_remote host] && [which $objdump] == 0} {
        unresolved $testname
        return
     }
-
-    verbose -log "$objdump --private tmpdir/phdrs"
-    catch "exec $objdump --private tmpdir/phdrs" exec_output
+    set exec_output [run_host_cmd "$objdump" "--private-headers tmpdir/phdrs"]
     set exec_output [prune_warnings $exec_output]
     verbose -log $exec_output