[clink] Show undefined symbols

git-svn-id: svn://kolibrios.org@8959 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Magomed Kostoev (mkostoevr) 2021-06-28 18:09:04 +00:00
parent 698dcf1043
commit abe070e442

View File

@ -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++) {