mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-30 10:45:03 +08:00
Move proc gcc_target_object_format from ecos.exp to file-format.exp
From-SVN: r27842
This commit is contained in:
parent
2e477ae806
commit
58e1e5ad9a
@ -1,3 +1,15 @@
|
||||
1999-06-29 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* lib/file-format.exp: New file: Move definition of proc
|
||||
gcc_target_object_format to here from
|
||||
gcc.dg/special/ecos.exp.
|
||||
|
||||
* lib/c-torture.exp: Include lib file-format.exp.
|
||||
* lib/gcc-dg.exp: Include lib file-format.exp.
|
||||
|
||||
* gcc.dg/special/ecos.exp: Remove definition of proc
|
||||
gcc_target_object_format.
|
||||
|
||||
Mon Jun 28 08:20:51 1999 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* gcc.c-torture/execute/990628-1.c: New test.
|
||||
|
@ -24,59 +24,10 @@
|
||||
# Load support procs.
|
||||
load_lib gcc-dg.exp
|
||||
|
||||
###################################
|
||||
# proc gcc_target_object_format { }
|
||||
###################################
|
||||
|
||||
proc gcc_target_object_format { } {
|
||||
global gcc_target_object_format_saved
|
||||
|
||||
if [info exists gcc_target_object_format_saved] {
|
||||
verbose "gcc_target_object_format returning saved $gcc_target_object_format_saved" 2
|
||||
return $gcc_target_object_format_saved
|
||||
} else {
|
||||
|
||||
set objdump_name [find_binutils_prog objdump]
|
||||
set open_file [open objfmtst.c w]
|
||||
puts $open_file "void foo(void) { }"
|
||||
close $open_file
|
||||
|
||||
gcc_target_compile objfmtst.c objfmtst.o object ""
|
||||
|
||||
set output [exec $objdump_name --file-headers objfmtst.o ]
|
||||
|
||||
file delete objfmtst.o
|
||||
|
||||
if ![ regexp "file format (.*)arch" $output dummy objformat ] {
|
||||
verbose "Could not parse objdump output" 2
|
||||
set gcc_target_object_format_saved unknown
|
||||
} else {
|
||||
switch -regexp $objformat {
|
||||
elf {
|
||||
verbose "gcc_target_object_format returning elf" 2
|
||||
set gcc_target_object_format_saved elf
|
||||
}
|
||||
ecoff {
|
||||
verbose "gcc_target_object_format returning ecoff" 2
|
||||
set gcc_target_object_format_saved ecoff
|
||||
}
|
||||
coff {
|
||||
verbose "gcc_target_object_format returning coff" 2
|
||||
set gcc_target_object_format_saved coff
|
||||
}
|
||||
a\.out {
|
||||
verbose "gcc_target_object_format returning a.out" 2
|
||||
set gcc_target_object_format_saved a.out
|
||||
}
|
||||
default {
|
||||
verbose "gcc_target_object_format returning unknown" 2
|
||||
set gcc_target_object_format_saved unknown
|
||||
}
|
||||
}
|
||||
}
|
||||
return $gcc_target_object_format_saved
|
||||
}
|
||||
}
|
||||
###############################
|
||||
# proc gcc_target_object_format {}
|
||||
###############################
|
||||
# has been moved to: gcc/testsuite/lib/file-format.exp
|
||||
|
||||
###############################
|
||||
# proc check_weak_available { }
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
# This file was written by Rob Savoye. (rob@cygnus.com)
|
||||
|
||||
load_lib file-format.exp
|
||||
|
||||
# The default option list can be overridden by
|
||||
# TORTURE_OPTIONS="{ { list1 } ... { listN } }"
|
||||
|
||||
|
73
gcc/testsuite/lib/file-format.exp
Normal file
73
gcc/testsuite/lib/file-format.exp
Normal file
@ -0,0 +1,73 @@
|
||||
# Copyright (C) 1999 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
|
||||
# the Free Software Foundation; either version 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# egcs-bugs@egcs.cygnus.com
|
||||
|
||||
# This file defines a proc for determining the file format in use by the
|
||||
# target. This is useful for tests that are only supported by certain file
|
||||
# formats. This procedure is defined in a seperate file so that it can be
|
||||
# included by other expect library files.
|
||||
|
||||
proc gcc_target_object_format { } {
|
||||
global gcc_target_object_format_saved
|
||||
|
||||
if [info exists gcc_target_object_format_saved] {
|
||||
verbose "gcc_target_object_format returning saved $gcc_target_object_format_saved" 2
|
||||
} else {
|
||||
set objdump_name [find_binutils_prog objdump]
|
||||
set open_file [open objfmtst.c w]
|
||||
puts $open_file "void foo(void) { }"
|
||||
close $open_file
|
||||
|
||||
gcc_target_compile objfmtst.c objfmtst.o object ""
|
||||
|
||||
set output [exec $objdump_name --file-headers objfmtst.o ]
|
||||
|
||||
file delete objfmtst.o
|
||||
|
||||
if ![ regexp "file format (.*)arch" $output dummy objformat ] {
|
||||
verbose "Could not parse objdump output" 2
|
||||
set gcc_target_object_format_saved unknown
|
||||
} else {
|
||||
switch -regexp $objformat {
|
||||
elf {
|
||||
set gcc_target_object_format_saved elf
|
||||
}
|
||||
ecoff {
|
||||
set gcc_target_object_format_saved ecoff
|
||||
}
|
||||
coff {
|
||||
set gcc_target_object_format_saved coff
|
||||
}
|
||||
a\.out {
|
||||
set gcc_target_object_format_saved a.out
|
||||
}
|
||||
pe {
|
||||
set gcc_target_object_format_saved pe
|
||||
}
|
||||
default {
|
||||
verbose "Unknown file format: $objformat" 3
|
||||
set gcc_target_object_format_saved unknown
|
||||
}
|
||||
}
|
||||
|
||||
verbose "gcc_target_object_format returning $gcc_target_object_format_saved" 2
|
||||
}
|
||||
}
|
||||
|
||||
return $gcc_target_object_format_saved
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997, 1999 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
|
||||
@ -20,6 +20,7 @@
|
||||
# Define gcc callbacks for dg.exp.
|
||||
|
||||
load_lib dg.exp
|
||||
load_lib file-format.exp
|
||||
|
||||
proc gcc-dg-test { prog do_what extra_tool_flags } {
|
||||
# Set up the compiler flags, based on what we're going to do.
|
||||
|
Loading…
Reference in New Issue
Block a user