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"}
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")

View File

@ -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 */

View File

@ -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));

View File

@ -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!");