From 4b3c6e74aba07d61e91b2e0ba7190483a0f9f000 Mon Sep 17 00:00:00 2001 From: grischka Date: Sun, 23 Jul 2017 21:24:11 +0200 Subject: tccgen: nodata_wanted fix, default ONE_SOURCE, etc... tccgen.c: doubles need to be aligned, on ARM. The section_reserve() in init_putv does not do that. -D ONE_SOURCE: is now the default and not longer needed. Also, tcc.h now sets the default native target. These both make compiling tcc simple as "gcc tcc.c -o tcc -ldl" again. arm-asm.c: enable pseudo asm also for inline asm tests/tests2/Makefile: disable bitfield tests except on windows and x86_64 and don't generate-always tcc.c: fix a loop with -dt on errors configure: print compiler version (as recognized) tccpp.c: actually define symbols for tcc -dt clear static variables (needed for -dt or libtcc usage) 96_nodata_wanted.c: use __label__ instead of asm lib/files: use native symbols (__i386__ etc.) instead of TCC_TARGET_... --- lib/Makefile | 6 +++--- lib/alloca86-bt.S | 2 +- lib/alloca86.S | 2 +- lib/alloca86_64-bt.S | 2 +- lib/alloca86_64.S | 4 ++-- lib/bcheck.c | 20 ++++++++++++++------ lib/libtcc1.c | 6 +++--- lib/va_list.c | 2 +- 8 files changed, 26 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/Makefile b/lib/Makefile index 35046a4..3b582d4 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -29,7 +29,7 @@ endif # only for native compiler $(X)BCHECK_O = bcheck.o -ifeq ($(CONFIG_musl),yes) +ifeq ($(CONFIG_musl)$(CONFIG_uClibc),yes) BCHECK_O = endif @@ -61,10 +61,10 @@ $(BIN) : $(patsubst %.o,$(X)%.o,$(OBJ-$T)) $(XAR) rcs $@ $^ $(X)%.o : %.c - $(XCC) -c $< -o $@ $(DEFINES) $(XFLAGS) + $(XCC) -c $< -o $@ $(XFLAGS) $(X)%.o : %.S - $(XCC) -c $< -o $@ $(DEFINES) $(XFLAGS) + $(XCC) -c $< -o $@ $(XFLAGS) $(X)crt1w.o : crt1.c $(X)wincrt1w.o : wincrt1.c diff --git a/lib/alloca86-bt.S b/lib/alloca86-bt.S index 5215505..4f95cf1 100644 --- a/lib/alloca86-bt.S +++ b/lib/alloca86-bt.S @@ -11,7 +11,7 @@ __bound_alloca: and $-4,%eax jz p6 -#ifdef TCC_TARGET_PE +#ifdef _WIN32 p4: cmp $4096,%eax jbe p5 diff --git a/lib/alloca86.S b/lib/alloca86.S index ec1e185..bb7a2c2 100644 --- a/lib/alloca86.S +++ b/lib/alloca86.S @@ -10,7 +10,7 @@ alloca: and $-4,%eax jz p3 -#ifdef TCC_TARGET_PE +#ifdef _WIN32 p1: cmp $4096,%eax jbe p2 diff --git a/lib/alloca86_64-bt.S b/lib/alloca86_64-bt.S index 9b6c3c6..4cbad90 100644 --- a/lib/alloca86_64-bt.S +++ b/lib/alloca86_64-bt.S @@ -4,7 +4,7 @@ .globl __bound_alloca __bound_alloca: -#ifdef TCC_TARGET_PE +#ifdef _WIN32 # bound checking is not implemented pop %rdx mov %rcx,%rax diff --git a/lib/alloca86_64.S b/lib/alloca86_64.S index 4f4dad7..ae3c97d 100644 --- a/lib/alloca86_64.S +++ b/lib/alloca86_64.S @@ -5,7 +5,7 @@ alloca: pop %rdx -#ifdef TCC_TARGET_PE +#ifdef _WIN32 mov %rcx,%rax #else mov %rdi,%rax @@ -14,7 +14,7 @@ alloca: and $-16,%rax jz p3 -#ifdef TCC_TARGET_PE +#ifdef _WIN32 p1: cmp $4096,%rax jbe p2 diff --git a/lib/bcheck.c b/lib/bcheck.c index 41c08aa..d0c1ae2 100644 --- a/lib/bcheck.c +++ b/lib/bcheck.c @@ -21,10 +21,15 @@ #include #include #include -#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) \ - && !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) + +#if !defined(__FreeBSD__) \ + && !defined(__FreeBSD_kernel__) \ + && !defined(__DragonFly__) \ + && !defined(__OpenBSD__) \ + && !defined(__NetBSD__) #include #endif + #if !defined(_WIN32) #include #endif @@ -45,10 +50,13 @@ #define CONFIG_TCC_MALLOC_HOOKS #define HAVE_MEMALIGN -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \ - || defined(__DragonFly__) || defined(__dietlibc__) \ - || defined(__UCLIBC__) || defined(__OpenBSD__) || defined(__NetBSD__) \ - || defined(_WIN32) || defined(TCC_UCLIBC) || defined(TCC_MUSL) +#if defined(__FreeBSD__) \ + || defined(__FreeBSD_kernel__) \ + || defined(__DragonFly__) \ + || defined(__OpenBSD__) \ + || defined(__NetBSD__) \ + || defined(__dietlibc__) \ + || defined(_WIN32) //#warning Bound checking does not support malloc (etc.) in this environment. #undef CONFIG_TCC_MALLOC_HOOKS #undef HAVE_MEMALIGN diff --git a/lib/libtcc1.c b/lib/libtcc1.c index 0702a59..0e46618 100644 --- a/lib/libtcc1.c +++ b/lib/libtcc1.c @@ -107,10 +107,10 @@ union float_long { }; /* XXX: we don't support several builtin supports for now */ -#if !defined(TCC_TARGET_X86_64) && !defined(TCC_TARGET_ARM) +#if !defined __x86_64__ && !defined __arm__ /* XXX: use gcc/tcc intrinsic ? */ -#if defined(TCC_TARGET_I386) +#if defined __i386__ #define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ("subl %5,%1\n\tsbbl %3,%0" \ : "=r" ((USItype) (sh)), \ @@ -589,7 +589,7 @@ long long __fixdfdi (double a1) return s ? ret : -ret; } -#ifndef TCC_TARGET_ARM +#ifndef __arm__ unsigned long long __fixunsxfdi (long double a1) { register union ldouble_long dl1; diff --git a/lib/va_list.c b/lib/va_list.c index 57dce0d..8749f46 100644 --- a/lib/va_list.c +++ b/lib/va_list.c @@ -1,6 +1,6 @@ /* va_list.c - tinycc support for va_list on X86_64 */ -#if defined TCC_TARGET_X86_64 +#if defined __x86_64__ /* Avoid include files, they may not be available when cross compiling */ extern void *memset(void *s, int c, __SIZE_TYPE__ n); -- cgit v1.3.1