History

make test: run cross-test always

To see inconsistencies when they happen.

grischka committed 5 years ago

Commit bbc70701 parent 42220675 files · +69 −41Browse files

Unified · Split

5 files
  1. Makefile +30 −24
  2. tcc.c +6 −3
  3. tcc.h +5 −5
  4. tccgen.c +2 −0
  5. tests/Makefile +26 −9
Makefile+30−24
@@ -62,6 +62,9 @@ else · 61 unmodified lines
62 endif62 endif
63 export MACOSX_DEPLOYMENT_TARGET := 10.663 export MACOSX_DEPLOYMENT_TARGET := 10.6
64 endif64 endif
65 ifdef CONFIG_BSD
66 NATIVE_TARGET = $(ARCH)-$(TARGETOS)
67 endif
65endif68endif
66 69
67# run local version of tcc with local libraries and includes70# run local version of tcc with local libraries and includes
@@ -70,11 +73,6 @@ TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TO · 2 unmodified lines
70TCCFLAGS = $(TCCFLAGS$(CFG))73TCCFLAGS = $(TCCFLAGS$(CFG))
71TCC = $(TOP)/tcc$(EXESUF) $(TCCFLAGS)74TCC = $(TOP)/tcc$(EXESUF) $(TCCFLAGS)
72 75
73# cross compiler targets to build
74TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
75TCC_X += riscv64
76# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
77
78CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE76CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE
79LIBS_P = $(LIBS)77LIBS_P = $(LIBS)
80LDFLAGS_P = $(LDFLAGS)78LDFLAGS_P = $(LDFLAGS)
@@ -99,6 +97,27 @@ NATIVE_DEFINES_no_$(CONFIG_bcheck) += -DCONFIG_TCC_BCHECK=0 · 18 unmodified lines
99NATIVE_DEFINES_no_$(CONFIG_backtrace) += -DCONFIG_TCC_BACKTRACE=097NATIVE_DEFINES_no_$(CONFIG_backtrace) += -DCONFIG_TCC_BACKTRACE=0
100NATIVE_DEFINES += $(NATIVE_DEFINES_yes) $(NATIVE_DEFINES_no_no)98NATIVE_DEFINES += $(NATIVE_DEFINES_yes) $(NATIVE_DEFINES_no_no)
101 99
100DEF-i386 = -DTCC_TARGET_I386
101DEF-i386-win32 = -DTCC_TARGET_I386 -DTCC_TARGET_PE
102DEF-x86_64 = -DTCC_TARGET_X86_64
103DEF-x86_64-win32= -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
104DEF-x86_64-osx = -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO
105DEF-arm-fpa = -DTCC_TARGET_ARM
106DEF-arm-fpa-ld = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12
107DEF-arm-vfp = -DTCC_TARGET_ARM -DTCC_ARM_VFP
108DEF-arm-eabi = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI
109DEF-arm-eabihf = $(DEF-arm-eabi) -DTCC_ARM_HARDFLOAT
110DEF-arm = $(DEF-arm-eabihf)
111DEF-arm-wince = $(DEF-arm-eabihf) -DTCC_TARGET_PE
112DEF-arm64 = -DTCC_TARGET_ARM64
113DEF-riscv64 = -DTCC_TARGET_RISCV64
114DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs
115DEF-x86_64-FreeBSD = $(DEF-x86_64) -DTARGETOS_FreeBSD
116DEF-x86_64-NetBSD = $(DEF-x86_64) -DTARGETOS_NetBSD
117DEF-x86_64-OpenBSD = $(DEF-x86_64) -DTARGETOS_OpenBSD
118
119DEF-$(NATIVE_TARGET) = $(NATIVE_DEFINES)
120
102ifeq ($(INCLUDED),no)121ifeq ($(INCLUDED),no)
103# --------------------------------------------------------------------------122# --------------------------------------------------------------------------
104# running top Makefile123# running top Makefile
@@ -109,6 +128,11 @@ TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info · 4 unmodified lines
109 128
110all: $(PROGS) $(TCCLIBS) $(TCCDOCS)129all: $(PROGS) $(TCCLIBS) $(TCCDOCS)
111 130
131# cross compiler targets to build
132TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
133TCC_X += riscv64
134# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
135
112# cross libtcc1.a targets to build136# cross libtcc1.a targets to build
113LIBTCC1_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince137LIBTCC1_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince
114LIBTCC1_X += riscv64138LIBTCC1_X += riscv64
@@ -122,7 +146,7 @@ cross: $(LIBTCC1_CROSS) $(PROGS_CROSS) · 7 unmodified lines
122# build specific cross compiler & lib146# build specific cross compiler & lib
123cross-%: %-tcc$(EXESUF) %-libtcc1.a ;147cross-%: %-tcc$(EXESUF) %-libtcc1.a ;
124 148
125install: ; @$(MAKE) --no-print-directory install$(CFG) CONFIG_strip=no149install: ; @$(MAKE) --no-print-directory install$(CFG)
126install-strip: ; @$(MAKE) --no-print-directory install$(CFG) CONFIG_strip=yes150install-strip: ; @$(MAKE) --no-print-directory install$(CFG) CONFIG_strip=yes
127uninstall: ; @$(MAKE) --no-print-directory uninstall$(CFG)151uninstall: ; @$(MAKE) --no-print-directory uninstall$(CFG)
128 152
@@ -135,23 +159,6 @@ endif · 6 unmodified lines
135T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown)159T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown)
136X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-)160X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-)
137 161
138DEF-i386 = -DTCC_TARGET_I386
139DEF-x86_64 = -DTCC_TARGET_X86_64
140DEF-i386-win32 = -DTCC_TARGET_PE -DTCC_TARGET_I386
141DEF-x86_64-win32= -DTCC_TARGET_PE -DTCC_TARGET_X86_64
142DEF-x86_64-osx = -DTCC_TARGET_MACHO -DTCC_TARGET_X86_64
143DEF-arm-wince = -DTCC_TARGET_PE -DTCC_TARGET_ARM -DTCC_ARM_EABI -DTCC_ARM_VFP -DTCC_ARM_HARDFLOAT
144DEF-arm64 = -DTCC_TARGET_ARM64
145DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs
146DEF-arm-fpa = -DTCC_TARGET_ARM
147DEF-arm-fpa-ld = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12
148DEF-arm-vfp = -DTCC_TARGET_ARM -DTCC_ARM_VFP
149DEF-arm-eabi = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI
150DEF-arm-eabihf = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
151DEF-arm = $(DEF-arm-eabihf)
152DEF-riscv64 = -DTCC_TARGET_RISCV64
153DEF-$(NATIVE_TARGET) = $(NATIVE_DEFINES)
154
155DEFINES += $(DEF-$T) $(DEF-all)162DEFINES += $(DEF-$T) $(DEF-all)
156DEFINES += $(if $(ROOT-$T),-DCONFIG_SYSROOT="\"$(ROOT-$T)\"")163DEFINES += $(if $(ROOT-$T),-DCONFIG_SYSROOT="\"$(ROOT-$T)\"")
157DEFINES += $(if $(CRT-$T),-DCONFIG_TCC_CRTPREFIX="\"$(CRT-$T)\"")164DEFINES += $(if $(CRT-$T),-DCONFIG_TCC_CRTPREFIX="\"$(CRT-$T)\"")
@@ -214,7 +221,6 @@ ifeq ($(CONFIG_strip),no) · 56 unmodified lines
214CFLAGS += -g221CFLAGS += -g
215LDFLAGS += -g222LDFLAGS += -g
216else223else
217CONFIG_strip = yes
218ifndef CONFIG_OSX224ifndef CONFIG_OSX
219LDFLAGS += -s225LDFLAGS += -s
220endif226endif
tcc.c+6−3
@@ -157,14 +157,17 @@ static const char version[] = · 156 unmodified lines
157 "C67"157 "C67"
158#elif defined TCC_TARGET_ARM158#elif defined TCC_TARGET_ARM
159 "ARM"159 "ARM"
160# ifdef TCC_ARM_EABI
161 " eabi"
162# ifdef TCC_ARM_HARDFLOAT
163 "hf"
164# endif
165# endif
160#elif defined TCC_TARGET_ARM64166#elif defined TCC_TARGET_ARM64
161 "AArch64"167 "AArch64"
162#elif defined TCC_TARGET_RISCV64168#elif defined TCC_TARGET_RISCV64
163 "riscv64"169 "riscv64"
164#endif170#endif
165#ifdef TCC_ARM_HARDFLOAT
166 " Hard Float"
167#endif
168#ifdef TCC_TARGET_PE171#ifdef TCC_TARGET_PE
169 " Windows"172 " Windows"
170#elif defined(TCC_TARGET_MACHO)173#elif defined(TCC_TARGET_MACHO)
tcc.h+5−5
@@ -191,14 +191,14 @@ extern long double strtold (const char *__nptr, char **__endptr); · 190 unmodified lines
191#if !defined TCC_IS_NATIVE \191#if !defined TCC_IS_NATIVE \
192 || (defined CONFIG_TCC_BACKTRACE && CONFIG_TCC_BACKTRACE==0)192 || (defined CONFIG_TCC_BACKTRACE && CONFIG_TCC_BACKTRACE==0)
193# undef CONFIG_TCC_BACKTRACE193# undef CONFIG_TCC_BACKTRACE
194# undef CONFIG_TCC_BCHECK
195#else194#else
196# define CONFIG_TCC_BACKTRACE 1195# define CONFIG_TCC_BACKTRACE 1 /* enable builtin stack backtraces */
197# if defined CONFIG_TCC_BCHECK && CONFIG_TCC_BCHECK==0196#endif
197
198#if defined CONFIG_TCC_BCHECK && CONFIG_TCC_BCHECK==0
198# undef CONFIG_TCC_BCHECK199# undef CONFIG_TCC_BCHECK
199# else200#else
200# define CONFIG_TCC_BCHECK 1 /* enable bound checking code */201# define CONFIG_TCC_BCHECK 1 /* enable bound checking code */
201# endif
202#endif202#endif
203 203
204#if defined TARGETOS_OpenBSD \204#if defined TARGETOS_OpenBSD \
tccgen.c+2−0
@@ -7750,8 +7750,10 @@ static void init_putv(init_params *p, CType *type, unsigned long c) · 7749 unmodified lines
7750 *(long double*)ptr = vtop->c.ld;7750 *(long double*)ptr = vtop->c.ld;
7751 else if (sizeof(double) == LDOUBLE_SIZE)7751 else if (sizeof(double) == LDOUBLE_SIZE)
7752 *(double *)ptr = (double)vtop->c.ld;7752 *(double *)ptr = (double)vtop->c.ld;
7753#ifndef TCC_CROSS_TEST
7753 else7754 else
7754 tcc_error("can't cross compile long double constants");7755 tcc_error("can't cross compile long double constants");
7756#endif
7755 break;7757 break;
7756#if PTR_SIZE != 87758#if PTR_SIZE != 8
7757 case VT_LLONG:7759 case VT_LLONG:
tests/Makefile+26−9
@@ -276,16 +276,33 @@ asm-c-connect-test: asm-c-connect$(EXESUF) asm-c-connect-sep$(EXESUF) · 275 unmodified lines
276 ./asm-c-connect-sep$(EXESUF) > asm-c-connect.out2 && cat asm-c-connect.out2276 ./asm-c-connect-sep$(EXESUF) > asm-c-connect.out2 && cat asm-c-connect.out2
277 @diff -u asm-c-connect.out1 asm-c-connect.out2 || (echo "error"; exit 1)277 @diff -u asm-c-connect.out1 asm-c-connect.out2 || (echo "error"; exit 1)
278 278
279TCC_YY = $(foreach T,$(TCC_X),$(if $(wildcard $(TOP)/$T-tcc$(EXESUF)),$T))279# quick sanity check for cross-compilers
280 280cross-test : tcctest.c examples/ex3.c
281cross-test :
282 $(if $(strip $(TCC_YY)),\
283 $(MAKE) $(foreach T,$(TCC_YY),cross-$T.test) --no-print-directory,:)
284
285cross-%.test :
286 @echo ------------ $@ ------------281 @echo ------------ $@ ------------
287 $(TOP)/$*-tcc$(EXESUF) -v $(TCCFLAGS-$(if $(findstring win,$*),win,unx))\282 $(foreach T,$(CROSS-TGTS),$(call CROSS-COMPILE,$T))
288 -c $(TOPSRC)/examples/ex3.c283
284CROSS-TGTS = \
285 i386 \
286 i386-win32 \
287 x86_64 \
288 x86_64-win32 \
289 x86_64-osx \
290 x86_64-FreeBSD \
291 x86_64-NetBSD \
292 x86_64-OpenBSD \
293 arm-fpa \
294 arm-eabihf \
295 arm-wince \
296 arm64 \
297 riscv64 \
298 c67
299
300define CROSS-COMPILE
301 @echo " . $(1)"
302 $(TCC) $(DEF-$1) -DTCC_CROSS_TEST -run $(TOPSRC)/tcc.c \
303 -c $(if $(findstring c67,$1),$(filter %/ex3.c,$^),$<) -w $(TCCFLAGS)
304
305endef
289 306
290# targets for development307# targets for development
291%.bin: %.c tcc308%.bin: %.c tcc

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t