diff options
| author | grischka <grischka> | 2013-02-06 19:01:07 +0100 |
|---|---|---|
| committer | grischka <grischka> | 2013-02-06 19:01:07 +0100 |
| commit | 7a477d70cabe15fa66fd0f32fab5e95841a500e5 (patch) | |
| tree | 93e20aacb3f5ede1dda9ed987fc4558ebc17a9cf /lib | |
| parent | 92024ab07ad8e1c4a05f90add3d3ca7932251016 (diff) | |
| download | tinycc-7a477d70cabe15fa66fd0f32fab5e95841a500e5.tar.gz tinycc-7a477d70cabe15fa66fd0f32fab5e95841a500e5.tar.bz2 | |
lib/Makefile: use CC, add bcheck to libtcc1.a
Also:
- fix "make tcc_p" (profiling version)
- remove old gcc flags:
-mpreferred-stack-boundary=2 -march=i386 -falign-functions=0
- remove test "hello" for Darwin (cannot compile to file)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Makefile | 42 | ||||
| -rw-r--r-- | lib/bcheck.c | 5 |
2 files changed, 26 insertions, 21 deletions
diff --git a/lib/Makefile b/lib/Makefile index 895c4be..9a029d2 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -15,15 +15,15 @@ ifndef TARGET else ifeq ($(ARCH),i386) TARGET = i386 - ifneq ($(TARGETOS),Darwin) - XCC = gcc -O2 -m32 - endif + ifneq ($(TARGETOS),Darwin) + XCC = $(CC) + endif else ifeq ($(ARCH),x86-64) TARGET = x86_64 - ifneq ($(TARGETOS),Darwin) - XCC = gcc -O2 -m64 - endif + ifneq ($(TARGETOS),Darwin) + XCC = $(CC) + endif endif endif endif @@ -38,9 +38,11 @@ cross : $(DIR)/libtcc1.a native : TCC = $(TOP)/tcc$(EXESUF) cross : TCC = $(TOP)/$(TARGET)-tcc$(EXESUF) -I386_O = libtcc1.o alloca86.o alloca86-bt.o +BCHECK_O = bcheck.o + +I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O) X86_64_O = libtcc1.o alloca86_64.o -WIN32_O = $(I386_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.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 ifeq "$(TARGET)" "i386-win32" @@ -58,18 +60,12 @@ else ifeq "$(TARGET)" "i386" OBJ = $(addprefix $(DIR)/,$(I386_O)) TGT = -DTCC_TARGET_I386 - XCC ?= $(TCC) -B$(TOP) -m32 -D_ANSI_SOURCE - ifeq ($(TARGETOS),Darwin) - XAR = $(DIR)/tiny_libmaker$(EXESUF) - endif + XCC ?= $(TCC) -B$(TOP) else ifeq "$(TARGET)" "x86_64" OBJ = $(addprefix $(DIR)/,$(X86_64_O)) TGT = -DTCC_TARGET_X86_64 - XCC ?= $(TCC) -B$(TOP) -m64 -D_ANSI_SOURCE - ifeq ($(TARGETOS),Darwin) - XAR = $(DIR)/tiny_libmaker$(EXESUF) - endif + XCC ?= $(TCC) -B$(TOP) else $(error libtcc1.a not supported on target '$(TARGET)') endif @@ -77,6 +73,14 @@ endif endif endif +XFLAGS = $(CPPFLAGS) $(CFLAGS) $(TGT) + +ifeq ($(TARGETOS),Darwin) + XAR = $(DIR)/tiny_libmaker$(EXESUF) + XFLAGS += -D_ANSI_SOURCE + BCHECK_O = +endif + ifdef XAR AR = $(XAR) endif @@ -84,11 +88,11 @@ endif $(DIR)/libtcc1.a ../libtcc1.a : $(OBJ) $(XAR) $(AR) rcs $@ $(OBJ) $(DIR)/%.o : %.c - $(XCC) -c $< -o $@ $(CPPFLAGS) $(TGT) $(CFLAGS) + $(XCC) -c $< -o $@ $(XFLAGS) $(DIR)/%.o : %.S - $(XCC) -c $< -o $@ $(CPPFLAGS) $(TGT) $(CFLAGS) + $(XCC) -c $< -o $@ $(XFLAGS) $(DIR)/%$(EXESUF) : $(TOP)/win32/tools/%.c - $(CC) -Os -s -w -o $@ $< $(CPPFLAGS) $(TGT) $(CFLAGS) $(LDFLAGS) + $(CC) -Os -s -w -o $@ $< $(XFLAGS) $(LDFLAGS) $(OBJ) $(XAR) : $(DIR)/exists $(DIR)/exists : diff --git a/lib/bcheck.c b/lib/bcheck.c index 998e304..54124b9 100644 --- a/lib/bcheck.c +++ b/lib/bcheck.c @@ -41,7 +41,8 @@ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \ || defined(__DragonFly__) || defined(__dietlibc__) \ - || defined(__UCLIBC__) || defined(__OpenBSD__) || defined(_WIN32) + || defined(__UCLIBC__) || defined(__OpenBSD__) \ + || defined(_WIN32) || defined(TCC_UCLIBC) #warning Bound checking does not support malloc (etc.) in this environment. #undef CONFIG_TCC_MALLOC_HOOKS #undef HAVE_MEMALIGN @@ -377,7 +378,7 @@ void __bound_init(void) size = BOUND_T23_SIZE; mark_invalid(start, size); -#if !defined(__TINYC__) && defined(CONFIG_TCC_MALLOC_HOOKS) +#if defined(CONFIG_TCC_MALLOC_HOOKS) /* malloc zone is also marked invalid. can only use that with * hooks because all libs should use the same malloc. The solution * would be to build a new malloc for tcc. |
