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.
This commit is contained in:
grischka 2021-01-26 16:51:20 +01:00
parent 25628cffe5
commit 557b4a1f6d
10 changed files with 21 additions and 15 deletions

View file

@ -334,12 +334,11 @@ IR = $(IM) mkdir -p $2 && cp -r $1/. $2
IM = $(info -> $2 : $1)@ IM = $(info -> $2 : $1)@
B_O = bcheck.o bt-exe.o bt-log.o bt-dll.o B_O = bcheck.o bt-exe.o bt-log.o bt-dll.o
T_O = tcov.o
# install progs & libs # install progs & libs
install-unx: install-unx:
$(call IBw,$(PROGS) $(PROGS_CROSS),"$(bindir)") $(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,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/include")
$(call $(if $(findstring .so,$(LIBTCC)),IBw,IFw),$(LIBTCC),"$(libdir)") $(call $(if $(findstring .so,$(LIBTCC)),IBw,IFw),$(LIBTCC),"$(libdir)")
$(call IF,$(TOPSRC)/libtcc.h,"$(includedir)") $(call IF,$(TOPSRC)/libtcc.h,"$(includedir)")
@ -364,7 +363,7 @@ uninstall-unx:
install-win: install-win:
$(call IBw,$(PROGS) $(PROGS_CROSS) $(subst libtcc.a,,$(LIBTCC)),"$(bindir)") $(call IBw,$(PROGS) $(PROGS_CROSS) $(subst libtcc.a,,$(LIBTCC)),"$(bindir)")
$(call IF,$(TOPSRC)/win32/lib/*.def,"$(tccdir)/lib") $(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 IF,$(TOPSRC)/include/*.h $(TOPSRC)/tcclib.h,"$(tccdir)/include")
$(call IR,$(TOPSRC)/win32/include,"$(tccdir)/include") $(call IR,$(TOPSRC)/win32/include,"$(tccdir)/include")
$(call IR,$(TOPSRC)/win32/examples,"$(tccdir)/examples") $(call IR,$(TOPSRC)/win32/examples,"$(tccdir)/examples")

View file

@ -108,6 +108,8 @@ enum {
/* maximum alignment (for aligned attribute support) */ /* maximum alignment (for aligned attribute support) */
#define MAX_ALIGN 8 #define MAX_ALIGN 8
#undef CONFIG_TCC_BCHECK
/******************************************************/ /******************************************************/
#else /* ! TARGET_DEFS_ONLY */ #else /* ! TARGET_DEFS_ONLY */
/******************************************************/ /******************************************************/

0
configure vendored Normal file → Executable file
View file

View file

@ -38,6 +38,7 @@ endif
$(X)BT_O = bt-exe.o bt-log.o $(X)BT_O = bt-exe.o bt-log.o
$(X)B_O = $(BCHECK_O) bt-exe.o bt-log.o bt-dll.o $(X)B_O = $(BCHECK_O) bt-exe.o bt-log.o bt-dll.o
endif endif
$(X)BT_O += tcov.o
DSO_O = dsohandle.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-riscv64 = $(RISCV64_O) $(BCHECK_O) $(DSO_O)
OBJ-extra = $(filter $(B_O),$(OBJ-$T)) OBJ-extra = $(filter $(B_O),$(OBJ-$T))
OBJ-extra += tcov.o
OBJ-libtcc1 = $(addprefix $(X),$(filter-out $(OBJ-extra),$(OBJ-$T))) OBJ-libtcc1 = $(addprefix $(X),$(filter-out $(OBJ-extra),$(OBJ-$T)))
ALL = $(addprefix $(TOP)/,$(X)libtcc1.a $(OBJ-extra)) ALL = $(addprefix $(TOP)/,$(X)libtcc1.a $(OBJ-extra))

View file

@ -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__, dprintf (stderr, "%s, %s() %d %p %p\n", __FILE__, __FUNCTION__,
signum, act, oldact); signum, act, oldact);
if (sigaction_redir == NULL)
__bound_init(0,-1);
if (act) { if (act) {
nact = *act; nact = *act;
if (nact.sa_flags & SA_SIGINFO) if (nact.sa_flags & SA_SIGINFO)

View file

@ -18,11 +18,6 @@ void __bt_init(rt_context *p, int num_callers)
__attribute__((weak)) void __bound_init(void*, int); __attribute__((weak)) void __bound_init(void*, int);
struct rt_context *rc = &g_rtctxt; struct rt_context *rc = &g_rtctxt;
//fprintf(stderr, "__bt_init %d %p %p\n", num_callers, p->stab_sym, p->bounds_start), fflush(stderr); //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) { if (num_callers) {
memcpy(rc, p, offsetof(rt_context, next)); memcpy(rc, p, offsetof(rt_context, next));
rc->num_callers = num_callers - 1; rc->num_callers = num_callers - 1;

View file

@ -1479,8 +1479,6 @@ ST_FUNC void tcc_add_runtime(TCCState *s1)
if (!s1->nostdlib) { if (!s1->nostdlib) {
if (s1->option_pthread) if (s1->option_pthread)
tcc_add_library_err(s1, "pthread"); tcc_add_library_err(s1, "pthread");
if (s1->test_coverage)
tcc_add_support(s1, "tcov.o");
tcc_add_library_err(s1, "c"); tcc_add_library_err(s1, "c");
#ifdef TCC_LIBGCC #ifdef TCC_LIBGCC
if (!s1->static_link) { if (!s1->static_link) {

View file

@ -2949,6 +2949,12 @@ static void gen_opic(int op)
#if defined TCC_TARGET_X86_64 || defined TCC_TARGET_I386 #if defined TCC_TARGET_X86_64 || defined TCC_TARGET_I386
# define gen_negf gen_opf # 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 #else
/* XXX: implement in gen_opf() for other backends too */ /* XXX: implement in gen_opf() for other backends too */
void gen_negf(int op) void gen_negf(int op)

View file

@ -1915,10 +1915,8 @@ static void pe_add_runtime(TCCState *s1, struct pe_info *pe)
tcc_add_btstub(s1); tcc_add_btstub(s1);
} }
#endif #endif
if (s1->test_coverage) { if (s1->test_coverage)
tcc_add_support(s1, "tcov.o");
tcc_add_tcov(s1); tcc_add_tcov(s1);
}
/* grab the startup code from libtcc1.a */ /* grab the startup code from libtcc1.a */
#ifdef TCC_IS_NATIVE #ifdef TCC_IS_NATIVE

View file

@ -58,7 +58,11 @@ ts1:;
void *p = (void*)&main; void *p = (void*)&main;
char cc[] = "static string"; char cc[] = "static string";
double d = 8.0; double d = 8.0;
struct __attribute__((packed)) { struct
#ifndef __arm__
__attribute__((packed))
#endif
{
unsigned x : 12; unsigned x : 12;
unsigned char y : 7; unsigned char y : 7;
unsigned z : 28, a: 4, b: 5; unsigned z : 28, a: 4, b: 5;