- 所有 tcc 文件/内容/宏改名为 pcc (tcc.c->pcc.c, tccelf.c->pccelf.c, libtcc.c->libpcc.c 等) - 支持架构: i386, x86_64, ARM, ARM64, RISC-V, C67 - 支持格式: PE, ELF, Mach-O, COFF - 完整预处理、代码生成、链接器、调试信息 - 构建成功: pcc.exe (x86_64 Windows) - 功能测试通过: 递归/结构体/浮点/switch/循环 - 自编译测试通过: pcc 可以编译自身
38 行
883 B
C
38 行
883 B
C
/* Check semantics of various constructs to generate renamed symbols. */
|
|
|
|
extern int printf (const char *, ...);
|
|
void target(void);
|
|
void target(void) {
|
|
printf("in target function\n");
|
|
}
|
|
void alias_for_target(void) __attribute__((alias("target")));
|
|
|
|
int g_int = 34;
|
|
int alias_int __attribute__((alias("g_int")));
|
|
|
|
#ifdef __leading_underscore
|
|
# define _ "_"
|
|
#else
|
|
# define _
|
|
#endif
|
|
|
|
void asm_for_target(void) __asm__(_"target");
|
|
int asm_int __asm__(_"g_int");
|
|
|
|
/* This is not supposed to compile, alias targets must be defined in the
|
|
same unit. In PCC they even must be defined before the reference
|
|
void alias_for_undef(void) __attribute__((alias("undefined")));
|
|
*/
|
|
|
|
extern void inunit2(void);
|
|
|
|
int main(void)
|
|
{
|
|
target();
|
|
alias_for_target();
|
|
asm_for_target();
|
|
printf("g_int = %d\nalias_int = %d\nasm_int = %d\n", g_int, alias_int, asm_int);
|
|
inunit2();
|
|
return 0;
|
|
}
|