ktcc: Added autolink libc.def and libtcc1.a

git-svn-id: svn://kolibrios.org@9545 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2022-01-01 16:13:06 +00:00
parent ed503e101c
commit c5b0697beb
4 changed files with 11 additions and 8 deletions

View File

@ -7,6 +7,6 @@ compile_gcc{"tcc.c"}
compile_gcc{"libtcc.c"} compile_gcc{"libtcc.c"}
link_gcc("tcc") link_gcc("tcc")
-- CFLAGS = " -static -m32 -DTCC_TARGET_MEOS_LINUX " 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"}, "gcc" .. CFLAGS .. "%f -o %o" , "kos32-tcc")
-- tup.rule({"tcc.c", "libtcc.c"}, "i686-w64-mingw32-gcc" .. CFLAGS .. "%f -o %o" , "kos32-tcc.exe") tup.rule({"tcc.c", "libtcc.c"}, "i686-w64-mingw32-gcc" .. CFLAGS .. "%f -o %o" , "kos32-tcc.exe")

View File

@ -1746,7 +1746,8 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
if (s->output_type != TCC_OUTPUT_OBJ && !s->nostdlib) if (s->output_type != TCC_OUTPUT_OBJ && !s->nostdlib)
{ {
tcc_add_crt(s,"crt0.o"); 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 #else
/* add libc crt1/crti objects */ /* add libc crt1/crti objects */

View File

@ -269,11 +269,8 @@ typedef struct {
tcc_free(str_arr); tcc_free(str_arr);
tcc_free(len_arr); tcc_free(len_arr);
tcc_free(sym_arr); tcc_free(sym_arr);
} }
void kx_init(me_info* me) { void kx_init(me_info* me) {
ElfW(Sym) *sym; ElfW(Sym) *sym;
int sym_index = 1, sym_end = symtab_section->data_offset / sizeof(ElfW(Sym)); int sym_index = 1, sym_end = symtab_section->data_offset / sizeof(ElfW(Sym));

View File

@ -302,8 +302,13 @@ int tcc_output_me(TCCState* s1,const char *filename)
#ifdef TCC_TARGET_KX #ifdef TCC_TARGET_KX
kx_init(&me); kx_init(&me);
#endif #endif
if (s1->output_type != TCC_OUTPUT_OBJ && !s1->nostdlib){
tcc_add_library_err(s1, "tcc1");
}
relocate_common_syms(); relocate_common_syms();
assign_addresses(&me); assign_addresses(&me);
#ifndef TCC_TARGET_KX #ifndef TCC_TARGET_KX
if(undef_sym_flag){ if(undef_sym_flag){
tcc_error("Linker error!"); tcc_error("Linker error!");