diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Makefile | 11 | ||||
| -rw-r--r-- | lib/libtcc1.c | 24 |
2 files changed, 34 insertions, 1 deletions
diff --git a/lib/Makefile b/lib/Makefile index 300fa46..dfd01c3 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -24,6 +24,10 @@ ifndef TARGET ifneq ($(TARGETOS),Darwin) XCC = $(CC) endif + else + ifeq ($(ARCH),arm) + TARGET = arm + endif endif endif endif @@ -41,6 +45,7 @@ cross : TCC = $(TOP)/$(TARGET)-tcc$(EXESUF) I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O) X86_64_O = libtcc1.o alloca86_64.o +ARM_O = libtcc1.o WIN32_O = $(I386_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o WIN64_O = $(X86_64_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o @@ -66,11 +71,17 @@ ifeq "$(TARGET)" "x86_64" TGT = -DTCC_TARGET_X86_64 XCC ?= $(TCC) -B$(TOP) else +ifeq "$(TARGET)" "arm" + OBJ = $(addprefix $(DIR)/,$(ARM_O)) + TGT = -DTCC_TARGET_ARM + XCC ?= $(TCC) -B$(TOP) +else $(error libtcc1.a not supported on target '$(TARGET)') endif endif endif endif +endif XFLAGS = $(CPPFLAGS) $(CFLAGS) $(TGT) diff --git a/lib/libtcc1.c b/lib/libtcc1.c index a717701..3103691 100644 --- a/lib/libtcc1.c +++ b/lib/libtcc1.c @@ -107,7 +107,7 @@ union float_long { }; /* XXX: we don't support several builtin supports for now */ -#ifndef __x86_64__ +#if !defined(__x86_64__) && !defined(__arm__) /* XXX: use gcc/tcc intrinsic ? */ #if defined(__i386__) @@ -713,6 +713,28 @@ void __clear_cache(char *beginning, char *end) { } +#elif defined(__arm__) + +#define _GNU_SOURCE +#include <unistd.h> +#include <sys/syscall.h> + +void __clear_cache(char *beginning, char *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 */ +#if 1 + syscall(__ARM_NR_cacheflush); +#else + __asm__ ("push {r7}\n\t" + "mov r7, #0xf0002\n\t" + "mov r2, #0\n\t" + "swi 0\n\t" + "pop {r7}\n\t" + "ret"); +#endif +} + #else #warning __clear_cache not defined for this architecture, avoid using tcc -run #endif |
