mirror of
https://github.com/TinyCC/tinycc.git
synced 2026-05-15 05:15:44 +00:00
tccpe.c: - fix arm64 unwind codes (to make native set/longjmp() work) sizeof(RUNTIME_FUNCTION) is 8 on arm64 in the first place no need to note stack slots if we don't save any registers anyway arm64-gen.c: - fix long double reg-move - fix arm64_hfa() for structs with float arrays - gfunc_prolog(): setup stackframe eariler (simplifies unwind codes) - new function gv_addr(RC); win32/include/setjmp.h: - provide correct definition for setjmo() (frameoffset = 224) tccasm.c: - support ".quad" with symbol & relocation - support ".size" - fix ". - symbol" arithmetic win32/lib/crt1.c and win32/include/stdlib.h: - do not write to __argc/__argv which reside in msvcrt.dll (msvcrt.dll on arm64 does not like that, crashes on unload) tcc.c,libtcc.c: - new functions tcc_fopen/fclose to avoid different stdio unstances in tcc.exe & libtcc.dll tests & github workflow: - add test-win32.bat to run tests with a tcc compiled by build-tcc.bat - add msvcrt_start.c for gcc/clang to use the same runtime as tcc the problem is that newer gcc as well as clang and cl are linking to newer runtimes (such as UCRT) that have partially different printf format behavior which makes tcctest fail. the solution here is to force these compilers to link with msvcrt.dll just like tcc. Also, there is no gcc on arm64-win32 currently at all. Anyway, this approach to running the github CI tests does not require msys2. But It does rely on gnumake as well as on some 'sh' shell though which seems to be installed somewhere (maybe it is the one from git).
83 lines
2.6 KiB
C
83 lines
2.6 KiB
C
/* Simple libc header for TCC
|
|
*
|
|
* Add any function you want from the libc there. This file is here
|
|
* only for your convenience so that you do not need to put the whole
|
|
* glibc include files on your floppy disk
|
|
*/
|
|
#ifndef _TCCLIB_H
|
|
#define _TCCLIB_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdarg.h>
|
|
|
|
/* stdlib.h */
|
|
void *calloc(size_t nmemb, size_t size);
|
|
void *malloc(size_t size);
|
|
void free(void *ptr);
|
|
void *realloc(void *ptr, size_t size);
|
|
int atoi(const char *nptr);
|
|
long int strtol(const char *nptr, char **endptr, int base);
|
|
unsigned long int strtoul(const char *nptr, char **endptr, int base);
|
|
void exit(int);
|
|
void *alloca(size_t);
|
|
|
|
/* stdio.h */
|
|
typedef struct __FILE FILE;
|
|
#define EOF (-1)
|
|
extern FILE *stdin;
|
|
extern FILE *stdout;
|
|
extern FILE *stderr;
|
|
FILE *fopen(const char *path, const char *mode);
|
|
FILE *fdopen(int fildes, const char *mode);
|
|
FILE *freopen(const char *path, const char *mode, FILE *stream);
|
|
int fclose(FILE *stream);
|
|
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
|
size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
|
int fgetc(FILE *stream);
|
|
char *fgets(char *s, int size, FILE *stream);
|
|
int getc(FILE *stream);
|
|
int getchar(void);
|
|
char *gets(char *s);
|
|
int ungetc(int c, FILE *stream);
|
|
int fflush(FILE *stream);
|
|
int puts(const char *s);
|
|
int putchar (int c);
|
|
|
|
int printf(const char *format, ...);
|
|
int fprintf(FILE *stream, const char *format, ...);
|
|
int sprintf(char *str, const char *format, ...);
|
|
int snprintf(char *str, size_t size, const char *format, ...);
|
|
int asprintf(char **strp, const char *format, ...);
|
|
int dprintf(int fd, const char *format, ...);
|
|
int vprintf(const char *format, va_list ap);
|
|
int vfprintf(FILE *stream, const char *format, va_list ap);
|
|
int vsprintf(char *str, const char *format, va_list ap);
|
|
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
|
int vasprintf(char **strp, const char *format, va_list ap);
|
|
int vdprintf(int fd, const char *format, va_list ap);
|
|
|
|
void perror(const char *s);
|
|
|
|
/* string.h */
|
|
char *strcat(char *dest, const char *src);
|
|
char *strchr(const char *s, int c);
|
|
char *strrchr(const char *s, int c);
|
|
char *strcpy(char *dest, const char *src);
|
|
void *memcpy(void *dest, const void *src, size_t n);
|
|
void *memmove(void *dest, const void *src, size_t n);
|
|
void *memset(void *s, int c, size_t n);
|
|
char *strdup(const char *s);
|
|
size_t strlen(const char *s);
|
|
|
|
/* dlfcn.h */
|
|
#define RTLD_LAZY 0x001
|
|
#define RTLD_NOW 0x002
|
|
#define RTLD_GLOBAL 0x100
|
|
|
|
void *dlopen(const char *filename, int flag);
|
|
const char *dlerror(void);
|
|
void *dlsym(void *handle, char *symbol);
|
|
int dlclose(void *handle);
|
|
|
|
#endif /* _TCCLIB_H */
|