aa-direct.c 723 B

12345678910111213141516171819202122232425262728293031323334
  1. /* { dg-do run } */
  2. #include "static-chain.h"
  3. #if defined(__GNUC__) && !defined(__clang__) && defined(STATIC_CHAIN_REG)
  4. #include "ffitest.h"
  5. /* Blatent assumption here that the prologue doesn't clobber the
  6. static chain for trivial functions. If this is not true, don't
  7. define STATIC_CHAIN_REG, and we'll test what we can via other tests. */
  8. void *doit(void)
  9. {
  10. register void *chain __asm__(STATIC_CHAIN_REG);
  11. return chain;
  12. }
  13. int main()
  14. {
  15. ffi_cif cif;
  16. void *result;
  17. CHECK(ffi_prep_cif(&cif, ABI_NUM, 0, &ffi_type_pointer, NULL) == FFI_OK);
  18. ffi_call_go(&cif, FFI_FN(doit), &result, NULL, &result);
  19. CHECK(result == &result);
  20. return 0;
  21. }
  22. #else /* UNSUPPORTED */
  23. int main() { return 0; }
  24. #endif