From 80c223b078c0ef2f160c02a4312979529823c275 Mon Sep 17 00:00:00 2001 From: siemargl Date: Mon, 6 Feb 2017 19:46:12 +0000 Subject: [PATCH] fix zero BSS segments git-svn-id: svn://kolibrios.org@6858 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/ktcc/trunk/source/Makefile.kos32 | 2 +- programs/develop/ktcc/trunk/source/tccmeos.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/programs/develop/ktcc/trunk/source/Makefile.kos32 b/programs/develop/ktcc/trunk/source/Makefile.kos32 index 02bfcd62bb..d6bab2577b 100644 --- a/programs/develop/ktcc/trunk/source/Makefile.kos32 +++ b/programs/develop/ktcc/trunk/source/Makefile.kos32 @@ -1,7 +1,7 @@ CC = kos32-gcc LD = kos32-ld -SDK_DIR:= $(abspath ../../../sdk) +SDK_DIR:= $(abspath ../../../contrib/sdk) #gcc 4.8 #LDFLAGS = -static -nostdlib -T $(SDK_DIR)/sources/newlib/static.lds diff --git a/programs/develop/ktcc/trunk/source/tccmeos.c b/programs/develop/ktcc/trunk/source/tccmeos.c index e8d38c68ce..f431955a0a 100644 --- a/programs/develop/ktcc/trunk/source/tccmeos.c +++ b/programs/develop/ktcc/trunk/source/tccmeos.c @@ -274,7 +274,14 @@ int tcc_output_me(TCCState* s1,const char *filename) for (si=me.data_sections;si;si=si->next) fwrite(si->data,1,si->data_size,f); for (si=me.bss_sections;si;si=si->next) - fwrite(si->data,1,si->data_size,f); + { + if (si->data == NULL) + { +// printf("\nError! BSS data is NULL! size:%i",(int)si->data_size); + si->data = calloc(si->data_size, 1); + } + fwrite(si->data, 1, si->data_size, f); + } /* if (me.bss_sections) // Siemargl testin, what we lose {