github.com/prattmic/llgo-embedded@v0.0.0-20150820070356-41cfecea0e1e/third_party/gofrontend/libffi/testsuite/libffi.go/aa-direct.c (about) 1 /* { dg-do run } */ 2 3 #include "static-chain.h" 4 5 #if defined(__GNUC__) && !defined(__clang__) && defined(STATIC_CHAIN_REG) 6 7 #include "ffitest.h" 8 9 /* Blatent assumption here that the prologue doesn't clobber the 10 static chain for trivial functions. If this is not true, don't 11 define STATIC_CHAIN_REG, and we'll test what we can via other tests. */ 12 void *doit(void) 13 { 14 register void *chain __asm__(STATIC_CHAIN_REG); 15 return chain; 16 } 17 18 int main() 19 { 20 ffi_cif cif; 21 void *result; 22 23 CHECK(ffi_prep_cif(&cif, ABI_NUM, 0, &ffi_type_pointer, NULL) == FFI_OK); 24 25 ffi_call_go(&cif, FFI_FN(doit), &result, NULL, &result); 26 27 CHECK(result == &result); 28 29 return 0; 30 } 31 32 #else /* UNSUPPORTED */ 33 int main() { return 0; } 34 #endif