From c5b0697bebf4b0cc5cc78c1e4c471812b423d256 Mon Sep 17 00:00:00 2001 From: turbocat Date: Sat, 1 Jan 2022 16:13:06 +0000 Subject: [PATCH] ktcc: Added autolink libc.def and libtcc1.a git-svn-id: svn://kolibrios.org@9545 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/ktcc/trunk/source/Tupfile.lua | 6 +++--- programs/develop/ktcc/trunk/source/libtcc.c | 5 +++-- programs/develop/ktcc/trunk/source/tcckx.c | 3 --- programs/develop/ktcc/trunk/source/tccmeos.c | 5 +++++ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/programs/develop/ktcc/trunk/source/Tupfile.lua b/programs/develop/ktcc/trunk/source/Tupfile.lua index 46628edb44..2fec825db8 100644 --- a/programs/develop/ktcc/trunk/source/Tupfile.lua +++ b/programs/develop/ktcc/trunk/source/Tupfile.lua @@ -7,6 +7,6 @@ compile_gcc{"tcc.c"} compile_gcc{"libtcc.c"} link_gcc("tcc") --- CFLAGS = " -static -m32 -DTCC_TARGET_MEOS_LINUX " --- tup.rule({"tcc.c", "libtcc.c"}, "gcc" .. CFLAGS .. "%f -o %o" , "kos32-tcc") --- tup.rule({"tcc.c", "libtcc.c"}, "i686-w64-mingw32-gcc" .. CFLAGS .. "%f -o %o" , "kos32-tcc.exe") +CFLAGS = " -static -m32 -DTCC_TARGET_MEOS_LINUX " +tup.rule({"tcc.c", "libtcc.c"}, "gcc" .. CFLAGS .. "%f -o %o" , "kos32-tcc") +tup.rule({"tcc.c", "libtcc.c"}, "i686-w64-mingw32-gcc" .. CFLAGS .. "%f -o %o" , "kos32-tcc.exe") diff --git a/programs/develop/ktcc/trunk/source/libtcc.c b/programs/develop/ktcc/trunk/source/libtcc.c index a3310d2397..e810be03e4 100644 --- a/programs/develop/ktcc/trunk/source/libtcc.c +++ b/programs/develop/ktcc/trunk/source/libtcc.c @@ -175,7 +175,7 @@ static void tcc_set_lib_path_linux(TCCState *s) char buff[4096+1]; readlink("/proc/self/exe", buff, 4096); #ifdef TCC_TARGET_KX - kx_fix_root_directory(buff, sizeof buff); + kx_fix_root_directory(buff, sizeof buff); const char *path = buff; #else const char *path = dirname(buff); @@ -1746,7 +1746,8 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) if (s->output_type != TCC_OUTPUT_OBJ && !s->nostdlib) { tcc_add_crt(s,"crt0.o"); - //tcc_add_library(s,"lc.obj"); // adding libck.a dont work, because need to be added last + tcc_add_library_err(s, "c"); + tcc_add_library_err(s, "tcc1"); } #else /* add libc crt1/crti objects */ diff --git a/programs/develop/ktcc/trunk/source/tcckx.c b/programs/develop/ktcc/trunk/source/tcckx.c index 556a896169..59f21a49b9 100644 --- a/programs/develop/ktcc/trunk/source/tcckx.c +++ b/programs/develop/ktcc/trunk/source/tcckx.c @@ -269,11 +269,8 @@ typedef struct { tcc_free(str_arr); tcc_free(len_arr); tcc_free(sym_arr); - } - - void kx_init(me_info* me) { ElfW(Sym) *sym; int sym_index = 1, sym_end = symtab_section->data_offset / sizeof(ElfW(Sym)); diff --git a/programs/develop/ktcc/trunk/source/tccmeos.c b/programs/develop/ktcc/trunk/source/tccmeos.c index 8cd6e4ba78..92858253e6 100644 --- a/programs/develop/ktcc/trunk/source/tccmeos.c +++ b/programs/develop/ktcc/trunk/source/tccmeos.c @@ -302,8 +302,13 @@ int tcc_output_me(TCCState* s1,const char *filename) #ifdef TCC_TARGET_KX kx_init(&me); #endif + if (s1->output_type != TCC_OUTPUT_OBJ && !s1->nostdlib){ + tcc_add_library_err(s1, "tcc1"); + } + relocate_common_syms(); assign_addresses(&me); + #ifndef TCC_TARGET_KX if(undef_sym_flag){ tcc_error("Linker error!");