Adjust asm-c-connect testcase for Windows

Calling conventions are different, let's use functions without
any arguments.
master
Michael Matz 2017-11-27 01:09:50 +01:00
parent 4266ebd69c
commit 3494e5de3a
1 changed files with 12 additions and 11 deletions

View File

@ -1,23 +1,24 @@
#include <stdio.h> #include <stdio.h>
#if defined _WIN32 && !defined __TINYC__ #if defined _WIN32 && !defined __TINYC__
# define U "_" # define _ "_"
#else #else
# define U # define _
#endif #endif
const char str[] = "x1\n"; static int x1_c(void)
#ifdef __x86_64__ {
asm(U"x1: push %rbp; mov $"U"str, %rdi; call "U"printf; pop %rbp; ret"); printf("x1\n");
#elif defined (__i386__) return 1;
asm(U"x1: push $"U"str; call "U"printf; pop %eax; ret"); }
#endif
asm(".text;"_"x1: call "_"x1_c; ret");
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
asm("call "U"x1"); asm("call "_"x1");
asm("call "U"x2"); asm("call "_"x2");
asm("call "U"x3"); asm("call "_"x3");
return 0; return 0;
} }