ctypes-commit Mailing List for ctypes (Page 51)
Brought to you by:
theller
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(90) |
Jun
(143) |
Jul
(106) |
Aug
(94) |
Sep
(84) |
Oct
(163) |
Nov
(60) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(128) |
Feb
(79) |
Mar
(227) |
Apr
(192) |
May
(179) |
Jun
(41) |
Jul
(53) |
Aug
(103) |
Sep
(28) |
Oct
(38) |
Nov
(81) |
Dec
(17) |
2006 |
Jan
(184) |
Feb
(111) |
Mar
(188) |
Apr
(67) |
May
(58) |
Jun
(123) |
Jul
(73) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Andreas D. <ad...@us...> - 2005-05-14 11:20:36
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sparc/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7261/gcc/libffi/src/sparc/CVS.gcc Added Files: Root Repository Entries Log Message: update from gcc cvs --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/src/sparc --- NEW FILE: Entries --- /ffi.c/1.9/Mon Nov 22 18:35:16 2004/-ko/ /ffitarget.h/1.1/Tue Oct 21 19:07:52 2003// /v8.S/1.12/Mon Nov 22 18:35:16 2004/-ko/ /v9.S/1.9/Sun Jan 25 06:58:33 2004// D |
Update of /cvsroot/ctypes/ctypes/source/gcc/gcc/testsuite/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5744/gcc/gcc/testsuite/lib Added Files: wrapper.exp treelang.exp treelang-dg.exp target-supports.exp target-supports-dg.exp target-libpath.exp scantree.exp scanasm.exp prune.exp profopt.exp objc.exp objc-torture.exp objc-dg.exp mike-gcc.exp mike-g++.exp gfortran.exp gfortran-dg.exp gcov.exp gcc.exp gcc-dg.exp gcc-defs.exp g++.exp g++-dg.exp fortran-torture.exp file-format.exp dg-pch.exp copy-file.exp compat.exp c-torture.exp Log Message: update from gcc cvs --- NEW FILE: gcc-defs.exp --- # Copyright (C) 2001, 2003, 2004 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. load_lib wrapper.exp # # ${tool}_check_compile -- Reports and returns pass/fail for a compilation # proc ${tool}_check_compile {testcase option objname gcc_output} { global tool set fatal_signal "*cc: Internal compiler error: program*got fatal signal" if [string match "$fatal_signal 6" $gcc_output] then { ${tool}_fail $testcase "Got Signal 6, $option" return 0 } if [string match "$fatal_signal 11" $gcc_output] then { ${tool}_fail $testcase "Got Signal 11, $option" return 0 } # We shouldn't get these because of -w, but just in case. if [string match "*cc:*warning:*" $gcc_output] then { warning "$testcase: (with warnings) $option" send_log "$gcc_output\n" unresolved "$testcase, $option" return 0 } set gcc_output [prune_warnings $gcc_output] set unsupported_message [${tool}_check_unsupported_p $gcc_output] if { $unsupported_message != "" } { unsupported "$testcase: $unsupported_message" return 0 } # remove any leftover LF/CR to make sure any output is legit regsub -all -- "\[\r\n\]*" $gcc_output "" gcc_output # If any message remains, we fail. if ![string match "" $gcc_output] then { ${tool}_fail $testcase $option return 0 } # fail if the desired object file doesn't exist. # FIXME: there's no way of checking for existence on a remote host. if {$objname != "" && ![is3way] && ![file exists $objname]} { ${tool}_fail $testcase $option return 0 } ${tool}_pass $testcase $option return 1 } # # ${tool}_pass -- utility to record a testcase passed # proc ${tool}_pass { testcase cflags } { if { "$cflags" == "" } { pass "$testcase" } else { pass "$testcase, $cflags" } } # # ${tool}_fail -- utility to record a testcase failed # proc ${tool}_fail { testcase cflags } { if { "$cflags" == "" } { fail "$testcase" } else { fail "$testcase, $cflags" } } # # ${tool}_finish -- called at the end of every script that calls ${tool}_init # # Hide all quirks of the testing environment from the testsuites. Also # undo anything that ${tool}_init did that needs undoing. # proc ${tool}_finish { } { # The testing harness apparently requires this. global errorInfo if [info exists errorInfo] then { unset errorInfo } # Might as well reset these (keeps our caller from wondering whether # s/he has to or not). global prms_id bug_id set prms_id 0 set bug_id 0 } # # ${tool}_exit -- Does final cleanup when testing is complete # proc ${tool}_exit { } { global gluefile if [info exists gluefile] { file_on_build delete $gluefile unset gluefile } } # # ${tool}_check_unsupported_p -- Check the compiler(/assembler/linker) output # for text indicating that the testcase should be marked as "unsupported" # # Utility used by mike-gcc.exp and c-torture.exp. # When dealing with a large number of tests, it's difficult to weed out the # ones that are too big for a particular cpu (eg: 16 bit with a small amount # of memory). There are various ways to deal with this. Here's one. # Fortunately, all of the cases where this is likely to happen will be using # gld so we can tell what the error text will look like. # proc ${tool}_check_unsupported_p { output } { if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] { return "memory full" } return "" } # # runtest_file_p -- Provide a definition for older dejagnu releases # and assume the old syntax: foo1.exp bar1.c foo2.exp bar2.c. # (delete after next dejagnu release). # if { [info procs runtest_file_p] == "" } then { proc runtest_file_p { runtests testcase } { if { $runtests != "" && [regexp "\[.\]\[cC\]" $runtests] } then { if { [lsearch $runtests [file tail $testcase]] >= 0 } then { return 1 } else { return 0 } } return 1 } } # Record additional sources files that must be compiled along with the # main source file. set additional_sources "" proc dg-additional-sources { args } { global additional_sources set additional_sources [lindex $args 1] } # Record additional files -- other than source files -- that must be # present on the system where the compiler runs. set additional_files "" proc dg-additional-files { args } { global additional_files set additional_files [lindex $args 1] } # Return an updated version of OPTIONS that mentions any additional # source files registered with dg-additional-sources. SOURCE is the # name of the test case. proc dg-additional-files-options { options source } { global additional_sources global additional_files set to_download [list] if { $additional_sources != "" } then { if [is_remote host] { lappend options "additional_flags=$additional_sources" } regsub -all "^| " $additional_sources " [file dirname $source]/" additional_sources if ![is_remote host] { lappend options "additional_flags=$additional_sources" } set to_download [concat $to_download $additional_sources] set additional_sources "" } if { $additional_files != "" } then { regsub -all " " $additional_files " [file dirname $source]/" additional_files set to_download [concat $to_download $additional_files] set additional_files "" } if [is_remote host] { foreach file $to_download { remote_download host $file } } return $options } # Return a colon-separate list of directories to search for libraries # for COMPILER, including multilib directories. proc gcc-set-multilib-library-path { compiler } { global rootme # ??? rootme will not be set when testing an installed compiler. # In that case, we should perhaps use some other method to find # libraries. if {![info exists rootme]} { return "" } set libpath ":${rootme}" set compiler [lindex $compiler 0] if { [is_remote host] == 0 && [which $compiler] != 0 } { foreach i "[exec $compiler --print-multi-lib]" { set mldir "" regexp -- "\[a-z0-9=/\.-\]*;" $i mldir set mldir [string trimright $mldir "\;@"] if { "$mldir" == "." } { continue } if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } { append libpath ":${rootme}/${mldir}" } } } return $libpath } --- NEW FILE: prune.exp --- # Copyright (C) 1997, 1999, 2000, 2002, 2004 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. # Prune messages from gcc that aren't useful. proc prune_gcc_output { text } { #send_user "Before:$text\n" regsub -all "(^|\n)\[^\n\]*: In ((static member )?function|member|method|(copy )?constructor|destructor|instantiation|program|subroutine|block-data) \[^\n\]*" $text "" text regsub -all "(^|\n)\[^\n\]*: At (top level|global scope):\[^\n\]*" $text "" text regsub -all "(^|\n)\[^\n\]*: instantiated from \[^\n\]*" $text "" text regsub -all "(^|\n)collect2: ld returned \[^\n\]*" $text "" text regsub -all "(^|\n)collect: re(compiling|linking)\[^\n\]*" $text "" text regsub -all "(^|\n)Please submit.*instructions\[^\n\]*" $text "" text regsub -all "(^|\n)\[0-9\]\[0-9\]* errors\." $text "" text # Ignore harmless -fpic warnings. regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC) ignored for target\[^\n\]*" $text "" text regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC)( and -fpic are| is)? not supported\[^\n\]*" $text "" text # Ignore errata warning from IA64 assembler. regsub -all "(^|\n)\[^\n\]*: Additional NOP may be necessary to workaround Itanium processor A/B step errata" $text "" text regsub -all "(^|\n)\[^\n*\]*: Assembler messages:\[^\n\]*" $text "" text # It would be nice to avoid passing anything to gcc that would cause it to # issue these messages (since ignoring them seems like a hack on our part), # but that's too difficult in the general case. For example, sometimes # you need to use -B to point gcc at crt0.o, but there are some targets # that don't have crt0.o. regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text #send_user "After:$text\n" return $text } # Provide a definition of this if missing (delete after next dejagnu release). if { [info procs prune_warnings] == "" } then { proc prune_warnings { text } { return $text } } --- NEW FILE: objc-torture.exp --- # Copyright (C) 1992-1998, 1999, 2000 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # This file was written by Rob Savoye. (ro...@cy...) load_lib file-format.exp # The default option list can be overridden by # TORTURE_OPTIONS="{ { list1 } ... { listN } }" if ![info exists TORTURE_OPTIONS] { # It is theoretically beneficial to group all of the O2/O3 options together, # as in many cases the compiler will generate identical executables for # all of them--and the objc-torture testsuite will skip testing identical # executables multiple times. # Also note that -finline-functions is explicitly included in one of the # items below, even though -O3 is also specified, because some ports may # choose to disable inlining functions by default, even when optimizing. set TORTURE_OPTIONS [list \ { -O0 } \ { -O1 } \ { -O2 } \ { -O3 -fomit-frame-pointer } \ { -O3 -fomit-frame-pointer -funroll-loops } \ { -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \ { -O3 -g } \ { -Os } ] } # Split TORTURE_OPTIONS into two choices: one for testcases with loops and # one for testcases without loops. set torture_with_loops $TORTURE_OPTIONS set torture_without_loops "" foreach option $TORTURE_OPTIONS { if ![string match "*loop*" $option] { lappend torture_without_loops $option } } # # objc-torture-compile -- runs the Tege OBJC-torture test # # SRC is the full pathname of the testcase. # OPTION is the specific compiler flag we're testing (eg: -O2). # proc objc-torture-compile { src option } { global output global srcdir tmpdir global host_triplet set output "$tmpdir/[file tail [file rootname $src]].o" regsub "^$srcdir/?" $src "" testcase # If we couldn't rip $srcdir out of `src' then just do the best we can. # The point is to reduce the unnecessary noise in the logs. Don't strip # out too much because different testcases with the same name can confuse # `test-tool'. if [string match "/*" $testcase] { set testcase "[file tail [file dirname $src]]/[file tail $src]" } verbose "Testing $testcase, $option" 1 # Run the compiler and analyze the results. set options "" lappend options "additional_flags=-w $option" set comp_output [objc_target_compile "$src" "$output" object $options] objc_check_compile $testcase $option $output $comp_output remote_file build delete $output } # # objc-torture-execute -- utility to compile and execute a testcase # # SRC is the full pathname of the testcase. # # If the testcase has an associated .x file, we source that to run the # test instead. We use .x so that we don't lengthen the existing filename # to more than 14 chars. # proc objc-torture-execute { src args } { global tmpdir tool srcdir output compiler_conditional_xfail_data if { [llength $args] > 0 } { set additional_flags [lindex $args 0] } else { set additional_flags "" } # Check for alternate driver. if [file exists [file rootname $src].x] { verbose "Using alternate driver [file rootname [file tail $src]].x" 2 set done_p 0 catch "set done_p \[source [file rootname $src].x\]" if { $done_p } { return } } # Look for a loop within the source code - if we don't find one, # don't pass -funroll[-all]-loops. global torture_with_loops torture_without_loops if [expr [search_for $src "for*("]+[search_for $src "while*("]] then { set option_list $torture_with_loops } else { set option_list $torture_without_loops } set executable $tmpdir/[file tail [file rootname $src].x] regsub "^$srcdir/?" $src "" testcase # If we couldn't rip $srcdir out of `src' then just do the best we can. # The point is to reduce the unnecessary noise in the logs. Don't strip # out too much because different testcases with the same name can confuse # `test-tool'. if [string match "/*" $testcase] { set testcase "[file tail [file dirname $src]]/[file tail $src]" } set count 0 set oldstatus "foo" foreach option $option_list { if { $count > 0 } { set oldexec $execname } set execname "${executable}${count}" incr count # torture_{compile,execute}_xfail are set by the .x script # (if present) if [info exists torture_compile_xfail] { setup_xfail $torture_compile_xfail } # torture_execute_before_{compile,execute} can be set by the .x script # (if present) if [info exists torture_eval_before_compile] { set ignore_me [eval $torture_eval_before_compile] } remote_file build delete $execname verbose "Testing $testcase, $option" 1 set options "" lappend options "additional_flags=-w $option" if { $additional_flags != "" } { lappend options "additional_flags=$additional_flags" } set comp_output [objc_target_compile "$src" "${execname}" executable $options] if ![objc_check_compile "$testcase compilation" $option $execname $comp_output] { unresolved "$testcase execution, $option" remote_file build delete $execname continue } # See if this source file uses "long long" types, if it does, and # no_long_long is set, skip execution of the test. if [target_info exists no_long_long] then { if [expr [search_for $src "long long"]] then { unsupported "$testcase execution, $option" continue } } if [info exists torture_execute_xfail] { setup_xfail $torture_execute_xfail } if [info exists torture_eval_before_execute] { set ignore_me [eval $torture_eval_before_execute] } # Sometimes we end up creating identical executables for two # consecutive sets of different of compiler options. # # In such cases we know the result of this test will be identical # to the result of the last test. # # So in cases where the time to load and run/simulate the test # is relatively high, compare the two binaries and avoid rerunning # tests if the executables are identical. # # Do not do this for native testing since the cost to load/execute # the test is fairly small and the comparison step actually slows # the entire process down because it usually does not "hit". set skip 0 if { ![isnative] && [info exists oldexec] } { if { [remote_file build cmp $oldexec $execname] == 0 } { set skip 1 } } if { $skip == 0 } { set result [objc_load "$execname" "" ""] set status [lindex $result 0] set output [lindex $result 1] } if { $oldstatus == "pass" } { remote_file build delete $oldexec } $status "$testcase execution, $option" set oldstatus $status } if [info exists status] { if { $status == "pass" } { remote_file build delete $execname } } } # # search_for -- looks for a string match in a file # proc search_for { file pattern } { set fd [open $file r] while { [gets $fd cur_line]>=0 } { if [string match "*$pattern*" $cur_line] then { close $fd return 1 } } close $fd return 0 } # # objc-torture -- the objc-torture testcase source file processor # # This runs compilation only tests (no execute tests). # SRC is the full pathname of the testcase, or just a file name in which case # we prepend $srcdir/$subdir. # # If the testcase has an associated .x file, we source that to run the # test instead. We use .x so that we don't lengthen the existing filename # to more than 14 chars. # proc objc-torture { args } { global srcdir subdir compiler_conditional_xfail_data set src [lindex $args 0] if { [llength $args] > 1 } { set options [lindex $args 1] } else { set options "" } # Prepend $srdir/$subdir if missing. if ![string match "*/*" $src] { set src "$srcdir/$subdir/$src" } # Check for alternate driver. if [file exists [file rootname $src].x] { verbose "Using alternate driver [file rootname [file tail $src]].x" 2 set done_p 0 catch "set done_p \[source [file rootname $src].x\]" if { $done_p } { return } } # Look for a loop within the source code - if we don't find one, # don't pass -funroll[-all]-loops. global torture_with_loops torture_without_loops if [expr [search_for $src "for*("]+[search_for $src "while*("]] then { set option_list $torture_with_loops } else { set option_list $torture_without_loops } # loop through all the options foreach option $option_list { # torture_compile_xfail is set by the .x script (if present) if [info exists torture_compile_xfail] { setup_xfail $torture_compile_xfail } # torture_execute_before_compile is set by the .x script (if present) if [info exists torture_eval_before_compile] { set ignore_me [eval $torture_eval_before_compile] } objc-torture-compile $src "$option $options" } } --- NEW FILE: scantree.exp --- # Copyright (C) 2000, 2002, 2003 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. # Various utilities for scanning tree dump output, used by gcc-dg.exp and # g++-dg.exp. # # This is largely borrowed from scanasm.exp. # Utility for scanning compiler result, invoked via dg-final. # Call pass if pattern is present, otherwise fail. # # Argument 0 is the regexp to match. # Argument 1 is the suffix for the tree dump file # Argument 2 handles expected failures and the like proc scan-tree-dump { args } { if { [llength $args] < 2 } { error "scan-tree-dump: too few arguments" return } if { [llength $args] > 3 } { error "scan-tree-dump: too many arguments" return } if { [llength $args] >= 3 } { switch [dg-process-target [lindex $args 2]] { "S" { } "N" { return } "F" { setup_xfail "*-*-*" } "P" { } } } # This assumes that we are two frames down from dg-test, and that # it still stores the filename of the testcase in a local variable "name". # A cleaner solution would require a new dejagnu release. upvar 2 name testcase # This must match the rule in gcc-dg.exp. set src [file tail [lindex $testcase 0]] set output_file "[glob $src.t??.[lindex $args 1]]" set fd [open $output_file r] set text [read $fd] close $fd if [regexp -- [lindex $args 0] $text] { pass "$testcase scan-tree-dump [lindex $args 0]" } else { fail "$testcase scan-tree-dump [lindex $args 0]" } } # Call pass if pattern is present given number of times, otherwise fail. # Argument 0 is the regexp to match. # Argument 1 is number of times the regexp must be found # Argument 2 is the suffix for the tree dump file # Argument 3 handles expected failures and the like proc scan-tree-dump-times { args } { if { [llength $args] < 3 } { error "scan-tree-dump: too few arguments" return } if { [llength $args] > 4 } { error "scan-tree-dump: too many arguments" return } if { [llength $args] >= 4 } { switch [dg-process-target [lindex $args 3]] { "S" { } "N" { return } "F" { setup_xfail "*-*-*" } "P" { } } } # This assumes that we are two frames down from dg-test, and that # it still stores the filename of the testcase in a local variable "name". # A cleaner solution would require a new dejagnu release. upvar 2 name testcase # This must match the rule in gcc-dg.exp. set src [file tail [lindex $testcase 0]] set output_file "[glob $src.t??.[lindex $args 2]]" set fd [open $output_file r] set text [read $fd] close $fd if { [llength [regexp -inline -all -- [lindex $args 0] $text]] == [lindex $args 1]} { pass "$testcase scan-tree-dump-times [lindex $args 0] [lindex $args 1]" } else { fail "$testcase scan-tree-dump-times [lindex $args 0] [lindex $args 1]" } } # Call pass if pattern is not present, otherwise fail. # # Argument 0 is the regexp to match. # Argument 1 is the suffix for the tree dump file # Argument 2 handles expected failures and the like proc scan-tree-dump-not { args } { if { [llength $args] < 2 } { error "scan-tree-dump-not: too few arguments" return } if { [llength $args] > 3 } { error "scan-tree-dump-not: too many arguments" return } if { [llength $args] >= 3 } { switch [dg-process-target [lindex $args 2]] { "S" { } "N" { return } "F" { setup_xfail "*-*-*" } "P" { } } } upvar 2 name testcase set src [file tail [lindex $testcase 0]] set output_file "[glob $src.t??.[lindex $args 1]]" set fd [open $output_file r] set text [read $fd] close $fd if ![regexp -- [lindex $args 0] $text] { pass "$testcase scan-tree-dump-not [lindex $args 0]" } else { fail "$testcase scan-tree-dump-not [lindex $args 0]" } } # Utility for scanning demangled compiler result, invoked via dg-final. # Call pass if pattern is present, otherwise fail. # # Argument 0 is the regexp to match. # Argument 1 is the suffix for the tree dump file # Argument 2 handles expected failures and the like proc scan-tree-dump-dem { args } { global cxxfilt global base_dir if { [llength $args] < 2 } { error "scan-tree-dump-dem: too few arguments" return } if { [llength $args] > 3 } { error "scan-tree-dump-dem: too many arguments" return } if { [llength $args] >= 3 } { switch [dg-process-target [lindex $args 2]] { "S" { } "N" { return } "F" { setup_xfail "*-*-*" } "P" { } } } # Find c++filt like we find g++ in g++.exp. if ![info exists cxxfilt] { set cxxfilt [findfile $base_dir/../../binutils/cxxfilt \ $base_dir/../../binutils/cxxfilt \ [findfile $base_dir/../c++filt $base_dir/../c++filt \ [findfile $base_dir/c++filt $base_dir/c++filt \ [transform c++filt]]]] verbose -log "c++filt is $cxxfilt" } upvar 2 name testcase set src [file tail [lindex $testcase 0]] set output_file "[glob $src.t??.[lindex $args 1]]" set fd [open "| $cxxfilt < $output_file" r] set text [read $fd] close $fd if [regexp -- [lindex $args 0] $text] { pass "$testcase scan-tree-dump-dem [lindex $args 0]" } else { fail "$testcase scan-tree-dump-dem [lindex $args 0]" } } # Call pass if demangled pattern is not present, otherwise fail. # # Argument 0 is the regexp to match. # Argument 1 is the suffix for the tree dump file # Argument 2 handles expected failures and the like proc scan-tree-dump-dem-not { args } { global cxxfilt global base_dir if { [llength $args] < 2 } { error "scan-tree-dump-dem-not: too few arguments" return } if { [llength $args] > 3 } { error "scan-tree-dump-dem-not: too many arguments" return } if { [llength $args] >= 3 } { switch [dg-process-target [lindex $args 2]] { "S" { } "N" { return } "F" { setup_xfail "*-*-*" } "P" { } } } # Find c++filt like we find g++ in g++.exp. if ![info exists cxxfilt] { set cxxfilt [findfile $base_dir/../../binutils/cxxfilt \ $base_dir/../../binutils/cxxfilt \ [findfile $base_dir/../c++filt $base_dir/../c++filt \ [findfile $base_dir/c++filt $base_dir/c++filt \ [transform c++filt]]]] verbose -log "c++filt is $cxxfilt" } upvar 2 name testcase set src [file tail [lindex $testcase 0]] set output_file "[glob $src.t??.[lindex $args 1]]" set fd [open "| $cxxfilt < $output_file" r] set text [read $fd] close $fd if ![regexp -- [lindex $args 0] $text] { pass "$testcase scan-tree-dump-dem-not [lindex $args 0]" } else { fail "$testcase scan-tree-dump-dem-not [lindex $args 0]" } } --- NEW FILE: gcc.exp --- # Copyright (C) 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2003, 2004 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # This file was written by Rob Savoye (ro...@cy...) # Currently maintained by Doug Evans (dj...@cy...) # This file is loaded by the tool init file (eg: unix.exp). It provides # default definitions for gcc_start, etc. and other supporting cast members. # These globals are used by gcc_start if no compiler arguments are provided. # They are also used by the various testsuites to define the environment: # where to find stdio.h, libc.a, etc. # we want to use libgloss so we can get find_gcc. load_lib libgloss.exp load_lib prune.exp load_lib gcc-defs.exp # # GCC_UNDER_TEST is the compiler under test. # # # default_gcc_version -- extract and print the version number of the compiler # proc default_gcc_version { } { global GCC_UNDER_TEST gcc_init # ignore any arguments after the command set compiler [lindex $GCC_UNDER_TEST 0] if ![is_remote host] { set compiler_name [which $compiler] } else { set compiler_name $compiler } # verify that the compiler exists if { $compiler_name != 0 } then { set tmp [remote_exec host "$compiler -v"] set status [lindex $tmp 0] set output [lindex $tmp 1] regexp " version \[^\n\r\]*" $output version if { $status == 0 && [info exists version] } then { clone_output "$compiler_name $version\n" } else { clone_output "Couldn't determine version of $compiler_name: $output\n" } } else { # compiler does not exist (this should have already been detected) warning "$compiler does not exist" } } # # gcc_version -- Call default_gcc_version, so we can override it if needed. # proc gcc_version { } { default_gcc_version } # # gcc_init -- called at the start of each .exp script. # # There currently isn't much to do, but always using it allows us to # make some enhancements without having to go back and rewrite the scripts. # set gcc_initialized 0 proc gcc_init { args } { global tmpdir global libdir global gluefile wrap_flags global gcc_initialized global GCC_UNDER_TEST global TOOL_EXECUTABLE if { $gcc_initialized == 1 } { return; } if ![info exists GCC_UNDER_TEST] { if [info exists TOOL_EXECUTABLE] { set GCC_UNDER_TEST $TOOL_EXECUTABLE } else { set GCC_UNDER_TEST "[find_gcc]" } } if ![info exists tmpdir] then { set tmpdir /tmp } gcc_maybe_build_wrapper "${tmpdir}/gcc-testglue.o" } # # gcc_target_compile -- compile a source file # proc gcc_target_compile { source dest type options } { global tmpdir global gluefile wrap_flags global GCC_UNDER_TEST global TOOL_OPTIONS if {[target_info needs_status_wrapper] != "" && \ [target_info needs_status_wrapper] != "0" && \ [info exists gluefile] } { lappend options "libs=${gluefile}" lappend options "ldflags=$wrap_flags" } if [target_info exists gcc,stack_size] { lappend options "additional_flags=-DSTACK_SIZE=[target_info gcc,stack_size]" } if [target_info exists gcc,no_trampolines] { lappend options "additional_flags=-DNO_TRAMPOLINES" } if [target_info exists gcc,no_label_values] { lappend options "additional_flags=-DNO_LABEL_VALUES" } # TOOL_OPTIONS must come first, so that it doesn't override testcase # specific options. if [info exists TOOL_OPTIONS] { set options [concat "{additional_flags=$TOOL_OPTIONS}" $options] } if [target_info exists gcc,timeout] { lappend options "timeout=[target_info gcc,timeout]" } lappend options "additional_flags=-fno-show-column" lappend options "compiler=$GCC_UNDER_TEST" set options [dg-additional-files-options $options $source] return [target_compile $source $dest $type $options] } --- NEW FILE: gfortran-dg.exp --- # Copyright (C) 2004, 2005 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. load_lib gcc-dg.exp # Define gfortran callbacks for dg.exp. proc gfortran-dg-test { prog do_what extra_tool_flags } { set result \ [gcc-dg-test-1 gfortran_target_compile $prog $do_what $extra_tool_flags] set comp_output [lindex $result 0] set output_file [lindex $result 1] # gfortran error messages look like this: # In file [name]:[line] # # some code # 1 # Error: Some error at (1) and (2) # or # In file [name]:[line] # # some code # 1 # In file [name]:[line2] # # some other code # 2 # Error: Some error at (1) and (2) # or # In file [name]:[line] # # some code and some more code # 1 2 # Error: Some error at (1) and (2) # # We collapse these to look like: # [name]:[line]: Error: Some error at (1) and (2) # or # [name]:[line]: Error: Some error at (1) and (2) # [name]:[line2]: Error: Some error at (1) and (2) # We proceed in two steps: first we deal with the form with two # different locus lines, then with the form with only one locus line. # # Note that these regexps only make sense in the combinations used below. # Note also that is imperative that we first deal with the form with # two loci. set locus_regexp " In file (\[^\n\]*)\n\n\[^\n\]*\n\[^\n\]*\n" set diag_regexp "(\[^\n\]*)\n" set two_loci "$locus_regexp$locus_regexp$diag_regexp" set single_locus "$locus_regexp$diag_regexp" regsub -all $two_loci $comp_output "\\1: \\3\n\\2: \\3\n" comp_output regsub -all $single_locus $comp_output "\\1: \\2\n" comp_output return [list $comp_output $output_file] } proc gfortran-dg-prune { system text } { return [gcc-dg-prune $system $text] } # Utility routines. # Modified dg-runtest that can cycle through a list of optimization options # as c-torture does. proc gfortran-dg-runtest { testcases default-extra-flags } { global runtests global TORTURE_OPTIONS foreach test $testcases { # If we're only testing specific files and this isn't one of # them, skip it. if ![runtest_file_p $runtests $test] { continue } # look if this is dg-do-run test, in which case # we cycle through the option list, otherwise we don't if [expr [search_for $test "dg-do run"]] { set option_list $TORTURE_OPTIONS } else { set option_list [list { -O } ] } set nshort [file tail [file dirname $test]]/[file tail $test] foreach flags $option_list { verbose "Testing $nshort, $flags" 1 dg-test $test $flags ${default-extra-flags} } } } --- NEW FILE: gcov.exp --- # Copyright (C) 1997, 2001 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. # Verify various kinds of gcov output: line counts, branch percentages, # and call return percentages. None of this is language-specific. global GCOV # # clean-gcov -- delete the working files the compiler creates for gcov # # TESTCASE is the name of the test. # proc clean-gcov { testcase } { set basename [file tail $testcase] set base [file rootname $basename] remote_file host delete $base.gcno $base.gcda $basename.gcov } # # verify-lines -- check that line counts are as expected # # TESTCASE is the name of the test. # FILE is the name of the gcov output file. # proc verify-lines { testcase file } { #send_user "verify-lines\n" set failed 0 set fd [open $file r] while { [gets $fd line] >= 0 } { if [regexp "^ *(\[^:]*): *(\[0-9\]+):.*count\\((\[0-9\]+)\\)" \ "$line" all is n shouldbe] { if { $is == "" } { fail "$n:no data available for this line" incr failed } elseif { $is != $shouldbe } { fail "$n:is $is:should be $shouldbe" incr failed } } } return $failed } # # verify-branches -- check that branch percentages are as expected # # TESTCASE is the name of the test. # FILE is the name of the gcov output file. # # Checks are based on comments in the source file. This means to look for # branch percentages 10 or 90, 20 or 80, and # 70 or 30: # /* branch(10, 20, 70) */ # This means that all specified percentages should have been seen by now: # /* branch(end) */ # All specified percentages must also be seen by the next branch(n) or # by the end of the file. # # Each check depends on the compiler having generated the expected # branch instructions. Don't check for branches that might be # optimized away or replaced with predicated instructions. # proc verify-branches { testcase file } { #send_user "verify-branches\n" set failed 0 set shouldbe "" set fd [open $file r] set n 0 while { [gets $fd line] >= 0 } { regexp "^\[^:\]+: *(\[0-9\]+):" "$line" all n if [regexp "branch" $line] { verbose "Processing branch line $n: $line" 3 if [regexp "branch\\((\[0-9 \]+)\\)" "$line" all new_shouldbe] { # All percentages in the current list should have been seen. if {[llength $shouldbe] != 0} { fail "$n: expected branch percentages not found: $shouldbe" incr failed set shouldbe "" } set shouldbe $new_shouldbe #send_user "$n: looking for: $shouldbe\n" # Record the percentages to check for. Replace percentage # n > 50 with 100-n, since block ordering affects the # direction of a branch. for {set i 0} {$i < [llength $shouldbe]} {incr i} { set num [lindex $shouldbe $i] if {$num > 50} { set shouldbe [lreplace $shouldbe $i $i [expr 100 - $num]] } } } elseif [regexp "branch +\[0-9\]+ taken (-\[0-9\]+)%" "$line" \ all taken] { # Percentages should never be negative. fail "$n: negative percentage: $taken" incr failed } elseif [regexp "branch +\[0-9\]+ taken (\[0-9\]+)%" "$line" \ all taken] { #send_user "$n: taken = $taken\n" # Percentages should never be greater than 100. if {$taken > 100} { fail "$n: percentage greater than 100: $taken" incr failed } if {$taken > 50} { set taken [expr 100 - $taken] } # If this percentage is one to check for then remove it # from the list. It's normal to ignore some reports. set i [lsearch $shouldbe $taken] if {$i != -1} { set shouldbe [lreplace $shouldbe $i $i] } } elseif [regexp "branch\\(end\\)" "$line"] { # All percentages in the list should have been seen by now. if {[llength $shouldbe] != 0} { fail "$n: expected branch percentages not found: $shouldbe" incr failed } set shouldbe "" } } } # All percentages in the list should have been seen. if {[llength $shouldbe] != 0} { fail "$n: expected branch percentages not found: $shouldbe" incr failed } close $fd return $failed } # # verify-calls -- check that call return percentages are as expected # # TESTCASE is the name of the test. # FILE is the name of the gcov output file. # # Checks are based on comments in the source file. This means to look for # call return percentages 50, 20, 33: # /* returns(50, 20, 33) */ # This means that all specified percentages should have been seen by now: # /* returns(end) */ # All specified percentages must also be seen by the next returns(n) or # by the end of the file. # # Each check depends on the compiler having generated the expected # call instructions. Don't check for calls that are inserted by the # compiler or that might be inlined. # proc verify-calls { testcase file } { #send_user "verify-calls\n" set failed 0 set shouldbe "" set fd [open $file r] set n 0 while { [gets $fd line] >= 0 } { regexp "^\[^:\]+: *(\[0-9\]+):" "$line" all n if [regexp "return" $line] { verbose "Processing returns line $n: $line" 3 if [regexp "returns\\((\[0-9 \]+)\\)" "$line" all new_shouldbe] { # All percentages in the current list should have been seen. if {[llength $shouldbe] != 0} { fail "$n: expected return percentages not found: $shouldbe" incr failed set shouldbe "" } # Record the percentages to check for. set shouldbe $new_shouldbe } elseif [regexp "call +\[0-9\]+ returned (-\[0-9\]+)%" "$line" \ all returns] { # Percentages should never be negative. fail "$n: negative percentage: $returns" incr failed } elseif [regexp "call +\[0-9\]+ returned (\[0-9\]+)%" "$line" \ all returns] { # For branches we check that percentages are not greater than # 100 but call return percentages can be, as for setjmp(), so # don't count that as an error. # # If this percentage is one to check for then remove it # from the list. It's normal to ignore some reports. set i [lsearch $shouldbe $returns] if {$i != -1} { set shouldbe [lreplace $shouldbe $i $i] } } elseif [regexp "returns\\(end\\)" "$line"] { # All percentages in the list should have been seen by now. if {[llength $shouldbe] != 0} { fail "$n: expected return percentages not found: $shouldbe" incr failed } set shouldbe "" } } } # All percentages in the list should have been seen. if {[llength $shouldbe] != 0} { fail "$n: expected return percentages not found: $shouldbe" incr failed } close $fd return $failed } # Called by dg-final to run gcov and analyze the results. # # ARGS consists of the optional strings "branches" and/or "calls", # (indicating that these things should be verified) followed by a # list of arguments to provide to gcov, including the name of the # source file. proc run-gcov { args } { global GCOV global srcdir subdir set gcov_args [lindex $args end] set gcov_verify_calls 0 set gcov_verify_branches 0 set gcov_execute_xfail "" set gcov_verify_xfail "" foreach a $args { if { $a == "calls" } { set gcov_verify_calls 1 } elseif { $a == "branches" } { set gcov_verify_branches 1 } } # Extract the test name from the arguments. set testcase [lindex $gcov_args end] if { $gcov_execute_xfail != "" } { eval setup_xfail [split $gcov_execute_xfail] } verbose "Running $GCOV $testcase" 2 set testcase [remote_download host $testcase] set result [remote_exec host $GCOV $gcov_args] if { [lindex $result 0] != 0 } { fail "$subdir/$testcase gcov failed: [lindex $result 1]" clean-gcov $testcase return } # Get the gcov output file after making sure it exists. set files [glob -nocomplain $testcase.gcov] if { $files == "" } { fail "$subdir/$testcase gcov failed: $testcase.gcov does not exist" clean-gcov $testcase return } remote_upload host $testcase.gcov $testcase.gcov if { $gcov_verify_xfail != "" } { eval setup_xfail [split $gcov_verify_xfail] } # Check that line execution counts are as expected. set lfailed [verify-lines $testcase $testcase.gcov] # If requested via the .x file, check that branch and call information # is correct. if { $gcov_verify_branches } { set bfailed [verify-branches $testcase $testcase.gcov] } else { set bfailed 0 } if { $gcov_verify_calls } { set cfailed [verify-calls $testcase $testcase.gcov] } else { set cfailed 0 } # Report whether the gcov test passed or failed. If there were # multiple failures then the message is a summary. set tfailed [expr $lfailed + $bfailed + $cfailed] if { $tfailed > 0 } { fail "$subdir/$testcase gcov: $lfailed failures in line counts, $bfailed in branch percentages, $cfailed in return percentages" } else { pass "$subdir/$testcase gcov" clean-gcov $testcase } } --- NEW FILE: c-torture.exp --- # Copyright (C) 1992-1998, 1999, 2000 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # This file was written by Rob Savoye. (ro...@cy...) load_lib file-format.exp # The default option list can be overridden by # TORTURE_OPTIONS="{ { list1 } ... { listN } }" if ![info exists TORTURE_OPTIONS] { # It is theoretically beneficial to group all of the O2/O3 options together, # as in many cases the compiler will generate identical executables for # all of them--and the c-torture testsuite will skip testing identical # executables multiple times. # Also note that -finline-functions is explicitly included in one of the # items below, even though -O3 is also specified, because some ports may # choose to disable inlining functions by default, even when optimizing. set TORTURE_OPTIONS [list \ { -O0 } \ { -O1 } \ { -O2 } \ { -O3 -fomit-frame-pointer } \ { -O3 -fomit-frame-pointer -funroll-loops } \ { -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions } \ { -O3 -g } \ { -Os } ] } # Split TORTURE_OPTIONS into two choices: one for testcases with loops and # one for testcases without loops. set torture_with_loops $TORTURE_OPTIONS set torture_without_loops "" foreach option $TORTURE_OPTIONS { if ![string match "*loop*" $option] { lappend torture_without_loops $option } } # # c-torture-compile -- runs the Tege C-torture test # # SRC is the full pathname of the testcase. # OPTION is the specific compiler flag we're testing (eg: -O2). # proc c-torture-compile { src option } { global output global srcdir tmpdir global host_triplet set output "$tmpdir/[file tail [file rootname $src]].o" regsub "^$srcdir/?" $src "" testcase # If we couldn't rip $srcdir out of `src' then just do the best we can. # The point is to reduce the unnecessary noise in the logs. Don't strip # out too much because different testcases with the same name can confuse # `test-tool'. if [string match "/*" $testcase] { set testcase "[file tail [file dirname $src]]/[file tail $src]" } verbose "Testing $testcase, $option" 1 # Run the compiler and analyze the results. set options "" lappend options "additional_flags=-w $option" set comp_output [gcc_target_compile "$src" "$output" object $options] gcc_check_compile $testcase $option $output $comp_output remote_file build delete $output } # # c-torture-execute -- utility to compile and execute a testcase # # SOURCES is a list of full pathnames to the test source files. # The first filename in this list forms the "testcase". # # If the testcase has an associated .x file, we source that to run the # test instead. We use .x so that we don't lengthen the existing filename # to more than 14 chars. # proc c-torture-execute { sources args } { global tmpdir tool srcdir output compiler_conditional_xfail_data # Use the first source filename given as the filename under test. set src [lindex $sources 0] if { [llength $args] > 0 } { set additional_flags [lindex $args 0] } else { set additional_flags "" } # Check for alternate driver. if [file exists [file rootname $src].x] { verbose "Using alternate driver [file rootname [file tail $src]].x" 2 set done_p 0 catch "set done_p \[source [file rootname $src].x\]" if { $done_p } { return } } # Look for a loop within the source code - if we don't find one, # don't pass -funroll[-all]-loops. global torture_with_loops torture_without_loops if [expr [search_for $src "for*("]+[search_for $src "while*("]] then { set option_list $torture_with_loops } else { set option_list $torture_without_loops } set executable $tmpdir/[file tail [file rootname $src].x] regsub "^$srcdir/?" $src "" testcase # If we couldn't rip $srcdir out of `src' then just do the best we can. # The point is to reduce the unnecessary noise in the logs. Don't strip # out too much because different testcases with the same name can confuse # `test-tool'. if [string match "/*" $testcase] { set testcase "[file tail [file dirname $src]]/[file tail $src]" } set count 0 set oldstatus "foo" foreach option $option_list { if { $count > 0 } { set oldexec $execname } set execname "${executable}${count}" incr count # torture_{compile,execute}_xfail are set by the .x script # (if present) if [info exists torture_compile_xfail] { setup_xfail $torture_compile_xfail } # torture_execute_before_{compile,execute} can be set by the .x script # (if present) if [info exists torture_eval_before_compile] { set ignore_me [eval $torture_eval_before_compile] } remote_file build delete $execname verbose "Testing $testcase, $option" 1 set options "" lappend options "additional_flags=-w $option" if { $additional_flags != "" } { lappend options "additional_flags=$additional_flags" } set comp_output [gcc_target_compile "$sources" "${execname}" executable $options] if ![gcc_check_compile "$testcase compilation" $option $execname $comp_output] { unresolved "$testcase execution, $option" remote_file build delete $execname continue } # See if this source file uses "long long" types, if it does, and # no_long_long is set, skip execution of the test. if [target_info exists no_long_long] then { if [expr [search_for $src "long long"]] then { unsupported "$testcase execution, $option" continue } } if [info exists torture_execute_xfail] { setup_xfail $torture_execute_xfail } if [info exists torture_eval_before_execute] { set ignore_me [eval $torture_eval_before_execute] } # Sometimes we end up creating identical executables for two # consecutive sets of different of compiler options. # # In such cases we know the result of this test will be identical # to the result of the last test. # # So in cases where the time to load and run/simulate the test # is relatively high, compare the two binaries and avoid rerunning # tests if the executables are identical. # # Do not do this for native testing since the cost to load/execute # the test is fairly small and the comparison step actually slows # the entire process down because it usually does not "hit". set skip 0 if { ![isnative] && [info exists oldexec] } { if { [remote_file build cmp $oldexec $execname] == 0 } { set skip 1 } } if { $skip == 0 } { set result [gcc_load "$execname" "" ""] set status [lindex $result 0] set output [lindex $result 1] } if { $oldstatus == "pass" } { remote_file build delete $oldexec } $status "$testcase execution, $option" set oldstatus $status } if [info exists status] { if { $status == "pass" } { remote_file build delete $execname } } } # # search_for -- looks for a string match in a file # proc search_for { file pattern } { set fd [open $file r] while { [gets $fd cur_line]>=0 } { if [string match "*$pattern*" $cur_line] then { close $fd return 1 } } close $fd return 0 } # # c-torture -- the c-torture testcase source file processor # # This runs compilation only tests (no execute tests). # SRC is the full pathname of the testcase, or just a file name in which case # we prepend $srcdir/$subdir. # # If the testcase has an associated .x file, we source that to run the # test instead. We use .x so that we don't lengthen the existing filename # to more than 14 chars. # proc c-torture { args } { global srcdir subdir compiler_conditional_xfail_data set src [lindex $args 0] if { [llength $args] > 1 } { set options [lindex $args 1] } else { set options "" } # Prepend $srdir/$subdir if missing. if ![string match "*/*" $src] { set src "$srcdir/$subdir/$src" } # Check for alternate driver. if [file exists [file rootname $src].x] { verbose "Using alternate driver [file rootname [file tail $src]].x" 2 set done_p 0 catch "set done_p \[source [file rootname $src].x\]" if { $done_p } { return } } # Look for a loop within the source code - if we don't find one, # don't pass -funroll[-all]-loops. global torture_with_loops torture_without_loops if [expr [search_for $src "for*("]+[search_for $src "while*("]] then { set option_list $torture_with_loops } else { set option_list $torture_without_loops } # loop through all the options foreach option $option_list { # torture_compile_xfail is set by the .x script (if present) if [info exists torture_compile_xfail] { setup_xfail $torture_compile_xfail } # torture_execute_before_compile is set by the .x script (if present) if [info exists torture_eval_before_compile] { set ignore_me [eval $torture_eval_before_compile] } c-torture-compile $src "$option $options" } } --- NEW FILE: wrapper.exp --- # Copyright (C) 2004 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. # This file contains GCC-specifics for status wrappers for test programs. # ${tool}_maybe_build_wrapper -- Build wrapper object if the target needs it. proc ${tool}_maybe_build_wrapper { filename } { global gluefile wrap_flags if { [target_info needs_status_wrapper] != "" \ && [target_info needs_status_wrapper] != "0" \ && ![info exists gluefile] } { set saved_wrap_compile_flags [target_info wrap_compile_flags] # The wrapper code may contain code that gcc objects on. This # became true for dejagnu-1.4.4. The set of warnings and code # that gcc objects on may change, so just make sure -w is always # passed to turn off all warnings. set_currtarget_info wrap_compile_flags "$saved_wrap_compile_flags -w" set result [build_wrapper $filename] set_currtarget_info wrap_compile_flags "$saved_wrap_compile_flags" if { $result != "" } { set gluefile [lindex $result 0] set wrap_flags [lindex $result 1] } } } --- NEW FILE: gfortran.exp --- # Copyright (C) 2003, 2004 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # This file is just 'sed -e 's/77/fortran/g' \ # -e 's/f2c/gfortran' g77.exp > gfortran.exp' # # with some minor modifications to make it work. # # gfortran support library routines # load_lib prune.exp load_lib gcc-defs.exp load_lib target-libpath.exp # # GFORTRAN_UNDER_TEST is the compiler under test. # set gpp_compile_options "" # # gfortran_version -- extract and print the version number of the compiler # proc gfortran_version { } { global GFORTRAN_UNDER_TEST gfortran_init # ignore any arguments after the command set compiler [lindex $GFORTRAN_UNDER_TEST 0] # verify that the compiler exists if { [is_remote host] || [which $compiler] != 0 } then { set tmp [remote_exec host "$compiler -v"] set status [lindex $tmp 0] set output [lindex $tmp 1] regexp " version \[^\n\r\]*" $output version if { $status == 0 && [info exists version] } then { if [is_remote host] { clone_output "$compiler $version\n" } else { clone_output "[which $compiler] $version\n" } } else { clone_output "Couldn't determine version of [which $compiler]\n" } } else { # compiler does not exist (this should have already been detected) warning "$compiler does not exist" } } # # gfortran_link_flags -- provide new version of gfortran_link_flags # (originally from libgloss.exp) which knows about the gcc tree structure # proc gfortran_link_flags { paths } { global srcdir global ld_library_path global GFORTRAN_UNDER_TEST set gccpath ${paths} set libio_dir "" set flags "" set ld_library_path "." if { $gccpath != "" } { if [file exists "${gccpath}/libgfortran/.libs/libgfortran.a"] { append flags "-L${gccpath}/libgfortran/.libs " append ld_library_path ":${gccpath}/libgfortran/.libs" } if [file exists "${gccpath}/libgfortran/libgforbegin.a"] { append flags "-L${gccpath}/libgfortran " } if [file exists "${gccpath}/libiberty/libiberty.a"] { append flags "-L${gccpath}/libiberty " } append ld_library_path \ [gcc-set-multilib-library-path $GFORTRAN_UNDER_TEST] } set_ld_library_path_env_vars return "$flags" } # # gfortran_init -- called at the start of each subdir of tests # proc gfortran_init { args } { global subdir global gpp_initialized global base_dir global tmpdir global libdir global gluefile wrap_flags global objdir srcdir global ALWAYS_GFORTRANFLAGS global TOOL_EXECUTABLE TOOL_OPTIONS global GFORTRAN_UNDER_TEST global TESTING_IN_BUILD_TREE # We set LC_ALL and LANG to C so that we get the same error messages as expected. setenv LC_ALL C setenv LANG C if ![info exists GFORTRAN_UNDER_TEST] then { if [info exists TOOL_EXECUTABLE] { set GFORTRAN_UNDER_TEST $TOOL_EXECUTABLE } else { if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } { set GFORTRAN_UNDER_TEST [transform gfortran] } else { set GFORTRAN_UNDER_TEST [findfile $base_dir/../gfortran "$base_dir/../gfortran -B$base_dir/../" [findfile $base_dir/gfortran "$base_dir/gfortran -B$base_dir/" [transform gfortran]]] } } } if ![is_remote host] { if { [which $GFORTRAN_UNDER_TEST] == 0 } then { perror "GFORTRAN_UNDER_TEST ($GFORTRAN_UNDER_TEST) does not exist" exit 1 } } if ![info exists tmpdir] { set tmpdir "/tmp" } if [info exists gluefile] { unset gluefile } gfortran_maybe_build_wrapper "${tmpdir}/gfortran-testglue.o" set ALWAYS_GFORTRANFLAGS ... [truncated message content] |
From: Andreas D. <ad...@us...> - 2005-05-14 11:17:38
|
Update of /cvsroot/ctypes/ctypes/source/gcc/gcc/testsuite/lib/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5744/gcc/gcc/testsuite/lib/CVS.gcc Added Files: Root Repository Entries Log Message: update from gcc cvs --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/gcc/testsuite/lib --- NEW FILE: Entries --- /c-torture.exp/1.19/Tue Mar 8 22:10:33 2005// /compat.exp/1.12/Tue Nov 30 21:37:14 2004// /copy-file.exp/1.1/Sat Jun 7 14:55:56 2003// /dg-pch.exp/1.4/Wed Aug 20 04:04:47 2003// /file-format.exp/1.9/Thu Mar 31 18:38:27 2005// /fortran-torture.exp/1.8/Thu Apr 28 23:58:30 2005// /g++-dg.exp/1.11/Thu Jun 5 22:18:54 2003// /g++.exp/1.46/Sat Mar 26 01:50:32 2005// /gcc-defs.exp/1.5/Sat Mar 26 01:50:32 2005// /gcc-dg.exp/1.53/Thu Mar 31 18:11:14 2005// /gcc.exp/1.18/Tue Apr 5 22:50:40 2005// /gcov.exp/1.6/Tue Mar 8 22:10:34 2005// /gfortran-dg.exp/1.5/Mon Feb 21 16:31:42 2005// /gfortran.exp/1.11/Sat Mar 26 01:50:32 2005// /mike-g++.exp/1.5/Tue Mar 8 22:10:34 2005// /mike-gcc.exp/1.5/Tue Mar 8 22:10:34 2005// /objc-dg.exp/1.3/Fri May 16 20:53:04 2003// /objc-torture.exp/1.8/Tue Mar 8 22:10:34 2005// /objc.exp/1.32/Sat Mar 26 01:50:32 2005// /profopt.exp/1.7/Thu Mar 31 18:36:30 2005// /prune.exp/1.12/Fri Apr 9 22:24:29 2004// /scantree.exp/1.3/Thu Mar 31 00:28:49 2005// /target-libpath.exp/1.4/Tue Mar 8 22:10:34 2005// /treelang-dg.exp/1.1/Tue Jan 20 01:57:57 2004// /treelang.exp/1.11/Sat Mar 26 01:50:32 2005// /wrapper.exp/1.3/Tue Apr 12 06:26:39 2005// /scanasm.exp/1.16/Fri May 13 21:49:23 2005// /target-supports-dg.exp/1.3/Fri May 13 21:49:23 2005// /target-supports.exp/1.56/Fri May 13 21:49:23 2005// D |
From: Andreas D. <ad...@us...> - 2005-05-14 11:16:17
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/x86/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5474/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/x86/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:16:05
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sparc/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5413/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sparc/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:15:53
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sh64/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5382/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sh64/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:15:41
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sh/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5329/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sh/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:15:30
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/s390/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5291/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/s390/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:15:20
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5180/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:14:58
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/pa/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5106/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/pa/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:14:46
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/mips/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5016/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/mips/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:14:25
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/m68k/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4942/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/m68k/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:14:13
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/ia64/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4897/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/ia64/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:14:02
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/arm/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4858/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/arm/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:13:50
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/alpha/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4785/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/alpha/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:58
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/cris In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/src/cris Added Files: sysv.S ffitarget.h ffi.c Log Message: update from gcc cvs --- NEW FILE: sysv.S --- /* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2004 Simon Posnjak Copyright (c) 2005 Axis Communications AB CRIS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include <ffi.h> #define CONCAT(x,y) x ## y #define XCONCAT(x,y) CONCAT (x, y) #define L(x) XCONCAT (__USER_LABEL_PREFIX__, x) .text ;; OK, when we get called we should have this (according to ;; AXIS ETRAX 100LX Programmer's Manual chapter 6.3). ;; ;; R10: ffi_prep_args (func. pointer) ;; R11: &ecif ;; R12: cif->bytes ;; R13: fig->flags ;; sp+0: ecif.rvalue ;; sp+4: fn (function pointer to the function that we need to call) .globl L(ffi_call_SYSV) .type L(ffi_call_SYSV),@function .hidden L(ffi_call_SYSV) L(ffi_call_SYSV): ;; Save the regs to the stack. push $srp ;; Used for stack pointer saving. push $r6 ;; Used for function address pointer. push $r7 ;; Used for stack pointer saving. push $r8 ;; We save fig->flags to stack we will need them after we ;; call The Function. push $r13 ;; Saving current stack pointer. move.d $sp,$r8 move.d $sp,$r6 ;; Move address of ffi_prep_args to r13. move.d $r10,$r13 ;; Make room on the stack for the args of fn. sub.d $r12,$sp ;; Function void ffi_prep_args(char *stack, extended_cif *ecif) parameters are: ;; r10 <-- stack pointer ;; r11 <-- &ecif (already there) move.d $sp,$r10 ;; Call the function. jsr $r13 ;; Save the size of the structures which are passed on stack. move.d $r10,$r7 ;; Move first four args in to r10..r13. move.d [$sp+0],$r10 move.d [$sp+4],$r11 move.d [$sp+8],$r12 move.d [$sp+12],$r13 ;; Adjust the stack and check if any parameters are given on stack. addq 16,$sp sub.d $r7,$r6 cmp.d $sp,$r6 bpl go_on nop go_on_no_params_on_stack: move.d $r6,$sp go_on: ;; Discover if we need to put rval address in to r9. move.d [$r8+0],$r7 cmpq FFI_TYPE_STRUCT,$r7 bne call_now nop ;; Move rval address to $r9. move.d [$r8+20],$r9 call_now: ;; Move address of The Function in to r7. move.d [$r8+24],$r7 ;; Call The Function. jsr $r7 ;; Reset stack. move.d $r8,$sp ;; Load rval type (fig->flags) in to r13. pop $r13 ;; Detect rval type. cmpq FFI_TYPE_VOID,$r13 beq epilogue cmpq FFI_TYPE_STRUCT,$r13 beq epilogue cmpq FFI_TYPE_DOUBLE,$r13 beq return_double_or_longlong cmpq FFI_TYPE_UINT64,$r13 beq return_double_or_longlong cmpq FFI_TYPE_SINT64,$r13 beq return_double_or_longlong nop ;; Just return the 32 bit value. ba return nop return_double_or_longlong: ;; Load half of the rval to r10 and the other half to r11. move.d [$sp+16],$r13 move.d $r10,[$r13] addq 4,$r13 move.d $r11,[$r13] ba epilogue nop return: ;; Load the rval to r10. move.d [$sp+16],$r13 move.d $r10,[$r13] epilogue: pop $r8 pop $r7 pop $r6 Jump [$sp+] .size ffi_call_SYSV,.-ffi_call_SYSV /* Save R10..R13 into an array, somewhat like varargs. Copy the next argument too, to simplify handling of any straddling parameter. Save R9 and SP after those. Jump to function handling the rest. Since this is a template, copied and the main function filled in by the user. */ .globl L(ffi_cris_trampoline_template) .type L(ffi_cris_trampoline_template),@function .hidden L(ffi_cris_trampoline_template) L(ffi_cris_trampoline_template): 0: /* The value we get for "PC" is right after the prefix instruction, two bytes from the beginning, i.e. 0b+2. */ move.d $r10,[$pc+2f-(0b+2)] move.d $pc,$r10 1: addq 2f-1b+4,$r10 move.d $r11,[$r10+] move.d $r12,[$r10+] move.d $r13,[$r10+] move.d [$sp],$r11 move.d $r11,[$r10+] move.d $r9,[$r10+] move.d $sp,[$r10+] subq FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE,$r10 move.d 0,$r11 3: jump 0 2: .size ffi_cris_trampoline_template,.-0b /* This macro create a constant usable as "extern const int \name" in C from within libffi, when \name has no prefix decoration. */ .macro const name,value .globl \name .type \name,@object .hidden \name \name: .dword \value .size \name,4 .endm /* Constants for offsets within the trampoline. We could do this with just symbols, avoiding memory contents and memory accesses, but the C usage code would look a bit stranger. */ const L(ffi_cris_trampoline_fn_offset),2b-4-0b const L(ffi_cris_trampoline_closure_offset),3b-4-0b --- NEW FILE: ffi.c --- /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Cygnus Solutions Copyright (c) 2004 Simon Posnjak Copyright (c) 2005 Axis Communications AB CRIS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include <ffi.h> #include <ffi_common.h> #define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) static ffi_status initialize_aggregate_packed_struct (ffi_type * arg) { ffi_type **ptr; FFI_ASSERT (arg != NULL); FFI_ASSERT (arg->elements != NULL); FFI_ASSERT (arg->size == 0); FFI_ASSERT (arg->alignment == 0); ptr = &(arg->elements[0]); while ((*ptr) != NULL) { if (((*ptr)->size == 0) && (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; FFI_ASSERT (ffi_type_test ((*ptr))); arg->size += (*ptr)->size; arg->alignment = (arg->alignment > (*ptr)->alignment) ? arg->alignment : (*ptr)->alignment; ptr++; } if (arg->size == 0) return FFI_BAD_TYPEDEF; else return FFI_OK; } int ffi_prep_args (char *stack, extended_cif * ecif) { unsigned int i; unsigned int struct_count = 0; void **p_argv; char *argp; ffi_type **p_arg; argp = stack; p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; switch ((*p_arg)->type) { case FFI_TYPE_STRUCT: { z = (*p_arg)->size; if (z <= 4) { memcpy (argp, *p_argv, z); z = 4; } else if (z <= 8) { memcpy (argp, *p_argv, z); z = 8; } else { unsigned int uiLocOnStack; z = sizeof (void *); uiLocOnStack = 4 * ecif->cif->nargs + struct_count; struct_count = struct_count + (*p_arg)->size; *(unsigned int *) argp = (unsigned int) (UINT32 *) (stack + uiLocOnStack); memcpy ((stack + uiLocOnStack), *p_argv, (*p_arg)->size); } break; } default: z = (*p_arg)->size; if (z < sizeof (int)) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int) *(SINT8 *) (*p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int) *(UINT8 *) (*p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int) *(SINT16 *) (*p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int) *(UINT16 *) (*p_argv); break; default: FFI_ASSERT (0); } z = sizeof (int); } else if (z == sizeof (int)) *(unsigned int *) argp = (unsigned int) *(UINT32 *) (*p_argv); else memcpy (argp, *p_argv, z); break; } p_argv++; argp += z; } return (struct_count); } ffi_status ffi_prep_cif (ffi_cif * cif, ffi_abi abi, unsigned int nargs, ffi_type * rtype, ffi_type ** atypes) { unsigned bytes = 0; unsigned int i; ffi_type **ptr; FFI_ASSERT (cif != NULL); FFI_ASSERT ((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); cif->abi = abi; cif->arg_types = atypes; cif->nargs = nargs; cif->rtype = rtype; cif->flags = 0; if ((cif->rtype->size == 0) && (initialize_aggregate_packed_struct (cif->rtype) != FFI_OK)) return FFI_BAD_TYPEDEF; FFI_ASSERT_VALID_TYPE (cif->rtype); for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { if (((*ptr)->size == 0) && (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; FFI_ASSERT_VALID_TYPE (*ptr); if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN (bytes, (*ptr)->alignment); if ((*ptr)->type == FFI_TYPE_STRUCT) { if ((*ptr)->size > 8) { bytes += (*ptr)->size; bytes += sizeof (void *); } else { if ((*ptr)->size > 4) bytes += 8; else bytes += 4; } } else bytes += STACK_ARG_SIZE ((*ptr)->size); } cif->bytes = bytes; return ffi_prep_cif_machdep (cif); } ffi_status ffi_prep_cif_machdep (ffi_cif * cif) { switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = (unsigned) cif->rtype->type; break; default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } extern void ffi_call_SYSV (int (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn) ()) __attribute__ ((__visibility__ ("hidden"))); void ffi_call (ffi_cif * cif, void (*fn) (), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca (cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV (ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT (0); break; } } /* Because the following variables are not exported outside libffi, we mark them hidden. */ /* Assembly code for the jump stub. */ extern const char ffi_cris_trampoline_template[] __attribute__ ((__visibility__ ("hidden"))); /* Offset into ffi_cris_trampoline_template of where to put the ffi_prep_closure_inner function. */ extern const int ffi_cris_trampoline_fn_offset __attribute__ ((__visibility__ ("hidden"))); /* Offset into ffi_cris_trampoline_template of where to put the closure data. */ extern const int ffi_cris_trampoline_closure_offset __attribute__ ((__visibility__ ("hidden"))); /* This function is sibling-called (jumped to) by the closure trampoline. We get R10..R13 at PARAMS[0..3] and a copy of [SP] at PARAMS[4] to simplify handling of a straddling parameter. A copy of R9 is at PARAMS[5] and SP at PARAMS[6]. These parameters are put at the appropriate place in CLOSURE which is then executed and the return value is passed back to the caller. */ static unsigned long long ffi_prep_closure_inner (void **params, ffi_closure* closure) { char *register_args = (char *) params; void *struct_ret = params[5]; char *stack_args = params[6]; char *ptr = register_args; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; /* Max room needed is number of arguments as 64-bit values. */ void **avalue = alloca (closure->cif->nargs * sizeof(void *)); int i; int doing_regs; long long llret = 0; /* Find the address of each argument. */ for (i = 0, doing_regs = 1; i < cif->nargs; i++) { /* Types up to and including 8 bytes go by-value. */ if (arg_types[i]->size <= 4) { avalue[i] = ptr; ptr += 4; } else if (arg_types[i]->size <= 8) { avalue[i] = ptr; ptr += 8; } else { FFI_ASSERT (arg_types[i]->type == FFI_TYPE_STRUCT); /* Passed by-reference, so copy the pointer. */ avalue[i] = *(void **) ptr; ptr += 4; } /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. Step over the first one if we had a straddling parameter. */ if (doing_regs && ptr >= register_args + 4*4) { ptr = stack_args + ((ptr > register_args + 4*4) ? 4 : 0); doing_regs = 0; } } /* Invoke the closure. */ (closure->fun) (cif, cif->rtype->type == FFI_TYPE_STRUCT /* The caller allocated space for the return structure, and passed a pointer to this space in R9. */ ? struct_ret /* We take advantage of being able to ignore that the high part isn't set if the return value is not in R10:R11, but in R10 only. */ : (void *) &llret, avalue, closure->user_data); return llret; } /* API function: Prepare the trampoline. */ ffi_status ffi_prep_closure (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif *, void *, void **, void*), void *user_data) { void *innerfn = ffi_prep_closure_inner; FFI_ASSERT (cif->abi == FFI_SYSV); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; memcpy (closure->tramp, ffi_cris_trampoline_template, FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE); memcpy (closure->tramp + ffi_cris_trampoline_fn_offset, &innerfn, sizeof (void *)); memcpy (closure->tramp + ffi_cris_trampoline_closure_offset, &closure, sizeof (void *)); return FFI_OK; } --- NEW FILE: ffitarget.h --- /* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for CRIS. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_DEFAULT_ABI = FFI_SYSV, FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE 36 #define FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE (7*4) #define FFI_TRAMPOLINE_SIZE \ (FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE + FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE) #define FFI_NATIVE_RAW_API 0 #endif |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:58
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/cris/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/src/cris/CVS.gcc Added Files: Root Repository Entries Log Message: update from gcc cvs --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/src/cris --- NEW FILE: Entries --- /ffi.c/1.1/Mon Apr 18 17:08:57 2005// /ffitarget.h/1.1/Mon Apr 18 17:08:57 2005// /sysv.S/1.1/Mon Apr 18 17:08:57 2005// D |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:58
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/src/CVS.gcc Added Files: Root Repository Entries.Log Entries Log Message: update from gcc cvs --- NEW FILE: Entries.Log --- A D/alpha//// A D/arm//// A D/cris//// A D/frv//// A D/ia64//// A D/m32r//// A D/m68k//// A D/mips//// A D/pa//// A D/powerpc//// A D/s390//// A D/sh//// A D/sh64//// A D/sparc//// A D/x86//// --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/src --- NEW FILE: Entries --- /debug.c/1.3/Tue Oct 21 19:01:54 2003/-ko/ /ffitest.c/1.13/Fri Apr 18 12:32:36 2003/-ko/ /java_raw_api.c/1.6/Thu Oct 23 20:24:20 2003// /prep_cif.c/1.10/Mon Apr 18 17:08:57 2005/-ko/ /raw_api.c/1.3/Tue Oct 21 19:01:54 2003/-ko/ /types.c/1.19/Fri Dec 31 22:04:30 2004/-ko/ D |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:58
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/frv In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/src/frv Added Files: ffitarget.h ffi.c eabi.S Log Message: update from gcc cvs --- NEW FILE: eabi.S --- /* ----------------------------------------------------------------------- eabi.S - Copyright (c) 2004 Anthony Green FR-V Assembly glue. $Id: eabi.S,v 1.1 2005/05/14 11:05:42 adegert Exp $ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include <fficonfig.h> #include <ffi.h> .globl ffi_prep_args_EABI .text .p2align 4 .globl ffi_call_EABI .type ffi_call_EABI, @function # gr8 : ffi_prep_args # gr9 : &ecif # gr10: cif->bytes # gr11: fig->flags # gr12: ecif.rvalue # gr13: fn ffi_call_EABI: addi sp, #-80, sp sti fp, @(sp, #24) addi sp, #24, fp movsg lr, gr5 /* Make room for the new arguments. */ /* subi sp, fp, gr10 */ /* Store return address and incoming args on stack. */ sti gr5, @(fp, #8) sti gr8, @(fp, #-4) sti gr9, @(fp, #-8) sti gr10, @(fp, #-12) sti gr11, @(fp, #-16) sti gr12, @(fp, #-20) sti gr13, @(fp, #-24) sub sp, gr10, sp /* Call ffi_prep_args. */ ldi @(fp, #-4), gr4 addi sp, #0, gr8 ldi @(fp, #-8), gr9 #ifdef __FRV_FDPIC__ ldd @(gr4, gr0), gr14 calll @(gr14, gr0) #else calll @(gr4, gr0) #endif /* ffi_prep_args returns the new stack pointer. */ mov gr8, gr4 ldi @(sp, #0), gr8 ldi @(sp, #4), gr9 ldi @(sp, #8), gr10 ldi @(sp, #12), gr11 ldi @(sp, #16), gr12 ldi @(sp, #20), gr13 /* Always copy the return value pointer into the hidden parameter register. This is only strictly necessary when we're returning an aggregate type, but it doesn't hurt to do this all the time, and it saves a branch. */ ldi @(fp, #-20), gr3 /* Use the ffi_prep_args return value for the new sp. */ mov gr4, sp /* Call the target function. */ ldi @(fp, -24), gr4 #ifdef __FRV_FDPIC__ ldd @(gr4, gr0), gr14 calll @(gr14, gr0) #else calll @(gr4, gr0) #endif /* Store the result. */ ldi @(fp, #-16), gr10 /* fig->flags */ ldi @(fp, #-20), gr4 /* ecif.rvalue */ /* Is the return value stored in two registers? */ cmpi gr10, #8, icc0 bne icc0, 0, .L2 /* Yes, save them. */ sti gr8, @(gr4, #0) sti gr9, @(gr4, #4) bra .L3 .L2: /* Is the return value a structure? */ cmpi gr10, #-1, icc0 beq icc0, 0, .L3 /* No, save a 4 byte return value. */ sti gr8, @(gr4, #0) .L3: /* Restore the stack, and return. */ ldi @(fp, 8), gr5 ld @(fp, gr0), fp addi sp,#80,sp jmpl @(gr5,gr0) .size ffi_call_EABI, .-ffi_call_EABI --- NEW FILE: ffi.c --- /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2004 Anthony Green FR-V Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include <ffi.h> #include <ffi_common.h> #include <stdlib.h> /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void *ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register void **p_argv; register char *argp; register ffi_type **p_arg; register int count = 0; p_argv = ecif->avalue; argp = stack; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; z = (*p_arg)->size; if ((*p_arg)->type == FFI_TYPE_STRUCT) { z = sizeof(void*); *(void **) argp = *p_argv; } /* if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (count > 24) { // This is going on the stack. Turn it into a double. *(double *) argp = (double) *(float*)(* p_argv); z = sizeof(double); } else *(void **) argp = *(void **)(* p_argv); } */ else if (z < sizeof(int)) { z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; default: FFI_ASSERT(0); } } else if (z == sizeof(int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { memcpy(argp, *p_argv, z); } p_argv++; argp += z; count += z; } return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8))); } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { if (cif->rtype->type == FFI_TYPE_STRUCT) cif->flags = -1; else cif->flags = cif->rtype->size; cif->bytes = ALIGN (cif->bytes, 8); return FFI_OK; } extern void ffi_call_EABI(void *(*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)()); void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_EABI: ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } } void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, unsigned arg4, unsigned arg5, unsigned arg6) { /* This function is called by a trampoline. The trampoline stows a pointer to the ffi_closure object in gr7. We must save this pointer in a place that will persist while we do our work. */ register ffi_closure *creg __asm__ ("gr7"); ffi_closure *closure = creg; /* Arguments that don't fit in registers are found on the stack at a fixed offset above the current frame pointer. */ register char *frame_pointer __asm__ ("fp"); char *stack_args = frame_pointer + 16; /* Lay the register arguments down in a continuous chunk of memory. */ unsigned register_args[6] = { arg1, arg2, arg3, arg4, arg5, arg6 }; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; void **avalue = alloca (cif->nargs * sizeof(void *)); char *ptr = (char *) register_args; int i; /* Find the address of each argument. */ for (i = 0; i < cif->nargs; i++) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = ptr + 3; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = ptr + 2; break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_FLOAT: avalue[i] = ptr; break; case FFI_TYPE_STRUCT: avalue[i] = *(void**)ptr; break; default: /* This is an 8-byte value. */ avalue[i] = ptr; ptr += 4; break; } ptr += 4; /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. */ if (ptr == ((char *)register_args + (6*4))) ptr = stack_args; } /* Invoke the closure. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { /* The caller allocates space for the return structure, and passes a pointer to this space in gr3. Use this value directly as the return value. */ register void *return_struct_ptr __asm__("gr3"); (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); } else { /* Allocate space for the return value and call the function. */ long long rvalue; (closure->fun) (cif, &rvalue, avalue, closure->user_data); /* Functions return 4-byte or smaller results in gr8. 8-byte values also use gr9. We fill the both, even for small return values, just to avoid a branch. */ asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); } } ffi_status ffi_prep_closure (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data) { unsigned int *tramp = (unsigned int *) &closure->tramp[0]; unsigned long fn = (long) ffi_closure_eabi; unsigned long cls = (long) closure; #ifdef __FRV_FDPIC__ register void *got __asm__("gr15"); #endif int i; fn = (unsigned long) ffi_closure_eabi; #ifdef __FRV_FDPIC__ tramp[0] = &tramp[2]; tramp[1] = got; tramp[2] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ tramp[3] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ tramp[4] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ tramp[5] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ tramp[6] = 0x9cc86000; /* ldi @(gr6, #0), gr14 */ tramp[7] = 0x8030e000; /* jmpl @(gr14, gr0) */ #else tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ #endif closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Cache flushing. */ for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) __asm__ volatile ("dcf @(%0,%1)\n\tici @(%0,%1)" :: "r" (tramp), "r" (i)); return FFI_OK; } --- NEW FILE: ffitarget.h --- /* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2004 Red Hat, Inc. Target configuration macros for FR-V Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, #ifdef FRV FFI_EABI, FFI_DEFAULT_ABI = FFI_EABI, #endif FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 #ifdef __FRV_FDPIC__ /* Trampolines are 8 4-byte instructions long. */ #define FFI_TRAMPOLINE_SIZE (8*4) #else /* Trampolines are 5 4-byte instructions long. */ #define FFI_TRAMPOLINE_SIZE (5*4) #endif #endif |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:57
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/frv/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/src/frv/CVS.gcc Added Files: Root Repository Entries Log Message: update from gcc cvs --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/src/frv --- NEW FILE: Entries --- /eabi.S/1.1/Mon Aug 30 15:43:03 2004/-ko/ /ffi.c/1.1/Mon Aug 30 15:43:03 2004// /ffitarget.h/1.2/Tue Feb 8 21:10:50 2005// D |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:57
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/include/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/include/CVS.gcc Added Files: Root Repository Entries Log Message: update from gcc cvs --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/include --- NEW FILE: Entries --- /Makefile.am/1.4/Mon Mar 21 18:01:46 2005// /Makefile.in/1.21/Mon Apr 18 17:08:56 2005// /ffi.h.in/1.29/Mon Aug 30 15:43:02 2004// /ffi_common.h/1.3/Mon Aug 30 15:43:02 2004// D |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:57
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/m32r In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/src/m32r Added Files: sysv.S ffitarget.h ffi.c Log Message: update from gcc cvs --- NEW FILE: sysv.S --- /* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2004 Renesas Technology M32R Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include <fficonfig.h> #include <ffi.h> #ifdef HAVE_MACHINE_ASM_H #include <machine/asm.h> #else /* XXX these lose for some platforms, I'm sure. */ #define CNAME(x) x #define ENTRY(x) .globl CNAME(x)! .type CNAME(x),%function! CNAME(x): #endif .text /* R0: ffi_prep_args */ /* R1: &ecif */ /* R2: cif->bytes */ /* R3: fig->flags */ /* sp+0: ecif.rvalue */ /* sp+4: fn */ /* This assumes we are using gas. */ ENTRY(ffi_call_SYSV) /* Save registers. */ push fp push lr push r3 push r2 push r1 push r0 mv fp, sp /* Make room for all of the new args. */ sub sp, r2 /* Place all of the ffi_prep_args in position. */ mv lr, r0 mv r0, sp /* R1 already set. */ /* And call. */ jl lr /* Move first 4 parameters in registers... */ ld r0, @(0,sp) ld r1, @(4,sp) ld r2, @(8,sp) ld r3, @(12,sp) /* ...and adjust the stack. */ ld lr, @(8,fp) cmpi lr, #16 bc adjust_stack ldi lr, #16 adjust_stack: add sp, lr /* Call the function. */ ld lr, @(28,fp) jl lr /* Remove the space we pushed for the args. */ mv sp, fp /* Load R2 with the pointer to storage for the return value. */ ld r2, @(24,sp) /* Load R3 with the return type code. */ ld r3, @(12,sp) /* If the return value pointer is NULL, assume no return value. */ beqz r2, epilogue /* Return INT. */ ldi r4, #FFI_TYPE_INT bne r3, r4, return_double st r0, @r2 bra epilogue return_double: /* Return DOUBLE or LONGDOUBLE. */ ldi r4, #FFI_TYPE_DOUBLE bne r3, r4, epilogue st r0, @r2 st r1, @(4,r2) epilogue: pop r0 pop r1 pop r2 pop r3 pop lr pop fp jmp lr .ffi_call_SYSV_end: .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) --- NEW FILE: ffi.c --- /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2004 Renesas Technology M32R Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include <ffi.h> #include <ffi_common.h> #include <stdlib.h> /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments. */ /*@-exportheader@*/ void ffi_prep_args(char *stack, extended_cif *ecif) /*@=exportheader@*/ { unsigned int i; int tmp; unsigned int avn; void **p_argv; char *argp; ffi_type **p_arg; tmp = 0; argp = stack; if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 8) { *(void **) argp = ecif->rvalue; argp += 4; } avn = ecif->cif->nargs; p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0) && (avn != 0); i--, p_arg++) { size_t z; /* Align if necessary. */ if (((*p_arg)->alignment - 1) & (unsigned) argp) argp = (char *) ALIGN (argp, (*p_arg)->alignment); if (avn != 0) { avn--; z = (*p_arg)->size; if (z < sizeof (int)) { z = sizeof (int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; case FFI_TYPE_STRUCT: z = (*p_arg)->size; if ((*p_arg)->alignment != 1) memcpy (argp, *p_argv, z); else memcpy (argp + 4 - z, *p_argv, z); z = sizeof (int); break; default: FFI_ASSERT(0); } } else if (z == sizeof (int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { if ((*p_arg)->type == FFI_TYPE_STRUCT) { if (z > 8) { *(unsigned int *) argp = (unsigned int)(void *)(* p_argv); z = sizeof(void *); } else { memcpy(argp, *p_argv, z); z = 8; } } else { /* Double or long long 64bit. */ memcpy (argp, *p_argv, z); } } p_argv++; argp += z; } } return; } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* Set the return type flag. */ switch (cif->rtype->type) { case FFI_TYPE_VOID: cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_STRUCT: if (cif->rtype->size <= 4) cif->flags = FFI_TYPE_INT; else if (cif->rtype->size <= 8) cif->flags = FFI_TYPE_DOUBLE; else cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_DOUBLE: cif->flags = FFI_TYPE_DOUBLE; break; case FFI_TYPE_FLOAT: default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } /*@-declundef@*/ /*@-exportheader@*/ extern void ffi_call_SYSV(void (*)(char *, extended_cif *), /*@out@*/ extended_cif *, unsigned, unsigned, /*@out@*/ unsigned *, void (*fn)()); /*@=declundef@*/ /*@=exportheader@*/ void ffi_call(/*@dependent@*/ ffi_cif *cif, void (*fn)(), /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { /*@-sysunrecog@*/ ecif.rvalue = alloca (cif->rtype->size); /*@=sysunrecog@*/ } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: /*@-usedef@*/ ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); if (cif->rtype->type == FFI_TYPE_STRUCT) { int size = cif->rtype->size; int align = cif->rtype->alignment; if (size < 4) { if (align == 1) *(unsigned long *)(ecif.rvalue) <<= (4 - size) * 8; } else if (4 < size && size < 8) { if (align == 1) { memcpy (ecif.rvalue, ecif.rvalue + 8-size, size); } else if (align == 2) { if (size & 1) size += 1; if (size != 8) memcpy (ecif.rvalue, ecif.rvalue + 8-size, size); } } } /*@=usedef@*/ break; default: FFI_ASSERT(0); break; } } --- NEW FILE: ffitarget.h --- /* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 2004 Renesas Technology. Target configuration macros for M32R. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_DEFAULT_ABI = FFI_SYSV, FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; #endif #define FFI_CLOSURES 0 #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #endif |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:57
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/testsuite/lib Added Files: libffi-dg.exp Log Message: update from gcc cvs --- NEW FILE: libffi-dg.exp --- # Copyright (C) 2003, 2005 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. proc load_gcc_lib { filename } { global srcdir load_file $srcdir/../../gcc/testsuite/lib/$filename } load_lib dg.exp load_lib libgloss.exp load_gcc_lib target-libpath.exp load_gcc_lib wrapper.exp # Define libffi callbacks for dg.exp. proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { # To get all \n in dg-output test strings to match printf output # in a system that outputs it as \015\012 (i.e. not just \012), we # need to change all \n into \r?\n. As there is no dejagnu flag # or hook to do that, we simply change the text being tested. # Unfortunately, we have to know that the variable is called # dg-output-text and lives in the caller of libffi-dg-test, which # is two calls up. Overriding proc dg-output would be longer and # would necessarily have the same assumption. upvar 2 dg-output-text output_match if { [llength $output_match] > 1 } { regsub -all "\n" [lindex $output_match 1] "\r?\n" x set output_match [lreplace $output_match 1 1 $x] } # Set up the compiler flags, based on what we're going to do. set options [list] switch $do_what { "compile" { set compile_type "assembly" set output_file "[file rootname [file tail $prog]].s" } "link" { set compile_type "executable" set output_file "[file rootname [file tail $prog]].exe" # The following line is needed for targets like the i960 where # the default output file is b.out. Sigh. } "run" { set compile_type "executable" # FIXME: "./" is to cope with "." not being in $PATH. # Should this be handled elsewhere? # YES. set output_file "./[file rootname [file tail $prog]].exe" # This is the only place where we care if an executable was # created or not. If it was, dg.exp will try to run it. remote_file build delete $output_file; } default { perror "$do_what: not a valid dg-do keyword" return "" } } if { $extra_tool_flags != "" } { lappend options "additional_flags=$extra_tool_flags" } set comp_output [libffi_target_compile "$prog" "$output_file" "$compile_type" $options]; return [list $comp_output $output_file] } proc libffi-dg-test { prog do_what extra_tool_flags } { return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags] } proc libffi-init { args } { global gluefile wrap_flags; global srcdir global blddirffi global objdir global blddircxx global TOOL_OPTIONS global tool global libffi_include global libffi_link_flags global tool_root_dir global ld_library_path set blddirffi "${objdir}/.." verbose "libffi $blddirffi" set blddircxx [lookfor_file [get_multilibs] libstdc++-v3] verbose "libstdc++ $blddircxx" set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] if {$gccdir != ""} { set gccdir [file dirname $gccdir] } verbose "gccdir $gccdir" set ld_library_path "." append ld_library_path ":${gccdir}" set compiler "${gccdir}/xgcc" if { [is_remote host] == 0 && [which $compiler] != 0 } { foreach i "[exec $compiler --print-multi-lib]" { set mldir "" regexp -- "\[a-z0-9=/\.-\]*;" $i mldir set mldir [string trimright $mldir "\;@"] if { "$mldir" == "." } { continue } if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } { append ld_library_path ":${gccdir}/${mldir}" } } } # add the library path for libffi. append ld_library_path ":${blddirffi}/.libs" # add the library path for libstdc++ as well. append ld_library_path ":${blddircxx}/src/.libs" verbose "ld_library_path: $ld_library_path" # Point to the Libffi headers in libffi. set libffi_include "${blddirffi}/include" verbose "libffi_include $libffi_include" set libffi_dir "${blddirffi}/.libs" verbose "libffi_dir $libffi_dir" if { $libffi_dir != "" } { set libffi_dir [file dirname ${libffi_dir}] set libffi_link_flags "-L${libffi_dir}/.libs" lappend libffi_link_flags "-L${blddircxx}/src/.libs" } set_ld_library_path_env_vars libffi_maybe_build_wrapper "${objdir}/testglue.o" } proc libffi_exit { } { global gluefile; if [info exists gluefile] { file_on_build delete $gluefile; unset gluefile; } } proc libffi_target_compile { source dest type options } { global gluefile wrap_flags; global srcdir global blddirffi global TOOL_OPTIONS global libffi_link_flags global libffi_include global target_triplet if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { lappend options "libs=${gluefile}" lappend options "ldflags=$wrap_flags" } # TOOL_OPTIONS must come first, so that it doesn't override testcase # specific options. if [info exists TOOL_OPTIONS] { lappend options [concat "additional_flags=$TOOL_OPTIONS" $options]; } # search for ffi_mips.h in srcdir, too lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include -I${libffi_include}/.." lappend options "additional_flags=${libffi_link_flags}" if { [string match "powerpc-*-darwin*" $target_triplet] } { lappend options "libs= -lgcc_s" } lappend options "libs= -lffi" verbose "options: $options" return [target_compile $source $dest $type $options] } # Utility routines. # # search_for -- looks for a string match in a file # proc search_for { file pattern } { set fd [open $file r] while { [gets $fd cur_line]>=0 } { if [string match "*$pattern*" $cur_line] then { close $fd return 1 } } close $fd return 0 } # Modified dg-runtest that can cycle through a list of optimization options # as c-torture does. proc libffi-dg-runtest { testcases default-extra-flags } { global runtests foreach test $testcases { # If we're only testing specific files and this isn't one of # them, skip it. if ![runtest_file_p $runtests $test] { continue } # Look for a loop within the source code - if we don't find one, # don't pass -funroll[-all]-loops. global torture_with_loops torture_without_loops if [expr [search_for $test "for*("]+[search_for $test "while*("]] { set option_list $torture_with_loops } else { set option_list $torture_without_loops } set nshort [file tail [file dirname $test]]/[file tail $test] foreach flags $option_list { verbose "Testing $nshort, $flags" 1 dg-test $test $flags ${default-extra-flags} } } } # Like check_conditional_xfail, but callable from a dg test. proc dg-xfail-if { args } { set args [lreplace $args 0 0] set selector "target [join [lindex $args 1]]" if { [dg-process-target $selector] == "S" } { global compiler_conditional_xfail_data set compiler_conditional_xfail_data $args } } # We need to make sure that additional_files and additional_sources # are both cleared out after every test. It is not enough to clear # them out *before* the next test run because gcc-target-compile gets # run directly from some .exp files (outside of any test). (Those # uses should eventually be eliminated.) # Because the DG framework doesn't provide a hook that is run at the # end of a test, we must replace dg-test with a wrapper. if { [info procs saved-dg-test] == [list] } { rename dg-test saved-dg-test proc dg-test { args } { global additional_files global additional_sources global errorInfo if { [ catch { eval saved-dg-test $args } errmsg ] } { set saved_info $errorInfo set additional_files "" set additional_sources "" error $errmsg $saved_info } set additional_files "" set additional_sources "" } } # Local Variables: # tcl-indent-level:4 # End: |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:57
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/m32r/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/src/m32r/CVS.gcc Added Files: Root Repository Entries Log Message: update from gcc cvs --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/src/m32r --- NEW FILE: Entries --- /ffi.c/1.1/Wed Oct 13 17:20:24 2004// /ffitarget.h/1.2/Mon Oct 25 08:55:44 2004// /sysv.S/1.1/Wed Oct 13 17:20:24 2004// D |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:56
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/testsuite/config Added Files: default.exp Log Message: update from gcc cvs --- NEW FILE: default.exp --- load_lib "standard.exp" |