aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2016-12-05 20:58:00 +0000
committerThomas Preud'homme <robotux@celest.fr>2016-12-05 20:58:00 +0000
commite22249b81c367afc43bbc8029e700964c21900ce (patch)
tree0c8ba96d8e55d78ab29f0f58b3dbcb3ba0b57c6b /tccelf.c
parent557c5c1f11d592b68573bea4acebddc183292cfc (diff)
downloadtinycc-e22249b81c367afc43bbc8029e700964c21900ce.tar.gz
tinycc-e22249b81c367afc43bbc8029e700964c21900ce.tar.bz2
Error on unrecognized relocations
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c4
1 files changed, 4 insertions, 0 deletions
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;