diff --git a/contrib/sdk/sources/newlib/libc/Makefile b/contrib/sdk/sources/newlib/libc/Makefile index 72628e415f..43505b8673 100644 --- a/contrib/sdk/sources/newlib/libc/Makefile +++ b/contrib/sdk/sources/newlib/libc/Makefile @@ -553,6 +553,7 @@ ifeq ($(findstring static,$(MAKECMDGOALS)),static) LIB_SRCS:= $(STATIC_SRCS) LIB_OBJS:= $(STATIC_OBJS) +CFLAGS += -DSTATIC_LIBC else @@ -582,9 +583,9 @@ shared: $(NAME).dll libdll.a $(NAME).dll: $(LIB_OBJS) $(SRC_DEP) Makefile $(LD) $(LDFLAGS) $(LIBPATH) -o $@ $(LIB_OBJS) -lgcc --version-script libc.ver - #sed -e "s/ @[^ ]*//" libc.orig.def > libc.def - #sed -f cmd2.sed libc.def > mem - #sed -f newlib.sed mem > libc.inc +#sed -e "s/ @[^ ]*//" libc.orig.def > libc.def +#sed -f cmd2.sed libc.def > mem +#sed -f newlib.sed mem > libc.inc install: libc.dll libc.dll.a libdll.a mv -f libc.dll $(SDK_DIR)/bin @@ -667,6 +668,9 @@ time/wcsftime.o: time/strftime.c %.o : %.c Makefile $(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< +%.o : %.S Makefile + $(CC) $(CFLAGS) $(DEFINES) $(INCLUDES) -o $@ $< + clean: -rm -f */*.o diff --git a/contrib/sdk/sources/newlib/libc/sys/open.c b/contrib/sdk/sources/newlib/libc/sys/open.c index 8aa4ad58cf..60158b820a 100644 --- a/contrib/sdk/sources/newlib/libc/sys/open.c +++ b/contrib/sdk/sources/newlib/libc/sys/open.c @@ -115,6 +115,7 @@ int open (const char * filename, int flags, ...) if(hid < 0) { errno = EMFILE; + __io_free(hid); return (-1); }; @@ -136,6 +137,7 @@ int open (const char * filename, int flags, ...) if( !err ) { errno = EEXIST; + __io_free(hid); return (-1); }; } @@ -147,6 +149,7 @@ int open (const char * filename, int flags, ...) if( err ) { errno = EACCES; + __io_free(hid); return -1; }; }; diff --git a/contrib/sdk/sources/newlib/static.lds b/contrib/sdk/sources/newlib/static.lds index a7d1f2c3c5..7975aaba06 100644 --- a/contrib/sdk/sources/newlib/static.lds +++ b/contrib/sdk/sources/newlib/static.lds @@ -9,7 +9,7 @@ SECTIONS LONG(0x554e454D); LONG(0x32305445); LONG(1); - LONG(__start); + LONG(__crt_start); LONG(___iend); LONG(___memsize); LONG(___stacktop);