mirror of
https://github.com/frida/tinycc
synced 2024-12-25 06:26:49 +03:00
Fix gcc10 warnings
i386-gen.c: - load/gen_opf: set v1.sym to NULL lib/Makefile: - Add -gstabs -fno-omit-frame-pointer -Wno-unused-function -Wno-unused-variable lib/bt-log.c: - tcc_backtrace: Prevent __builtin_frame_address warning tccgen.c: - struct_layout: Set t.t to VT_BYTE - default_debug: Use octal instead of -1 to make size_t work tccpp.c: - tal_realloc_impl: Only memcpy when p set x86_64-gen.c: - gen_bounds_epilog: Do not save/restore rcx (not caller/callee saved) This also made stack not aligned to 16 bytes.
This commit is contained in:
parent
b5b92c7d6d
commit
045632defb
@ -230,6 +230,7 @@ ST_FUNC void load(int r, SValue *sv)
|
||||
v1.type.t = VT_INT;
|
||||
v1.r = VT_LOCAL | VT_LVAL;
|
||||
v1.c.i = fc;
|
||||
v1.sym = NULL;
|
||||
fr = r;
|
||||
if (!(reg_classes[fr] & RC_INT))
|
||||
fr = get_reg(RC_INT);
|
||||
@ -923,6 +924,7 @@ ST_FUNC void gen_opf(int op)
|
||||
v1.type.t = VT_INT;
|
||||
v1.r = VT_LOCAL | VT_LVAL;
|
||||
v1.c.i = fc;
|
||||
v1.sym = NULL;
|
||||
load(r, &v1);
|
||||
fc = 0;
|
||||
}
|
||||
|
@ -17,13 +17,17 @@ XFLAGS = $(XFLAGS$(XCFG)) -I$(TOP)
|
||||
XCFG = $(or $(findstring -win,$T),-unx)
|
||||
S = $(if $(findstring yes,$(SILENT)),@$(info * $@))
|
||||
|
||||
# in order to use gcc, tyoe: make <target>-libtcc1-usegcc=yes
|
||||
# in order to use gcc, type: make <target>-libtcc1-usegcc=yes
|
||||
arm-libtcc1-usegcc ?= no
|
||||
|
||||
# This makes bounds checking 40%..60% faster.
|
||||
#x86_64-libtcc1-usegcc=yes
|
||||
#i386-libtcc1-usegcc=yes
|
||||
|
||||
ifeq "$($(T)-libtcc1-usegcc)" "yes"
|
||||
XCC = $(CC)
|
||||
XAR = $(AR)
|
||||
XFLAGS = $(CFLAGS) -fPIC
|
||||
XFLAGS = $(CFLAGS) -fPIC -gstabs -fno-omit-frame-pointer -Wno-unused-function -Wno-unused-variable
|
||||
endif
|
||||
|
||||
# only for native compiler
|
||||
|
13
lib/bt-log.c
13
lib/bt-log.c
@ -13,6 +13,15 @@ int (*__rt_error)(void*, void*, const char *, va_list);
|
||||
# define DLL_EXPORT
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 6)
|
||||
/*
|
||||
* At least gcc 6.2 complains when __builtin_frame_address is used with
|
||||
* nonzero argument.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wframe-address"
|
||||
#endif
|
||||
|
||||
DLL_EXPORT int tcc_backtrace(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@ -35,3 +44,7 @@ DLL_EXPORT int tcc_backtrace(const char *fmt, ...)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 6)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
6
tccgen.c
6
tccgen.c
@ -140,12 +140,13 @@ static const struct {
|
||||
#if LONG_SIZE == 4
|
||||
{ VT_LONG | VT_INT | VT_UNSIGNED, "long unsigned int:t5=r5;0;4294967295;", },
|
||||
#else
|
||||
{ VT_LLONG | VT_LONG | VT_UNSIGNED, "long unsigned int:t5=r5;0;-1;", },
|
||||
/* use octal instead of -1 so size_t works (-gstabs+ in gcc) */
|
||||
{ VT_LLONG | VT_LONG | VT_UNSIGNED, "long unsigned int:t5=r5;0;01777777777777777777777;", },
|
||||
#endif
|
||||
{ VT_QLONG, "__int128:t6=r6;0;-1;", },
|
||||
{ VT_QLONG | VT_UNSIGNED, "__int128 unsigned:t7=r7;0;-1;", },
|
||||
{ VT_LLONG, "long long int:t8=r8;-9223372036854775808;9223372036854775807;", },
|
||||
{ VT_LLONG | VT_UNSIGNED, "long long unsigned int:t9=r9;0;-1;", },
|
||||
{ VT_LLONG | VT_UNSIGNED, "long long unsigned int:t9=r9;0;01777777777777777777777;", },
|
||||
{ VT_SHORT, "short int:t10=r10;-32768;32767;", },
|
||||
{ VT_SHORT | VT_UNSIGNED, "short unsigned int:t11=r11;0;65535;", },
|
||||
{ VT_BYTE | VT_DEFSIGN, "signed char:t12=r12;-128;127;", },
|
||||
@ -4424,6 +4425,7 @@ static void struct_layout(CType *type, AttributeDef *ad)
|
||||
|
||||
/* try to access the field using a different type */
|
||||
c0 = -1, s = align = 1;
|
||||
t.t = VT_BYTE;
|
||||
for (;;) {
|
||||
px = f->c * 8 + bit_pos;
|
||||
cx = (px >> 3) & -align;
|
||||
|
6
tccpp.c
6
tccpp.c
@ -261,7 +261,7 @@ tail_call:
|
||||
al->p += adj_size + sizeof(tal_header_t);
|
||||
if (is_own) {
|
||||
header = (((tal_header_t *)p) - 1);
|
||||
memcpy(ret, p, header->size);
|
||||
if (p) memcpy(ret, p, header->size);
|
||||
#ifdef TAL_DEBUG
|
||||
header->line_num = -header->line_num;
|
||||
#endif
|
||||
@ -280,7 +280,7 @@ tail_call:
|
||||
al->nb_allocs--;
|
||||
ret = tal_realloc(*pal, 0, size);
|
||||
header = (((tal_header_t *)p) - 1);
|
||||
memcpy(ret, p, header->size);
|
||||
if (p) memcpy(ret, p, header->size);
|
||||
#ifdef TAL_DEBUG
|
||||
header->line_num = -header->line_num;
|
||||
#endif
|
||||
@ -301,7 +301,7 @@ tail_call:
|
||||
al->nb_allocs--;
|
||||
ret = tcc_malloc(size);
|
||||
header = (((tal_header_t *)p) - 1);
|
||||
memcpy(ret, p, header->size);
|
||||
if (p) memcpy(ret, p, header->size);
|
||||
#ifdef TAL_DEBUG
|
||||
header->line_num = -header->line_num;
|
||||
#endif
|
||||
|
@ -758,12 +758,12 @@ static void gen_bounds_epilog(void)
|
||||
ind = saved_ind;
|
||||
|
||||
/* generate bound check local freeing */
|
||||
o(0x525051); /* save returned value, if any (+ scratch-space for windows) */
|
||||
o(0x5250); /* save returned value, if any */
|
||||
greloca(cur_text_section, sym_data, ind + 2, R_X86_64_64, 0);
|
||||
o(0xb848 + TREG_FASTCALL_1 * 0x100); /* mov xxx, %rcx/di */
|
||||
gen_le64 (0);
|
||||
gen_bounds_call(TOK___bound_local_delete);
|
||||
o(0x59585a); /* restore returned value, if any */
|
||||
o(0x585a); /* restore returned value, if any */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user