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
6262 endif
6363 export MACOSX_DEPLOYMENT_TARGET := 10.6
6464 endif
65+ ifdef CONFIG_BSD
66+ NATIVE_TARGET = $(ARCH)-$(TARGETOS)
67+ endif
6568 endif
6669
6770 # 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
7073 TCCFLAGS = $(TCCFLAGS$(CFG))
7174 TCC = $(TOP)/tcc$(EXESUF) $(TCCFLAGS)
7275
73−# cross compiler targets to build
74−TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
75−TCC_X += riscv64
76−# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
77−
7876 CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE
7977 LIBS_P = $(LIBS)
8078 LDFLAGS_P = $(LDFLAGS)
@@ -99,6 +97,27 @@ NATIVE_DEFINES_no_$(CONFIG_bcheck) += -DCONFIG_TCC_BCHECK=0 · 18 unmodified lines
9997 NATIVE_DEFINES_no_$(CONFIG_backtrace) += -DCONFIG_TCC_BACKTRACE=0
10098 NATIVE_DEFINES += $(NATIVE_DEFINES_yes) $(NATIVE_DEFINES_no_no)
10199
100+DEF-i386 = -DTCC_TARGET_I386
101+DEF-i386-win32 = -DTCC_TARGET_I386 -DTCC_TARGET_PE
102+DEF-x86_64 = -DTCC_TARGET_X86_64
103+DEF-x86_64-win32= -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
104+DEF-x86_64-osx = -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO
105+DEF-arm-fpa = -DTCC_TARGET_ARM
106+DEF-arm-fpa-ld = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12
107+DEF-arm-vfp = -DTCC_TARGET_ARM -DTCC_ARM_VFP
108+DEF-arm-eabi = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI
109+DEF-arm-eabihf = $(DEF-arm-eabi) -DTCC_ARM_HARDFLOAT
110+DEF-arm = $(DEF-arm-eabihf)
111+DEF-arm-wince = $(DEF-arm-eabihf) -DTCC_TARGET_PE
112+DEF-arm64 = -DTCC_TARGET_ARM64
113+DEF-riscv64 = -DTCC_TARGET_RISCV64
114+DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs
115+DEF-x86_64-FreeBSD = $(DEF-x86_64) -DTARGETOS_FreeBSD
116+DEF-x86_64-NetBSD = $(DEF-x86_64) -DTARGETOS_NetBSD
117+DEF-x86_64-OpenBSD = $(DEF-x86_64) -DTARGETOS_OpenBSD
118+
119+DEF-$(NATIVE_TARGET) = $(NATIVE_DEFINES)
120+
102121 ifeq ($(INCLUDED),no)
103122 # --------------------------------------------------------------------------
104123 # running top Makefile
@@ -109,6 +128,11 @@ TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info · 4 unmodified lines
109128
110129 all: $(PROGS) $(TCCLIBS) $(TCCDOCS)
111130
131+# cross compiler targets to build
132+TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
133+TCC_X += riscv64
134+# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
135+
112136 # cross libtcc1.a targets to build
113137 LIBTCC1_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince
114138 LIBTCC1_X += riscv64
@@ -122,7 +146,7 @@ cross: $(LIBTCC1_CROSS) $(PROGS_CROSS) · 7 unmodified lines
122146 # build specific cross compiler & lib
123147 cross-%: %-tcc$(EXESUF) %-libtcc1.a ;
124148
125−install: ; @$(MAKE) --no-print-directory install$(CFG) CONFIG_strip=no
149+install: ; @$(MAKE) --no-print-directory install$(CFG)
126150 install-strip: ; @$(MAKE) --no-print-directory install$(CFG) CONFIG_strip=yes
127151 uninstall: ; @$(MAKE) --no-print-directory uninstall$(CFG)
128152
@@ -135,23 +159,6 @@ endif · 6 unmodified lines
135159 T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown)
136160 X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-)
137161
138−DEF-i386 = -DTCC_TARGET_I386
139−DEF-x86_64 = -DTCC_TARGET_X86_64
140−DEF-i386-win32 = -DTCC_TARGET_PE -DTCC_TARGET_I386
141−DEF-x86_64-win32= -DTCC_TARGET_PE -DTCC_TARGET_X86_64
142−DEF-x86_64-osx = -DTCC_TARGET_MACHO -DTCC_TARGET_X86_64
143−DEF-arm-wince = -DTCC_TARGET_PE -DTCC_TARGET_ARM -DTCC_ARM_EABI -DTCC_ARM_VFP -DTCC_ARM_HARDFLOAT
144−DEF-arm64 = -DTCC_TARGET_ARM64
145−DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs
146−DEF-arm-fpa = -DTCC_TARGET_ARM
147−DEF-arm-fpa-ld = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12
148−DEF-arm-vfp = -DTCC_TARGET_ARM -DTCC_ARM_VFP
149−DEF-arm-eabi = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI
150−DEF-arm-eabihf = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
151−DEF-arm = $(DEF-arm-eabihf)
152−DEF-riscv64 = -DTCC_TARGET_RISCV64
153−DEF-$(NATIVE_TARGET) = $(NATIVE_DEFINES)
154−
155162 DEFINES += $(DEF-$T) $(DEF-all)
156163 DEFINES += $(if $(ROOT-$T),-DCONFIG_SYSROOT="\"$(ROOT-$T)\"")
157164 DEFINES += $(if $(CRT-$T),-DCONFIG_TCC_CRTPREFIX="\"$(CRT-$T)\"")
@@ -214,7 +221,6 @@ ifeq ($(CONFIG_strip),no) · 56 unmodified lines
214221 CFLAGS += -g
215222 LDFLAGS += -g
216223 else
217−CONFIG_strip = yes
218224 ifndef CONFIG_OSX
219225 LDFLAGS += -s
220226 endif
tcc.c+6−3
@@ -157,14 +157,17 @@ static const char version[] = · 156 unmodified lines
157157 "C67"
158158 #elif defined TCC_TARGET_ARM
159159 "ARM"
160+# ifdef TCC_ARM_EABI
161+ " eabi"
162+# ifdef TCC_ARM_HARDFLOAT
163+ "hf"
164+# endif
165+# endif
160166 #elif defined TCC_TARGET_ARM64
161167 "AArch64"
162168 #elif defined TCC_TARGET_RISCV64
163169 "riscv64"
164170 #endif
165−#ifdef TCC_ARM_HARDFLOAT
166− " Hard Float"
167−#endif
168171 #ifdef TCC_TARGET_PE
169172 " Windows"
170173 #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
191191 #if !defined TCC_IS_NATIVE \
192192 || (defined CONFIG_TCC_BACKTRACE && CONFIG_TCC_BACKTRACE==0)
193193 # undef CONFIG_TCC_BACKTRACE
194−# undef CONFIG_TCC_BCHECK
195194 #else
196−# define CONFIG_TCC_BACKTRACE 1
197−# if defined CONFIG_TCC_BCHECK && CONFIG_TCC_BCHECK==0
195+# define CONFIG_TCC_BACKTRACE 1 /* enable builtin stack backtraces */
196+#endif
197+
198+#if defined CONFIG_TCC_BCHECK && CONFIG_TCC_BCHECK==0
198199 # undef CONFIG_TCC_BCHECK
199−# else
200+#else
200201 # define CONFIG_TCC_BCHECK 1 /* enable bound checking code */
201−# endif
202202 #endif
203203
204204 #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
77507750 *(long double*)ptr = vtop->c.ld;
77517751 else if (sizeof(double) == LDOUBLE_SIZE)
77527752 *(double *)ptr = (double)vtop->c.ld;
7753+#ifndef TCC_CROSS_TEST
77537754 else
77547755 tcc_error("can't cross compile long double constants");
7756+#endif
77557757 break;
77567758 #if PTR_SIZE != 8
77577759 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
276276 ./asm-c-connect-sep$(EXESUF) > asm-c-connect.out2 && cat asm-c-connect.out2
277277 @diff -u asm-c-connect.out1 asm-c-connect.out2 || (echo "error"; exit 1)
278278
279−TCC_YY = $(foreach T,$(TCC_X),$(if $(wildcard $(TOP)/$T-tcc$(EXESUF)),$T))
280−
281−cross-test :
282− $(if $(strip $(TCC_YY)),\
283− $(MAKE) $(foreach T,$(TCC_YY),cross-$T.test) --no-print-directory,:)
284−
285−cross-%.test :
279+# quick sanity check for cross-compilers
280+cross-test : tcctest.c examples/ex3.c
286281 @echo ------------ $@ ------------
287− $(TOP)/$*-tcc$(EXESUF) -v $(TCCFLAGS-$(if $(findstring win,$*),win,unx))\
288− -c $(TOPSRC)/examples/ex3.c
282+ $(foreach T,$(CROSS-TGTS),$(call CROSS-COMPILE,$T))
283+
284+CROSS-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+
300+define 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+
305+endef
289306
290307 # targets for development
291308 %.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