aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
authorseyko <seyko2@gmail.com>2015-03-28 19:41:01 +0300
committerseyko <seyko2@gmail.com>2015-03-28 19:41:01 +0300
commitf2cfc07554c698dcd2f12dab223aece4d40198c2 (patch)
tree5c82cbbab7f478b43b2b051ed5415966b0b464a6 /tccelf.c
parent3b7f5008fdacf3c4b9e7329b64ab75741dcf5370 (diff)
downloadtinycc-f2cfc07554c698dcd2f12dab223aece4d40198c2.tar.gz
tinycc-f2cfc07554c698dcd2f12dab223aece4d40198c2.tar.bz2
fix: try to add a bounds.o only if __bounds_init not found
/usr/local/lib/tcc/i386/bcheck.o: error: '__bound_error_msg' defined twice #include <stdio.h> int main () { #if 1 int v[10]; v[10] = 0; fprintf(stderr, "is bounds error catched?\n"); #endif return 0; } // tcc -b test.c
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tccelf.c b/tccelf.c
index bd2c147..0ac151a 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1589,10 +1589,13 @@ ST_FUNC void tcc_add_bcheck(TCCState *s1)
pinit = section_ptr_add(init_section, 5);
pinit[0] = 0xe8;
put32(pinit + 1, -4);
- tcc_add_support(s1, "bcheck.o");
sym_index = find_elf_sym(symtab_section, "__bound_init");
- if (!sym_index)
- tcc_error("__bound_init not defined");
+ if (!sym_index) {
+ tcc_add_support(s1, "bcheck.o");
+ 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);
}