From 557b4a1f6ddbd4ff26d2587e13b4e860f421aec4 Mon Sep 17 00:00:00 2001 From: grischka Date: Tue, 26 Jan 2021 16:51:20 +0100 Subject: [PATCH] configure chmod 755 etc. lib/tcov.c: - can't be cross-compiled (needs stdio.h) - can be included in libtcc1.a Reason why bt-xxx.o/bcheck.o are linked separatly is because we don't want then to linked into exe's and dlls at the same time. --- Makefile | 5 ++--- c67-gen.c | 2 ++ configure | 0 lib/Makefile | 2 +- lib/bcheck.c | 4 ++++ lib/bt-exe.c | 5 ----- tccelf.c | 2 -- tccgen.c | 6 ++++++ tccpe.c | 4 +--- tests/tests2/96_nodata_wanted.c | 6 +++++- 10 files changed, 21 insertions(+), 15 deletions(-) mode change 100644 => 100755 configure diff --git a/Makefile b/Makefile index 68710395..76a77713 100644 --- a/Makefile +++ b/Makefile @@ -334,12 +334,11 @@ IR = $(IM) mkdir -p $2 && cp -r $1/. $2 IM = $(info -> $2 : $1)@ B_O = bcheck.o bt-exe.o bt-log.o bt-dll.o -T_O = tcov.o # install progs & libs install-unx: $(call IBw,$(PROGS) $(PROGS_CROSS),"$(bindir)") - $(call IFw,$(LIBTCC1) $(B_O) $(T_O) $(LIBTCC1_U),"$(tccdir)") + $(call IFw,$(LIBTCC1) $(B_O) $(LIBTCC1_U),"$(tccdir)") $(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/include") $(call $(if $(findstring .so,$(LIBTCC)),IBw,IFw),$(LIBTCC),"$(libdir)") $(call IF,$(TOPSRC)/libtcc.h,"$(includedir)") @@ -364,7 +363,7 @@ uninstall-unx: install-win: $(call IBw,$(PROGS) $(PROGS_CROSS) $(subst libtcc.a,,$(LIBTCC)),"$(bindir)") $(call IF,$(TOPSRC)/win32/lib/*.def,"$(tccdir)/lib") - $(call IFw,libtcc1.a $(B_O) $(T_O) $(LIBTCC1_W),"$(tccdir)/lib") + $(call IFw,libtcc1.a $(B_O) $(LIBTCC1_W),"$(tccdir)/lib") $(call IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/include") $(call IR,$(TOPSRC)/win32/include,"$(tccdir)/include") $(call IR,$(TOPSRC)/win32/examples,"$(tccdir)/examples") diff --git a/c67-gen.c b/c67-gen.c index a1c1476c..6ebe7181 100644 --- a/c67-gen.c +++ b/c67-gen.c @@ -108,6 +108,8 @@ enum { /* maximum alignment (for aligned attribute support) */ #define MAX_ALIGN 8 +#undef CONFIG_TCC_BCHECK + /******************************************************/ #else /* ! TARGET_DEFS_ONLY */ /******************************************************/ diff --git a/configure b/configure old mode 100644 new mode 100755 diff --git a/lib/Makefile b/lib/Makefile index 458bdb62..1def8ccf 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -38,6 +38,7 @@ endif $(X)BT_O = bt-exe.o bt-log.o $(X)B_O = $(BCHECK_O) bt-exe.o bt-log.o bt-dll.o endif +$(X)BT_O += tcov.o DSO_O = dsohandle.o @@ -64,7 +65,6 @@ OBJ-arm-wince = $(ARM_O) $(WIN_O) OBJ-riscv64 = $(RISCV64_O) $(BCHECK_O) $(DSO_O) OBJ-extra = $(filter $(B_O),$(OBJ-$T)) -OBJ-extra += tcov.o OBJ-libtcc1 = $(addprefix $(X),$(filter-out $(OBJ-extra),$(OBJ-$T))) ALL = $(addprefix $(TOP)/,$(X)libtcc1.a $(OBJ-extra)) diff --git a/lib/bcheck.c b/lib/bcheck.c index b512ef62..0379b6ed 100644 --- a/lib/bcheck.c +++ b/lib/bcheck.c @@ -1367,6 +1367,10 @@ int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) dprintf (stderr, "%s, %s() %d %p %p\n", __FILE__, __FUNCTION__, signum, act, oldact); + + if (sigaction_redir == NULL) + __bound_init(0,-1); + if (act) { nact = *act; if (nact.sa_flags & SA_SIGINFO) diff --git a/lib/bt-exe.c b/lib/bt-exe.c index 16ce9c72..f0e494d4 100644 --- a/lib/bt-exe.c +++ b/lib/bt-exe.c @@ -18,11 +18,6 @@ void __bt_init(rt_context *p, int num_callers) __attribute__((weak)) void __bound_init(void*, int); struct rt_context *rc = &g_rtctxt; //fprintf(stderr, "__bt_init %d %p %p\n", num_callers, p->stab_sym, p->bounds_start), fflush(stderr); -#ifdef __APPLE__ - /* call __bound_init here due to redirection of sigaction */ - if (__bound_init && p->bounds_start) - __bound_init(p->bounds_start, 0); -#endif if (num_callers) { memcpy(rc, p, offsetof(rt_context, next)); rc->num_callers = num_callers - 1; diff --git a/tccelf.c b/tccelf.c index 2b73d72a..d3b1f3cb 100644 --- a/tccelf.c +++ b/tccelf.c @@ -1479,8 +1479,6 @@ ST_FUNC void tcc_add_runtime(TCCState *s1) if (!s1->nostdlib) { if (s1->option_pthread) tcc_add_library_err(s1, "pthread"); - if (s1->test_coverage) - tcc_add_support(s1, "tcov.o"); tcc_add_library_err(s1, "c"); #ifdef TCC_LIBGCC if (!s1->static_link) { diff --git a/tccgen.c b/tccgen.c index 93ae3ab6..1f1af709 100644 --- a/tccgen.c +++ b/tccgen.c @@ -2949,6 +2949,12 @@ static void gen_opic(int op) #if defined TCC_TARGET_X86_64 || defined TCC_TARGET_I386 # define gen_negf gen_opf +#elif defined TCC_TARGET_ARM +void gen_negf(int op) +{ + /* arm will detect 0-x and replace by vneg */ + vpushi(0), vswap(), gen_op('-'); +} #else /* XXX: implement in gen_opf() for other backends too */ void gen_negf(int op) diff --git a/tccpe.c b/tccpe.c index 0df09919..161e85ca 100644 --- a/tccpe.c +++ b/tccpe.c @@ -1915,10 +1915,8 @@ static void pe_add_runtime(TCCState *s1, struct pe_info *pe) tcc_add_btstub(s1); } #endif - if (s1->test_coverage) { - tcc_add_support(s1, "tcov.o"); + if (s1->test_coverage) tcc_add_tcov(s1); - } /* grab the startup code from libtcc1.a */ #ifdef TCC_IS_NATIVE diff --git a/tests/tests2/96_nodata_wanted.c b/tests/tests2/96_nodata_wanted.c index 790b4313..1a4cd334 100644 --- a/tests/tests2/96_nodata_wanted.c +++ b/tests/tests2/96_nodata_wanted.c @@ -58,7 +58,11 @@ ts1:; void *p = (void*)&main; char cc[] = "static string"; double d = 8.0; - struct __attribute__((packed)) { + struct +#ifndef __arm__ + __attribute__((packed)) +#endif + { unsigned x : 12; unsigned char y : 7; unsigned z : 28, a: 4, b: 5;