diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2003-09-30 00:39:57 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2003-09-30 00:39:57 +0000 |
commit | 7ed2b4e229a3996bc9a5594b8b3658eeff1deddb (patch) | |
tree | 58c94ad3f89730f1fe62e0d19be3290c6b989f9b /ld | |
parent | 9ce701e24f12fd90b3f6de659aa614f5d17efbf7 (diff) | |
download | gdb-7ed2b4e229a3996bc9a5594b8b3658eeff1deddb.zip gdb-7ed2b4e229a3996bc9a5594b8b3658eeff1deddb.tar.gz gdb-7ed2b4e229a3996bc9a5594b8b3658eeff1deddb.tar.bz2 |
2003-09-29 H.J. Lu <hongjiu.lu@intel.com>
* lib/ld-lib.exp (proc is_elf64): New.
* ld-scripts/phdrs.exp: Use is_elf_format and is_elf64.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-scripts/phdrs.exp | 22 | ||||
-rw-r--r-- | ld/testsuite/lib/ld-lib.exp | 26 |
3 files changed, 35 insertions, 19 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 6d56035..900402c 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2003-09-29 H.J. Lu <hongjiu.lu@intel.com> + + * lib/ld-lib.exp (proc is_elf64): New. + + * ld-scripts/phdrs.exp: Use is_elf_format and is_elf64. + 2003-09-23 Alan Modra <alan@modra.org> * ld-discard/exit.s: Correct .text.exit attributes. diff --git a/ld/testsuite/ld-scripts/phdrs.exp b/ld/testsuite/ld-scripts/phdrs.exp index 7901d79..3bd7b81 100644 --- a/ld/testsuite/ld-scripts/phdrs.exp +++ b/ld/testsuite/ld-scripts/phdrs.exp @@ -18,20 +18,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # PHDRS is only meaningful for ELF. -if { ![istarget *-*-sysv4*] \ - && ![istarget *-*-unixware*] \ - && ![istarget *-*-elf*] \ - && ![istarget *-*-eabi*] \ - && ![istarget hppa*64*-*-hpux*] \ - && ![istarget *-*-linux*] \ - && ![istarget *-*-irix5*] \ - && ![istarget *-*-irix6*] \ - && ![istarget *-*-solaris2*] } { - return -} - -if { [istarget *-*-linux*aout*] \ - || [istarget *-*-linux*oldld*] } { +if ![is_elf_format] { return } @@ -48,11 +35,8 @@ set phdrs_regexp \ ".*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*-*-*] || [istarget "ia64*-*-*"] - || [istarget "hppa*64*-*-*"] || [istarget "x86_64*-*-*"] - || [istarget "s390x*-*-*"] || [istarget "sparc64*-*-*"] - || [istarget "powerpc64*-*-*"] || [istarget "*-*-*elf64*"] } then { - set phdrs_regexp \ +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-.*" } diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 4452e2e..92d0a87 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -390,6 +390,32 @@ proc is_elf_format {} { } # +# is_elf64 +# true if the object format is known to be 64bit ELF +proc is_elf64 { binary_file } { + global READELF + global READELFFLAGS + + set readelf_size "" + catch "exec $READELF $READELFFLAGS -h $binary_file > readelf.out" got + + if ![string match "" $got] then { + return 0 + } + + if { ![regexp "\n\[ \]*Class:\[ \]*ELF(\[0-9\]+)\n" \ + [file_contents readelf.out] nil readelf_size] } { + return 0 + } + + if { $readelf_size == "64" } { + return 1 + } + + return 0 +} + +# # simple_diff # compares two files line-by-line # returns differences if exist |