tinycc/tests/asm-c-connect-1.c
Michael Matz 9e0d23cc47 tccasm: Unify C and asm symbol table
This makes the asm symbols use the same members as the C symbols
for global decls, e.g. using the ELF symbol to hold offset and
section.  That allows us to use only one symbol table for C and
asm symbols and to get rid of hacks to synch between them.

We still need some special handling for symbols that come purely
from asm sources.
2017-11-27 04:59:29 +01:00

40 lines
475 B
C

#include <stdio.h>
#if defined _WIN32 && !defined __TINYC__
# define _ "_"
#else
# define _
#endif
static int x1_c(void)
{
printf("x1\n");
return 1;
}
asm(".text;"_"x1: call "_"x1_c; ret");
void callx4(void);
int main(int argc, char *argv[])
{
asm("call "_"x1");
asm("call "_"x2");
asm("call "_"x3");
callx4();
return 0;
}
static
int x2(void)
{
printf("x2\n");
return 2;
}
extern int x3(void);
void x4(void)
{
printf("x4\n");
}