From 6642abcbb2105b17aaf5d27658f1bf3df7efaf6a Mon Sep 17 00:00:00 2001 From: siemargl <siemargl@kolibrios.org> Date: Tue, 25 Sep 2018 11:52:22 +0000 Subject: [PATCH] tcc lib fix coffload, fwrite git-svn-id: svn://kolibrios.org@7418 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/ktcc/trunk/libc/build.bat | 3 +++ programs/develop/ktcc/trunk/libc/kolibrisys/cofflib.asm | 7 +++++-- programs/develop/ktcc/trunk/libc/stdio/fwrite.c | 8 ++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/programs/develop/ktcc/trunk/libc/build.bat b/programs/develop/ktcc/trunk/libc/build.bat index cc8ef624d3..0d16df02f6 100644 --- a/programs/develop/ktcc/trunk/libc/build.bat +++ b/programs/develop/ktcc/trunk/libc/build.bat @@ -28,12 +28,14 @@ pause goto :eof :Compile_C +echo compile .c %1 %CC% %CFLAGS% %1 -o "%~dpn1.o" if not %errorlevel%==0 goto Error_Failed set objs=%objs% "%~dpn1.o" goto :eof :Compile_Asm +echo compile .asm %1 %ASM% %1 "%~dpn1.o" if not %errorlevel%==0 goto Error_Failed set objs=%objs% "%~dpn1.o" @@ -50,6 +52,7 @@ goto :Exit_OK for %%f in ("%%a\*.asm") do call :Compile_Asm "%%f" for %%f in ("%%a\*.c") do call :Compile_C "%%f" ) + echo calling AR %AR% -ru %LIBNAME% %objs% if not %errorlevel%==0 goto Error_Failed goto Exit_OK diff --git a/programs/develop/ktcc/trunk/libc/kolibrisys/cofflib.asm b/programs/develop/ktcc/trunk/libc/kolibrisys/cofflib.asm index bc3e61edc1..8de57ed061 100644 --- a/programs/develop/ktcc/trunk/libc/kolibrisys/cofflib.asm +++ b/programs/develop/ktcc/trunk/libc/kolibrisys/cofflib.asm @@ -31,8 +31,9 @@ proc _ksys_cofflib_getproc stdcall, export:dword,name:dword xor eax,eax mov al,[ecx] - test al,al - jz exit_check_simbol +; siemargl moved to post-check +; test al,al +; jz exit_check_simbol xor edx,edx mov dl,[esi] @@ -41,6 +42,8 @@ proc _ksys_cofflib_getproc stdcall, export:dword,name:dword add edi,1 jmp exit_check_simbol simbols_equvalent: + test al,al + jz exit_check_simbol ;pushad diff --git a/programs/develop/ktcc/trunk/libc/stdio/fwrite.c b/programs/develop/ktcc/trunk/libc/stdio/fwrite.c index 2235ddabeb..5acd588d08 100644 --- a/programs/develop/ktcc/trunk/libc/stdio/fwrite.c +++ b/programs/develop/ktcc/trunk/libc/stdio/fwrite.c @@ -1,6 +1,8 @@ #include <stdio.h> #include <kolibrisys.h> +// dont support return partial writing when fail +// only 32-bit filesize int fwrite(void *buffer,int size,int count,FILE* file) { dword res; @@ -56,8 +58,7 @@ int fwrite(void *buffer,int size,int count,FILE* file) if (res==0) { file->filepos+=fullsize; - fullsize=fullsize/count; - return(fullsize); + return(count); } else { errno = -res; @@ -70,8 +71,7 @@ int fwrite(void *buffer,int size,int count,FILE* file) if (res==0) { file->filepos+=fullsize; - fullsize=fullsize/count; - return(fullsize); + return(count); } else { errno = -res;