mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-17 15:44:18 +08: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).
65 lines
1.5 KiB
C
65 lines
1.5 KiB
C
/* armflush.c - flush the instruction cache
|
|
|
|
__clear_cache is used in tccrun.c, It is a built-in
|
|
intrinsic with gcc. However tcc in order to compile
|
|
itself needs this function */
|
|
|
|
/* ------------------------------------------------------------- */
|
|
#if defined __arm__
|
|
|
|
#ifdef __TINYC__
|
|
|
|
/* syscall wrapper */
|
|
unsigned _tccsyscall(unsigned syscall_nr, ...);
|
|
|
|
/* arm-tcc supports only fake asm currently */
|
|
__asm__(
|
|
".global _tccsyscall\n"
|
|
"_tccsyscall:\n"
|
|
"push {r7, lr}\n\t"
|
|
"mov r7, r0\n\t"
|
|
"mov r0, r1\n\t"
|
|
"mov r1, r2\n\t"
|
|
"mov r2, r3\n\t"
|
|
"svc #0\n\t"
|
|
"pop {r7, pc}"
|
|
);
|
|
|
|
/* from unistd.h: */
|
|
#if defined(__thumb__) || defined(__ARM_EABI__)
|
|
# define __NR_SYSCALL_BASE 0x0
|
|
#else
|
|
# define __NR_SYSCALL_BASE 0x900000
|
|
#endif
|
|
#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000)
|
|
#define __ARM_NR_cacheflush (__ARM_NR_BASE+2)
|
|
|
|
#define syscall _tccsyscall
|
|
|
|
#else
|
|
|
|
#define _GNU_SOURCE
|
|
#include <unistd.h>
|
|
#include <sys/syscall.h>
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
/* Flushing for tccrun */
|
|
void __clear_cache(void *beginning, void *end)
|
|
{
|
|
/* __ARM_NR_cacheflush is kernel private and should not be used in user space.
|
|
* However, there is no ARM asm parser in tcc so we use it for now */
|
|
syscall(__ARM_NR_cacheflush, beginning, end, 0);
|
|
}
|
|
|
|
/* ------------------------------------------------------------- */
|
|
#elif defined __aarch64__
|
|
void __clear_cache(void *beg, void *end)
|
|
{
|
|
__arm64_clear_cache(beg, end);
|
|
}
|
|
|
|
/* ------------------------------------------------------------- */
|
|
#endif
|