mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-28 04:00:06 +08:00
6a4f3cf127
tested on win32/64 to pass the tests when enabled - libtcc.c : let tcc define __leading_underscore if enabled tcc_add_symbol() : add _ automatically - tccelf.c : remove tcc_get_symbol_err(), find_c_sym() currently symbol length is limited to 256 in several places, so we can use a fixed local buffer for now as well. - win32/lib/crtinit.c : new file for init/fini - lib/*.S, tests7* : use __leading_underscore - bt-log.c: this file wont work relibaly if compiled with gcc
42 lines
963 B
C
42 lines
963 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
asm (
|
|
".text;"
|
|
".globl _us;.globl _ss;.globl _uc;.globl _sc;"
|
|
"_us:;_ss:;_uc:;_sc:;"
|
|
"movl $0x1234ABCD, %eax;"
|
|
"ret;"
|
|
);
|
|
|
|
#ifndef __leading_underscore
|
|
#define us _us
|
|
#define ss _ss
|
|
#define uc _uc
|
|
#define sc _sc
|
|
#endif
|
|
|
|
int main()
|
|
{
|
|
unsigned short us(void);
|
|
short ss(void);
|
|
unsigned char uc(void);
|
|
signed char sc(void);
|
|
|
|
unsigned short (*fpus)(void) = us;
|
|
short (*fpss)(void) = ss;
|
|
unsigned char (*fpuc)(void) = uc;
|
|
signed char (*fpsc)(void) = sc;
|
|
|
|
printf("%08X %08X\n", us() + 1, fpus() + 1);
|
|
printf("%08X %08X\n", ss() + 1, fpss() + 1);
|
|
printf("%08X %08X\n", uc() + 1, fpuc() + 1);
|
|
printf("%08X %08X\n", sc() + 1, fpsc() + 1);
|
|
printf("\n");
|
|
printf("%08X %08X\n", fpus() + 1, us() + 1);
|
|
printf("%08X %08X\n", fpss() + 1, ss() + 1);
|
|
printf("%08X %08X\n", fpuc() + 1, uc() + 1);
|
|
printf("%08X %08X\n", fpsc() + 1, sc() + 1);
|
|
|
|
return 0;
|
|
}
|