aboutsummaryrefslogtreecommitdiff
path: root/binutils/testsuite/lib/utils-lib.exp
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/testsuite/lib/utils-lib.exp')
-rw-r--r--binutils/testsuite/lib/utils-lib.exp49
1 files changed, 49 insertions, 0 deletions
diff --git a/binutils/testsuite/lib/utils-lib.exp b/binutils/testsuite/lib/utils-lib.exp
index 2ea9f83..395e762 100644
--- a/binutils/testsuite/lib/utils-lib.exp
+++ b/binutils/testsuite/lib/utils-lib.exp
@@ -43,6 +43,7 @@ proc binutil_version { prog } {
#
proc default_binutils_run { prog progargs } {
global binutils_run_failed
+ global host_triplet
set binutils_run_failed 0
@@ -67,6 +68,7 @@ proc default_binutils_run { prog progargs } {
# language.
regsub -all "\\$" $progargs "\\$" progq
catch "exec $prog $progq" exec_output
+ set exec_output [prune_system_crud $host_triplet $exec_output]
if {![string match "" $exec_output]} then {
send_log "$exec_output\n"
verbose "$exec_output"
@@ -81,6 +83,7 @@ proc default_binutils_run { prog progargs } {
proc default_binutils_assemble { as source object } {
global ASFLAGS
global srcdir
+ global host_triplet
if {[which $as] == 0} then {
perror "$as does not exist"
@@ -117,6 +120,46 @@ proc default_binutils_assemble { as source object } {
}
}
+#
+# default_binutils_compile
+# compile a file
+#
+proc default_binutils_compile { cc flags source object } {
+ global CFLAGS
+ global srcdir
+ global host_triplet
+
+ if {[which $cc] == 0} then {
+ perror "$cc does not exist"
+ return 0
+ }
+
+ if ![info exists CFLAGS] { set CFLAGS "" }
+
+ send_log "$cc $flags $CFLAGS -o $object $source\n"
+ verbose "$cc $flags $CFLAGS -o $object $source"
+ catch "exec $cc $flags $CFLAGS -o $object $source" exec_output
+
+ set exec_output [prune_system_crud $host_triplet $exec_output]
+
+ if [string match "" $exec_output] then {
+ return 1
+ } else {
+ send_log "$exec_output\n"
+ verbose "$exec_output"
+ perror "$source: compilation failed"
+ return 0
+ }
+}
+
+#
+# default_binutils_remove
+# remove a file
+#
+proc default_binutils_remove { file } {
+ catch "exec rm -f $file" exec_output
+}
+
# This definition is taken from an unreleased version of DejaGnu. Once
# that version gets released, and has been out in the world for a few
# months at least, it may be safe to delete this copy.
@@ -137,6 +180,12 @@ if ![string length [info proc prune_system_crud]] {
# The "\\1" is to try to preserve a "\n" but only if necessary.
regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
+ # This happens when compiling on Alpha OSF/1 with cc -g -O.
+ regsub -all "(^|\n)(uopt: Warning: file not optimized; use -g3 if both optimization and debug wanted\n?)+" $text "\\1" text
+
+ # This happens on SunOS with cc -g -O.
+ regsub -all "(^|\n)(cc: Warning: -O conflicts with -g. -O turned off.\n?)+" $text "\\1" text
+
# It might be tempting to get carried away and delete blank lines, etc.
# Just delete *exactly* what we're ask to, and that's it.
return $text