aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/lib/ld-lib.exp
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2003-09-30 00:39:57 +0000
committerH.J. Lu <hjl.tools@gmail.com>2003-09-30 00:39:57 +0000
commit7ed2b4e229a3996bc9a5594b8b3658eeff1deddb (patch)
tree58c94ad3f89730f1fe62e0d19be3290c6b989f9b /ld/testsuite/lib/ld-lib.exp
parent9ce701e24f12fd90b3f6de659aa614f5d17efbf7 (diff)
downloadgdb-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/testsuite/lib/ld-lib.exp')
-rw-r--r--ld/testsuite/lib/ld-lib.exp26
1 files changed, 26 insertions, 0 deletions
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