From 9396efe6cd42ab72246e30be2f8ff4608bed88b8 Mon Sep 17 00:00:00 2001 From: turbocat Date: Wed, 9 Jun 2021 03:07:04 +0000 Subject: [PATCH] KTCC Now KTCC gives the error "Linker error!" if the symbol was not found. (Previously KTCC ignored these messages and generated an incorrect binary). git-svn-id: svn://kolibrios.org@8786 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/ktcc/trunk/source/tccmeos.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/programs/develop/ktcc/trunk/source/tccmeos.c b/programs/develop/ktcc/trunk/source/tccmeos.c index d7efe46b28..70283fd3c0 100644 --- a/programs/develop/ktcc/trunk/source/tccmeos.c +++ b/programs/develop/ktcc/trunk/source/tccmeos.c @@ -18,6 +18,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +int undef_sym_flag=0; + typedef struct { char magic[8]; int version; @@ -101,8 +103,9 @@ void build_reloc(me_info* me) ss=findsection(me,sect); if (ss==0) { - const char *sym_name = strtab_section->data + esym->st_name; - tcc_error_noabort("undefined symbol '%s'", sym_name); + const char *sym_name = strtab_section->data + esym->st_name; + undef_sym_flag=1; + tcc_error_noabort("undefined symbol '%s'", sym_name); continue; } if (rel->r_offset>s->data_size) @@ -252,7 +255,11 @@ int tcc_output_me(TCCState* s1,const char *filename) me.s1=s1; relocate_common_syms(); assign_addresses(&me); - + + if(undef_sym_flag){ + tcc_error("Linker error!"); + } + if (s1->do_debug) tcc_output_dbgme(filename, &me);