Merge pull request #266 from dr-hannibal/arc-pthread

Make testing easier outside of build directory and especially for ARC
This commit is contained in:
Tom Tromey
2016-08-02 10:23:25 -06:00
committed by GitHub
3 changed files with 14 additions and 5 deletions

View File

@@ -102,11 +102,14 @@ proc libffi-init { args } {
global ld_library_path global ld_library_path
global compiler_vendor global compiler_vendor
set blddirffi [pwd]/.. if ![info exists blddirffi] {
set blddirffi [pwd]/..
}
verbose "libffi $blddirffi" verbose "libffi $blddirffi"
# Which compiler are we building with? # Which compiler are we building with?
set tmp [grep ../config.log "^ax_cv_c_compiler_vendor.*$"] set tmp [grep "$blddirffi/config.log" "^ax_cv_c_compiler_vendor.*$"]
regexp -- {^[^=]*=(.*)$} $tmp nil compiler_vendor regexp -- {^[^=]*=(.*)$} $tmp nil compiler_vendor
if { [string match $compiler_vendor "gnu"] } { if { [string match $compiler_vendor "gnu"] } {
@@ -219,6 +222,10 @@ proc libffi_target_compile { source dest type options } {
lappend options "c++" lappend options "c++"
} }
if { [string match "arc*-*-linux*" $target_triplet] } {
lappend options "libs= -lpthread"
}
verbose "options: $options" verbose "options: $options"
return [target_compile $source $dest $type $options] return [target_compile $source $dest $type $options]
} }

View File

@@ -57,10 +57,10 @@ int main(int argc __UNUSED__, char** argv __UNUSED__)
CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK);
((void*(*)(Dbls))(code))(arg); ((void*(*)(Dbls))(code))(arg);
/* { dg-output "1.0 2.0\n" } */ /* { dg-output "1.0 2.0" } */
closure_test_fn(arg); closure_test_fn(arg);
/* { dg-output "1.0 2.0\n" } */ /* { dg-output "\n1.0 2.0" } */
return 0; return 0;
} }

View File

@@ -22,6 +22,7 @@ int main (void)
void *values[MAX_ARGS]; void *values[MAX_ARGS];
float f; float f;
long double ld; long double ld;
long double original;
args[0] = &ffi_type_float; args[0] = &ffi_type_float;
values[0] = &f; values[0] = &f;
@@ -49,7 +50,8 @@ int main (void)
#endif #endif
/* These are not always the same!! Check for a reasonable delta */ /* These are not always the same!! Check for a reasonable delta */
if (fabsl(ld - ldblit(f)) < LDBL_EPSILON) original = ldblit(f);
if (((ld > original) ? (ld - original) : (original - ld)) < LDBL_EPSILON)
puts("long double return value tests ok!"); puts("long double return value tests ok!");
else else
CHECK(0); CHECK(0);