From 71c5ce5ced24a5bbd87d7b5415409af340706b1f Mon Sep 17 00:00:00 2001 From: grischka Date: Tue, 20 Dec 2016 18:05:33 +0100 Subject: tests: OOT build fixes etc. tests/Makefile: fix out-of-tree build issues Also: - win64: align(16) MEM_DEBUG user memory on win64 the struct jmp_buf in the TCCState structure which we allocate by tcc_malloc needs alignment 16 because the msvcrt setjmp uses MMX instructions. - libtcc_test.c: win32/64 need __attribute__((dllimport)) for extern data objects - tcctest.c: exclude stuff that gcc does not compile except for relocation_test() the other issues are mostly ASM related. We should probably check GCC versions but I have no idea which mingw/gcc versions support what and which don't. - lib/Makefile: use tcc to compile libtcc1.a (except on arm which needs arm-asm --- lib/Makefile | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'lib/Makefile') diff --git a/lib/Makefile b/lib/Makefile index e61437e..e8aab7f 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -14,16 +14,14 @@ ifndef TARGET else TARGET = i386-win32 endif - # using tcc else ifeq ($(ARCH),i386) TARGET = i386 - XCC = $(CC) # using gcc else ifeq ($(ARCH),x86-64) TARGET = x86_64 - XCC = $(CC) # using gcc else ifeq ($(ARCH),arm) TARGET = arm - XCC = $(CC) # using gcc + # using gcc, need asm + XCC = $(CC) else ifeq ($(ARCH),arm64) TARGET = arm64 endif @@ -44,22 +42,16 @@ ARM_O = libtcc1.o armeabi.o alloca-arm.o ARM64_O = lib-arm64.o WIN32_O = crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o -# build TCC runtime library to contain PIC code, so it can be linked -# into shared libraries -PICFLAGS = -fPIC - ifeq "$(TARGET)" "i386-win32" OBJ = $(addprefix $(DIR)/,$(I386_O) $(WIN32_O)) TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE XCC = $(TCC) -B$(TOPSRC)/win32 -I$(TOPSRC)/include XAR = $(DIR)/tiny_libmaker$(EXESUF) - XFLAGS = $(TGT) else ifeq "$(TARGET)" "x86_64-win32" OBJ = $(addprefix $(DIR)/,$(X86_64_O) $(WIN32_O)) TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE XCC = $(TCC) -B$(TOPSRC)/win32 -I$(TOPSRC)/include XAR = $(DIR)/tiny_libmaker$(EXESUF) - XFLAGS = $(TGT) else ifeq "$(TARGET)" "i386" OBJ = $(addprefix $(DIR)/,$(I386_O)) TGT = -DTCC_TARGET_I386 @@ -80,7 +72,10 @@ else $(error libtcc1.a not supported on target '$(TARGET)') endif -XFLAGS ?= $(CFLAGS) $(PICFLAGS) $(TGT) +XFLAGS = $(TGT) +ifeq "$(XCC)" "$(CC)" + XFLAGS += $(CFLAGS) +endif ifeq ($(TARGETOS),Darwin) XAR = $(DIR)/tiny_libmaker$(EXESUF) -- cgit v1.3.1