2017-11-23 00:57:43 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2020-06-27 23:15:06 +08:00
|
|
|
#if (defined _WIN32 || defined __APPLE__) && (!defined __TINYC__ || defined __leading_underscore)
|
2020-05-23 09:46:32 +08:00
|
|
|
# define _ "_"
|
2017-12-13 00:57:20 +08:00
|
|
|
#else
|
|
|
|
# define _
|
|
|
|
#endif
|
|
|
|
|
2020-05-23 09:46:32 +08:00
|
|
|
#ifdef __clang__
|
|
|
|
/* clang needs some help tp not throw functions away even at -O0 */
|
|
|
|
#define __USED __attribute__((__used__))
|
|
|
|
#else
|
|
|
|
#define __USED
|
|
|
|
#endif
|
|
|
|
|
2017-11-23 00:57:43 +08:00
|
|
|
int x3(void)
|
|
|
|
{
|
2017-12-13 00:57:20 +08:00
|
|
|
printf(" x3");
|
2017-11-23 00:57:43 +08:00
|
|
|
return 3;
|
|
|
|
}
|
2017-11-27 11:03:03 +08:00
|
|
|
|
2017-12-04 10:51:14 +08:00
|
|
|
/* That callx4 is defined globally (as if ".globl callx4")
|
|
|
|
is a TCC extension. GCC doesn't behave like this. */
|
2017-11-27 11:03:03 +08:00
|
|
|
void callx4(void);
|
2020-12-17 00:52:59 +08:00
|
|
|
#if __i386__
|
2017-12-13 00:57:20 +08:00
|
|
|
__asm__(_"callx4: call "_"x4; ret;"
|
2020-12-17 00:52:59 +08:00
|
|
|
#else
|
|
|
|
/* Keep stack aligned */
|
|
|
|
__asm__(_"callx4: sub $8,%rsp; call "_"x4; add $8,%rsp; ret;"
|
|
|
|
#endif
|
2017-12-13 00:57:20 +08:00
|
|
|
#ifndef __TINYC__
|
|
|
|
" .global "_"callx4"
|
|
|
|
#endif
|
|
|
|
);
|
2017-12-04 10:51:14 +08:00
|
|
|
|
|
|
|
extern void x5(void);
|
2017-12-13 00:57:20 +08:00
|
|
|
|
2017-12-04 10:51:14 +08:00
|
|
|
void callx5_again(void);
|
|
|
|
void callx5_again(void)
|
|
|
|
{
|
|
|
|
x5();
|
2017-12-13 00:57:20 +08:00
|
|
|
asm("call "_"x6");
|
|
|
|
}
|
|
|
|
|
2020-05-23 09:46:32 +08:00
|
|
|
static void __USED x6()
|
2017-12-13 00:57:20 +08:00
|
|
|
{
|
|
|
|
printf(" x6-2");
|
2017-12-04 10:51:14 +08:00
|
|
|
}
|