binutils/testsuite/
[deliverable/binutils-gdb.git] / binutils / testsuite / lib / utils-lib.exp
index 9881f0133f4a6b4f847d30d843371bb9bf5a14e3..6dbbecf310d466f1f3c17d051f6b9e6617693cca 100644 (file)
@@ -1,5 +1,5 @@
 # Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004, 2006, 2007,
-# 2009 Free Software Foundation, Inc.
+# 2009, 2010 Free Software Foundation, Inc.
 
 # 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
 # This file was written by Rob Savoye <rob@cygnus.com>
 # and extended by Ian Lance Taylor <ian@cygnus.com>
 
+proc load_common_lib { name } {
+    load_lib $name
+}
+
+load_common_lib binutils-common.exp
+
 proc binutil_version { prog } {
     if ![is_remote host] {
        set path [which $prog]
@@ -84,10 +90,10 @@ proc default_binutils_run { prog progargs } {
 }
 
 #
-# default_binutils_assemble
+# default_binutils_assemble_flags
 #      assemble a file
 #
-proc default_binutils_assemble { source object } {
+proc default_binutils_assemble_flags { source object asflags } {
     global srcdir
     global host_triplet
 
@@ -105,7 +111,7 @@ proc default_binutils_assemble { source object } {
        set source asm.s
     }
 
-    set exec_output [target_assemble $source $object ""]
+    set exec_output [target_assemble $source $object $asflags]
     set exec_output [prune_warnings $exec_output]
 
     if [string match "" $exec_output] {
@@ -118,44 +124,6 @@ proc default_binutils_assemble { source object } {
     }
 }
 
-#
-# is_elf_format
-#      true if the object format is known to be ELF
-#
-proc is_elf_format {} {
-    if { ![istarget *-*-sysv4*] \
-        && ![istarget *-*-unixware*] \
-        && ![istarget *-*-elf*] \
-        && ![istarget *-*-eabi*] \
-        && ![istarget hppa*64*-*-hpux*] \
-        && ![istarget ia64-*-hpux*] \
-        && ![istarget *-*-linux*] \
-        && ![istarget *-*-irix5*] \
-        && ![istarget *-*-irix6*] \
-        && ![istarget *-*-netbsd*] \
-        && ![istarget *-*-solaris2*] } {
-       return 0
-    }
-
-    if { [istarget *-*-linux*aout*] \
-        || [istarget *-*-linux*oldld*] } {
-       return 0
-    }
-
-    if { ![istarget *-*-netbsdelf*] \
-        && ([istarget *-*-netbsd*aout*] \
-            || [istarget *-*-netbsdpe*] \
-            || [istarget arm*-*-netbsd*] \
-            || [istarget sparc-*-netbsd*] \
-            || [istarget i*86-*-netbsd*] \
-            || [istarget m68*-*-netbsd*] \
-            || [istarget vax-*-netbsd*] \
-            || [istarget ns32k-*-netbsd*]) } {
-       return 0
-    }
-    return 1
-}
-
 #
 # exe_ext
 #      Returns target executable extension, if any.
@@ -281,6 +249,7 @@ proc run_dump_test { name {extra_options {}} } {
     global subdir srcdir
     global OBJDUMP NM OBJCOPY READELF STRIP
     global OBJDUMPFLAGS NMFLAGS OBJCOPYFLAGS READELFFLAGS STRIPFLAGS
+    global ELFEDIT ELFEDITFLAGS
     global host_triplet
     global env
     global copyfile
@@ -300,6 +269,7 @@ proc run_dump_test { name {extra_options {}} } {
     }
     set opts(addr2line) {}
     set opts(ar) {}
+    set opts(as) {}
     set opts(nm) {}
     set opts(objcopy) {}
     set opts(objdump) {}
@@ -309,6 +279,7 @@ proc run_dump_test { name {extra_options {}} } {
     set opts(size) {}
     set opts(strings) {}
     set opts(name) {}
+    set opts(elfedit) {}
     set opts(PROG) {}
     set opts(DUMPPROG) {}
     set opts(source) {}
@@ -325,6 +296,11 @@ proc run_dump_test { name {extra_options {}} } {
            unresolved $subdir/$name
            return
        }
+
+       # Permit the option to use $srcdir to refer to the source
+       # directory.
+       regsub -all "\\\$srcdir" "$opt_val" "$srcdir/$subdir" opt_val
+
        if [string length $opts($opt_name)] {
            perror "option $opt_name multiply set in $file.d"
            unresolved $subdir/$name
@@ -341,6 +317,11 @@ proc run_dump_test { name {extra_options {}} } {
            unresolved $subdir/$name
            return
        }
+
+       # Permit the option to use $srcdir to refer to the source
+       # directory.
+       regsub -all "\\\$srcdir" "$opt_val" "$srcdir/$subdir" opt_val
+
        # add extra option to end of existing option, adding space
        # if necessary.
        if [string length $opts($opt_name)] {
@@ -372,6 +353,7 @@ proc run_dump_test { name {extra_options {}} } {
            set destopt "-o"
        }
        strings { set program strings }
+       elfedit { set program elfedit }
        default {
            perror "unrecognized program option $opts(PROG) in $file.d"
            unresolved $testname
@@ -462,7 +444,7 @@ proc run_dump_test { name {extra_options {}} } {
        set srcfile $srcdir/$subdir/$opts(source)
     }
 
-    set exec_output [binutils_assemble ${srcfile} $tempfile]
+    set exec_output [binutils_assemble_flags ${srcfile} $tempfile $opts(as)]
     if [string match "" $exec_output] then {
        send_log "$exec_output\n"
        verbose "$exec_output"
This page took 0.030073 seconds and 4 git commands to generate.