mirror of
https://github.com/frida/tinycc
synced 2024-12-22 21:16:49 +03:00
cc6cb7f0e2
See testcase (from grischka). If the asm has no .globl, but there's a (non-static) C definition the symbol should be exported, even if the first reference comes from asm.
49 lines
597 B
C
49 lines
597 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);
|
|
void callx5_again(void);
|
|
int main(int argc, char *argv[])
|
|
{
|
|
asm("call "_"x1");
|
|
asm("call "_"x2");
|
|
asm("call "_"x3");
|
|
callx4();
|
|
asm("call "_"x5");
|
|
callx5_again();
|
|
return 0;
|
|
}
|
|
|
|
static
|
|
int x2(void)
|
|
{
|
|
printf("x2\n");
|
|
return 2;
|
|
}
|
|
|
|
extern int x3(void);
|
|
|
|
void x4(void)
|
|
{
|
|
printf("x4\n");
|
|
}
|
|
|
|
void x5(void);
|
|
void x5(void)
|
|
{
|
|
printf("x5\n");
|
|
}
|