From abe070e4421de3e7323e51e914c8e07badfee0fe Mon Sep 17 00:00:00 2001 From: "Magomed Kostoev (mkostoevr)" Date: Mon, 28 Jun 2021 18:09:04 +0000 Subject: [PATCH] [clink] Show undefined symbols git-svn-id: svn://kolibrios.org@8959 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/clink/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/programs/develop/clink/main.c b/programs/develop/clink/main.c index 21201d7182..1123e0daf1 100644 --- a/programs/develop/clink/main.c +++ b/programs/develop/clink/main.c @@ -273,6 +273,8 @@ static void build(ObjectIr *ir) { printf("}\n"); // COFF Relocations + char **undefined_symbols = cvec_pchar_new(8); + printf("Writing COFF Relocations {\n"); for (size_t sec_i = 0; sec_i < cvec_pchar_size(&ir->section_names_set); sec_i++) { char *name = ir->section_names_set[sec_i]; @@ -335,8 +337,7 @@ static void build(ObjectIr *ir) { Symbol old_sym = cdict_CStr_Symbol_get_v(&ir->symtab, name); if (old_sym.name == NULL) { - printf("Internal error: Symbol of %s relocation not found", name); - exit(-1); + add_name_to_set(strdup(name), &undefined_symbols); } rel.SymbolTableIndex = old_sym.index; @@ -350,6 +351,14 @@ static void build(ObjectIr *ir) { } printf("}\n"); + if (cvec_pchar_size(&undefined_symbols) > 0) { + printf("Undefined symbols found, aborting\nUndefined:\n"); + for (int i = 0; i < cvec_pchar_size(&undefined_symbols); i++) { + printf("%s\n", undefined_symbols[i]); + } + exit(-1); + } + // Symbols Table printf("Writing symbols {\n"); for (size_t sym_i = 0; sym_i < cvec_pchar_size(&ir->sym_name_set); sym_i++) {