mirror of
https://github.com/frida/tinycc
synced 2024-12-24 05:56:49 +03:00
fixes for previous commit
This commit is contained in:
parent
ef42295fe8
commit
2b7cffac74
3
tcc.h
3
tcc.h
@ -150,9 +150,12 @@ extern long double strtold (const char *__nptr, char **__endptr);
|
||||
# elif defined __arm__
|
||||
# define TCC_TARGET_ARM
|
||||
# define TCC_ARM_EABI
|
||||
# define TCC_ARM_VFP
|
||||
# define TCC_ARM_HARDFLOAT
|
||||
# elif defined __aarch64__
|
||||
# define TCC_TARGET_ARM64
|
||||
# elif defined __riscv
|
||||
# define TCC_TARGET_RISCV64
|
||||
# else
|
||||
# define TCC_TARGET_I386
|
||||
# endif
|
||||
|
10
tccelf.c
10
tccelf.c
@ -1359,7 +1359,7 @@ static void set_local_sym(TCCState *s1, const char *name, Section *s, int offset
|
||||
ST_FUNC void tcc_add_btstub(TCCState *s1)
|
||||
{
|
||||
Section *s;
|
||||
int n, o, b;
|
||||
int n, o;
|
||||
CString cstr;
|
||||
|
||||
s = data_section;
|
||||
@ -1372,11 +1372,11 @@ ST_FUNC void tcc_add_btstub(TCCState *s1)
|
||||
/* prog_base */
|
||||
put_elf_reloc(s1->symtab, s, s->data_offset, R_DATA_PTR, 0);
|
||||
section_ptr_add(s, PTR_SIZE);
|
||||
n = 2 * PTR_SIZE, b = 0;
|
||||
n = 2 * PTR_SIZE;
|
||||
#ifdef CONFIG_TCC_BCHECK
|
||||
if (s1->do_bounds_check) {
|
||||
put_ptr(s1, bounds_section, 0);
|
||||
n -= PTR_SIZE, b = 1;
|
||||
n -= PTR_SIZE;
|
||||
}
|
||||
#endif
|
||||
section_ptr_add(s, n);
|
||||
@ -1386,8 +1386,8 @@ ST_FUNC void tcc_add_btstub(TCCState *s1)
|
||||
" extern void __bt_init(),*__rt_info[],__bt_init_dll();"
|
||||
"__attribute__((constructor)) static void __bt_init_rt(){");
|
||||
#ifdef TCC_TARGET_PE
|
||||
if (s1->output_type == TCC_OUTPUT_DLL)
|
||||
cstr_printf(&cstr, "__bt_init_dll(%d);", b);
|
||||
if (s1->output_type == TCC_OUTPUT_DLL)
|
||||
cstr_printf(&cstr, "__bt_init_dll(%d);", s1->do_bounds_check);
|
||||
#endif
|
||||
cstr_printf(&cstr, "__bt_init(__rt_info,%d);}",
|
||||
s1->output_type == TCC_OUTPUT_DLL ? 0 : s1->rt_num_callers + 1);
|
||||
|
12
tccrun.c
12
tccrun.c
@ -161,6 +161,9 @@ LIBTCCAPI int tcc_run(TCCState *s1, int argc, char **argv)
|
||||
rc->esym_start = (ElfW(Sym) *)(symtab_section->data);
|
||||
rc->esym_end = (ElfW(Sym) *)(symtab_section->data + symtab_section->data_offset);
|
||||
rc->elf_str = (char *)symtab_section->link->data;
|
||||
#if PTR_SIZE == 8
|
||||
rc->prog_base = text_section->sh_addr & 0xffffffff00000000ULL;
|
||||
#endif
|
||||
rc->top_func = tcc_get_symbol(s1, "main");
|
||||
rc->num_callers = s1->rt_num_callers;
|
||||
rc->do_jmp = 1;
|
||||
@ -405,11 +408,10 @@ next:
|
||||
if (sym->n_strx == 0) /* end of function */
|
||||
goto rel_pc;
|
||||
abs_pc:
|
||||
if (sizeof sym->n_value < PTR_SIZE) {
|
||||
/* Stab_Sym.n_value is only 32bits */
|
||||
//fprintf(stderr, "pc = %p %p %p\n", pc, rc->prog_base, wanted_pc), fflush(stderr);
|
||||
pc += rc->prog_base;
|
||||
}
|
||||
#if PTR_SIZE == 8
|
||||
/* Stab_Sym.n_value is only 32bits */
|
||||
pc += rc->prog_base;
|
||||
#endif
|
||||
break;
|
||||
rel_pc:
|
||||
pc += func_addr;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* f1()
|
||||
112_backtrace.c:38: at f1: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:43: by main
|
||||
112_backtrace.c:38: at f1: BCHECK: invalid pointer ........, size 0x14 in memmove dest
|
||||
112_backtrace.c:38: at f1: BCHECK: invalid pointer ........, size 0x? in memmove dest
|
||||
112_backtrace.c:43: by main
|
||||
[returns 255]
|
||||
|
||||
@ -33,132 +33,132 @@
|
||||
|
||||
[test_bcheck_100]
|
||||
112_backtrace.c:107: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:107: at main: BCHECK: invalid pointer ........, size 0xa in memcpy dest
|
||||
112_backtrace.c:107: at main: BCHECK: invalid pointer ........, size 0x? in memcpy dest
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_101]
|
||||
112_backtrace.c:109: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:109: at main: BCHECK: invalid pointer ........, size 0xa in memcpy src
|
||||
112_backtrace.c:109: at main: BCHECK: invalid pointer ........, size 0x? in memcpy src
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_102]
|
||||
112_backtrace.c:111: at main: BCHECK: overlapping regions ........(0x4), ........(0x4) in memcpy
|
||||
112_backtrace.c:111: at main: BCHECK: overlapping regions ........(0x?), ........(0x?) in memcpy
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_103]
|
||||
112_backtrace.c:113: at main: BCHECK: overlapping regions ........(0x4), ........(0x4) in memcpy
|
||||
112_backtrace.c:113: at main: BCHECK: overlapping regions ........(0x?), ........(0x?) in memcpy
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_104]
|
||||
112_backtrace.c:115: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:115: at main: BCHECK: invalid pointer ........, size 0xa in memcmp s1
|
||||
112_backtrace.c:115: at main: BCHECK: invalid pointer ........, size 0x? in memcmp s1
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_105]
|
||||
112_backtrace.c:117: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:117: at main: BCHECK: invalid pointer ........, size 0xa in memcmp s2
|
||||
112_backtrace.c:117: at main: BCHECK: invalid pointer ........, size 0x? in memcmp s2
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_106]
|
||||
112_backtrace.c:119: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:119: at main: BCHECK: invalid pointer ........, size 0xa in memmove dest
|
||||
112_backtrace.c:119: at main: BCHECK: invalid pointer ........, size 0x? in memmove dest
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_107]
|
||||
112_backtrace.c:121: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:121: at main: BCHECK: invalid pointer ........, size 0xa in memmove src
|
||||
112_backtrace.c:121: at main: BCHECK: invalid pointer ........, size 0x? in memmove src
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_108]
|
||||
112_backtrace.c:123: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:123: at main: BCHECK: invalid pointer ........, size 0xa in memset
|
||||
112_backtrace.c:123: at main: BCHECK: invalid pointer ........, size 0x? in memset
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_109]
|
||||
112_backtrace.c:125: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:125: at main: BCHECK: invalid pointer ........, size 0xb in strlen
|
||||
112_backtrace.c:125: at main: BCHECK: invalid pointer ........, size 0x? in strlen
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_110]
|
||||
112_backtrace.c:127: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:127: at main: BCHECK: invalid pointer ........, size 0x4 in strcpy dest
|
||||
112_backtrace.c:127: at main: BCHECK: invalid pointer ........, size 0x? in strcpy dest
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_111]
|
||||
112_backtrace.c:129: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:129: at main: BCHECK: invalid pointer ........, size 0x4 in strcpy src
|
||||
112_backtrace.c:129: at main: BCHECK: invalid pointer ........, size 0x? in strcpy src
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_112]
|
||||
112_backtrace.c:131: at main: BCHECK: overlapping regions ........(0x3), ........(0x3) in strcpy
|
||||
112_backtrace.c:131: at main: BCHECK: overlapping regions ........(0x?), ........(0x?) in strcpy
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_113]
|
||||
112_backtrace.c:133: at main: BCHECK: overlapping regions ........(0x4), ........(0x4) in strcpy
|
||||
112_backtrace.c:133: at main: BCHECK: overlapping regions ........(0x?), ........(0x?) in strcpy
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_114]
|
||||
112_backtrace.c:135: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:135: at main: BCHECK: invalid pointer ........, size 0x4 in strncpy dest
|
||||
112_backtrace.c:135: at main: BCHECK: invalid pointer ........, size 0x? in strncpy dest
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_115]
|
||||
112_backtrace.c:137: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:137: at main: BCHECK: invalid pointer ........, size 0x4 in strncpy src
|
||||
112_backtrace.c:137: at main: BCHECK: invalid pointer ........, size 0x? in strncpy src
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_116]
|
||||
112_backtrace.c:139: at main: BCHECK: overlapping regions ........(0x3), ........(0x3) in strncpy
|
||||
112_backtrace.c:139: at main: BCHECK: overlapping regions ........(0x?), ........(0x?) in strncpy
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_117]
|
||||
112_backtrace.c:141: at main: BCHECK: overlapping regions ........(0x4), ........(0x4) in strncpy
|
||||
112_backtrace.c:141: at main: BCHECK: overlapping regions ........(0x?), ........(0x?) in strncpy
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_118]
|
||||
112_backtrace.c:143: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:143: at main: BCHECK: invalid pointer ........, size 0x9 in strcmp s1
|
||||
112_backtrace.c:143: at main: BCHECK: invalid pointer ........, size 0x? in strcmp s1
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_119]
|
||||
112_backtrace.c:145: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:145: at main: BCHECK: invalid pointer ........, size 0x9 in strcmp s2
|
||||
112_backtrace.c:145: at main: BCHECK: invalid pointer ........, size 0x? in strcmp s2
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_120]
|
||||
112_backtrace.c:147: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:147: at main: BCHECK: invalid pointer ........, size 0x6 in strncmp s1
|
||||
112_backtrace.c:147: at main: BCHECK: invalid pointer ........, size 0x? in strncmp s1
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_121]
|
||||
112_backtrace.c:149: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:149: at main: BCHECK: invalid pointer ........, size 0x6 in strncmp s2
|
||||
112_backtrace.c:149: at main: BCHECK: invalid pointer ........, size 0x? in strncmp s2
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_122]
|
||||
112_backtrace.c:151: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:151: at main: BCHECK: invalid pointer ........, size 0x6 in strcat dest
|
||||
112_backtrace.c:151: at main: BCHECK: invalid pointer ........, size 0x? in strcat dest
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_123]
|
||||
112_backtrace.c:153: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:153: at main: BCHECK: invalid pointer ........, size 0x6 in strcat src
|
||||
112_backtrace.c:153: at main: BCHECK: invalid pointer ........, size 0x? in strcat src
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_124]
|
||||
112_backtrace.c:155: at main: BCHECK: overlapping regions ........(0x9), ........(0x6) in strcat
|
||||
112_backtrace.c:155: at main: BCHECK: overlapping regions ........(0x?), ........(0x?) in strcat
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_125]
|
||||
112_backtrace.c:157: at main: BCHECK: overlapping regions ........(0x4), ........(0x4) in strcat
|
||||
112_backtrace.c:157: at main: BCHECK: overlapping regions ........(0x?), ........(0x?) in strcat
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_126]
|
||||
112_backtrace.c:159: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:159: at main: BCHECK: invalid pointer ........, size 0xb in strchr
|
||||
112_backtrace.c:159: at main: BCHECK: invalid pointer ........, size 0x? in strchr
|
||||
[returns 255]
|
||||
|
||||
[test_bcheck_127]
|
||||
112_backtrace.c:161: at main: BCHECK: ........ is outside of the region
|
||||
112_backtrace.c:161: at main: BCHECK: invalid pointer ........, size 0xb in strdup
|
||||
112_backtrace.c:161: at main: BCHECK: invalid pointer ........, size 0x? in strdup
|
||||
[returns 255]
|
||||
|
@ -72,7 +72,7 @@ GEN-ALWAYS =
|
||||
108_constructor.test: NORUN = true
|
||||
|
||||
112_backtrace.test: FLAGS += -dt -b
|
||||
112_backtrace.test: FILTER += -e 's;[0-9A-Fa-fx]\{8,\};........;g'
|
||||
112_backtrace.test: FILTER += -e 's;[0-9A-Fa-fx]\{8,\};........;g' -e 's;0x[0-9A-Fa-f]\+;0x?;g'
|
||||
|
||||
# Filter source directory in warnings/errors (out-of-tree builds)
|
||||
FILTER = 2>&1 | sed -e 's,$(SRC)/,,g'
|
||||
|
Loading…
Reference in New Issue
Block a user