[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] [TIPS] empty test program will crash if compiled with
From: |
Sergey Korshunoff |
Subject: |
Re: [Tinycc-devel] [TIPS] empty test program will crash if compiled with -b option |
Date: |
Wed, 25 Mar 2015 18:48:39 +0300 |
Hi! There is no __bound_init() function if program don't have any
bounds to check. There is a test program and tcc patch. Test program
can't be compiled if -b option is used.
int main ()
{
#if 0
// tcc: error: __bound_init not defined
// include v variable definintion to allow a program linking
int v[10];
#endif
return 0;
}
diff -urN tinycc.old/tccelf.c tinycc/tccelf.c
--- tinycc.old/tccelf.c 2015-03-25 18:37:57.000000000 +0300
+++ tinycc/tccelf.c 2015-03-25 18:38:34.000000000 +0300
@@ -1565,6 +1565,8 @@
pinit[0] = 0xe8;
put32(pinit + 1, -4);
sym_index = find_elf_sym(symtab_section, "__bound_init");
+ if (!sym_index)
+ tcc_error("__bound_init not defined");
put_elf_reloc(symtab_section, init_section,
init_section->data_offset - 4, R_386_PC32, sym_index);
}