diff --git a/contrib/kolibri-libc/linuxtools/mkexp b/contrib/kolibri-libc/linuxtools/mkexp new file mode 100755 index 0000000000..845c195766 Binary files /dev/null and b/contrib/kolibri-libc/linuxtools/mkexp differ diff --git a/contrib/kolibri-libc/linuxtools/mkexp.c b/contrib/kolibri-libc/linuxtools/mkexp.c index 59906f09f8..6bb82d104d 100755 --- a/contrib/kolibri-libc/linuxtools/mkexp.c +++ b/contrib/kolibri-libc/linuxtools/mkexp.c @@ -25,19 +25,18 @@ int main(int argc, char** argv) { "#include \n" \ "#include \n" \ "#include \n" \ + "#include \n" \ "#include \n\n" \ "ksys_coff_etable_t EXPORTS[] = {\n"); // Generate char symbol[256]; while(fscanf(input, "%s", symbol) != EOF) { - strcat(buf, "\t{"); - strcat(buf, symbol); - strcat(buf, ", \""); - strcat(buf, symbol); - strcat(buf, "\"},\n"); + char temp[256]; + sprintf(temp, "{\"%s\", %s},\n", symbol, symbol); + strcat(buf, temp); } - strcat(buf, "\t0\n};"); + strcat(buf, "NULL,\n};"); fclose(input); // Output generated diff --git a/contrib/kolibri-libc/source/Makefile b/contrib/kolibri-libc/source/Makefile index 66ad741407..f7d5917c60 100644 --- a/contrib/kolibri-libc/source/Makefile +++ b/contrib/kolibri-libc/source/Makefile @@ -1,5 +1,6 @@ AR = ar -rcs CLINK = ../linuxtools/clink +MKEXP = ../linuxtools/mkexp KPACK = kpack INCLUDE = include @@ -27,7 +28,7 @@ RM = rm -rf MKDIR_P = mkdir -p endif -all: $(cfiles) $(asmfiles) $(LIB_DIR) $(LIBC.A) +all: mk_export $(cfiles) $(asmfiles) $(LIB_DIR) $(LIBC.A) fasm crt/crt0.asm $(LIB_DIR)/crt0.o $(LIBC.A): $(cfiles) $(asmfiles) @@ -45,11 +46,16 @@ clean: $(RM) $(cfiles) $(asmfiles) $(RM) $(LIBNAME) +mk_export: + $(MKEXP) ../loader/symbols.txt exports/exports.c + + shared: $(cfiles) $(asmfiles) $(CLINK) $^ $(KPACK) a.out.obj mv a.out.obj $(LIBC.OBJ) + test: make -C ../test -f Makefile.tcc kex ../test/test diff --git a/contrib/kolibri-libc/source/exports/exports.c b/contrib/kolibri-libc/source/exports/exports.c deleted file mode 100644 index 4b5579da7a..0000000000 --- a/contrib/kolibri-libc/source/exports/exports.c +++ /dev/null @@ -1,130 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -ksys_coff_etable_t EXPORTS[] = { - {"abs", abs}, - {"acos", acos}, - {"acosh", acosh}, - {"asin", asin}, - {"asinh", asinh}, - {"atan", atan}, - {"atan2", atan2}, - {"atanh", atanh}, - {"atoi", atoi}, - {"atol", atol}, - {"atoll", atoll}, - {"calloc", calloc}, - {"ceil", ceil}, - {"clearerr", clearerr}, - {"closedir", closedir}, - {"cos", cos}, - {"cosh", cosh}, - {"debug_printf", debug_printf}, - {"difftime", difftime}, - {"div", div}, - {"exit", exit}, - {"exp", exp}, - {"fabs", fabs}, - {"fclose", fclose}, - {"feof", feof}, - {"ferror", ferror}, - {"fflush", fflush}, - {"fgetc", fgetc}, - {"fgetpos", fgetpos}, - {"fgets", fgets}, - {"floor", floor}, - {"fmod", fmod}, - {"fopen", fopen}, - {"fputc", fputc}, - {"fputs", fputs}, - {"fread", fread}, - {"free", free}, - {"freopen", freopen}, - {"frexp", frexp}, - {"fseek", fseek}, - {"fsetpos", fsetpos}, - {"ftell", ftell}, - {"fwrite", fwrite}, - {"getchar", getchar}, - {"gets", gets}, - {"hypot", hypot}, - {"itoa", itoa}, - {"labs", labs}, - {"ldexp", ldexp}, - {"ldiv", ldiv}, - {"llabs", llabs}, - {"lldiv", lldiv}, - {"localtime", localtime}, - {"log", log}, - {"malloc", malloc}, - {"memccpy", memccpy}, - {"memchr", memchr}, - {"memcmp", memcmp}, - {"memcpy", memcpy}, - {"memmove", memmove}, - {"memset", memset}, - {"mktime", mktime}, - {"modf", modf}, - {"modfl", modfl}, - {"opendir", opendir}, - {"perror", perror}, - {"pow", pow}, - {"pow10", pow10}, - {"pow2", pow2}, - {"printf", printf}, - {"puts", puts}, - {"readdir", readdir}, - {"realloc", realloc}, - {"remove", remove}, - {"rename", rename}, - {"rewind", rewind}, - {"rewinddir", rewinddir}, - {"seekdir", seekdir}, - {"shell_printf", shell_printf}, - {"shell_puts", shell_puts}, - {"shell_putc", shell_putc}, - {"shell_getc", shell_getc}, - {"shell_gets", shell_gets}, - {"shell_cls", shell_cls}, - {"shell_exit", shell_exit}, - {"setbuf", setbuf}, - {"setvbuf", setvbuf}, - {"sin", sin}, - {"sinh", sinh}, - {"snprintf", snprintf}, - {"sprintf", sprintf}, - {"sqrt", sqrt}, - {"strcat", strcat}, - {"strchr", strchr}, - {"strcmp", strcmp}, - {"strcoll", strcoll}, - {"strcpy", strcpy}, - {"strcspn", strcspn}, - {"strerror", strerror}, - {"strlen", strlen}, - {"strncat", strncat}, - {"strncmp", strncmp}, - {"strncpy", strncpy}, - {"strpbrk", strpbrk}, - {"strrchr", strrchr}, - {"strrev", strrev}, - {"strspn", strspn}, - {"strstr", strstr}, - {"strtok", strtok}, - {"strxfrm", strxfrm}, - {"tan", tan}, - {"tanh", tanh}, - {"telldir", telldir}, - {"time", time}, - {"tmpfile", tmpfile}, - {"tmpnam", tmpnam}, - {"vprintf", vprintf}, - {"vsnprintf", vsnprintf}, - 0 -};