From e22249b81c367afc43bbc8029e700964c21900ce Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Mon, 5 Dec 2016 20:58:00 +0000 Subject: Error on unrecognized relocations --- tccelf.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tccelf.c') diff --git a/tccelf.c b/tccelf.c index 7d656e5..7f1679d 100644 --- a/tccelf.c +++ b/tccelf.c @@ -1042,6 +1042,10 @@ ST_FUNC void build_got_entries(TCCState *s1) type = ELFW(R_TYPE)(rel->r_info); sym_index = ELFW(R_SYM)(rel->r_info); sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; + + if (type >= R_NUM || !relocs_info[type].known) + tcc_error("Unknown relocation: %d\n", type); + if (relocs_info[type].gotplt_entry == NO_GOTPLT_ENTRY) continue; -- cgit v1.3.1