forked from KolibriOS/kolibrios
newlib: remove false dependencies
git-svn-id: svn://kolibrios.org@3593 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ddb6fa98f4
commit
3459b85059
@ -13,122 +13,125 @@ DEFINES:= -D_IEEE_LIBM
|
||||
|
||||
INCLUDES:= -I $(LIBC_INCLUDES)
|
||||
|
||||
AMZ_SRCS:= \
|
||||
AMZ_SRCS:= \
|
||||
crt/crt_amz.S \
|
||||
crt/chkstk.S \
|
||||
crt/exit.S \
|
||||
crt/pseudo-reloc.c \
|
||||
crt/dllstart.c \
|
||||
crt/setjmp.S
|
||||
crt/pseudo-reloc.c \
|
||||
crt/dllstart.c \
|
||||
crt/setjmp.S
|
||||
|
||||
STATIC_SRCS:= \
|
||||
STATIC_SRCS:= \
|
||||
crt/start.S \
|
||||
crt/crt1.c \
|
||||
crt/chkstk.S \
|
||||
crt/crt2.c \
|
||||
crt/chkstk.S \
|
||||
crt/exit.S \
|
||||
crt/setjmp.S
|
||||
crt/setjmp.S
|
||||
|
||||
DLL_SRCS:= \
|
||||
crt/crtdll.c \
|
||||
crt/chkstk.S \
|
||||
crt/exit.S \
|
||||
crt/setjmp.S \
|
||||
pe/loader.c
|
||||
DLL_SRCS:= \
|
||||
crt/crtdll.c \
|
||||
crt/chkstk.S \
|
||||
crt/exit.S \
|
||||
crt/setjmp.S \
|
||||
pe/loader.c
|
||||
|
||||
CORE_SRCS:= \
|
||||
CORE_SRCS:= \
|
||||
argz/buf_findstr.c \
|
||||
argz/envz_get.c \
|
||||
crt/emutls.c \
|
||||
crt/thread.S \
|
||||
crt/tls.S \
|
||||
crt/assert.c \
|
||||
crt/emutls.c \
|
||||
crt/thread.S \
|
||||
crt/tls.S \
|
||||
crt/assert.c \
|
||||
crt/cpu_features.c \
|
||||
ctype/ctype_.c \
|
||||
ctype/isascii.c \
|
||||
ctype/isblank.c \
|
||||
ctype/isalnum.c \
|
||||
ctype/isalpha.c \
|
||||
ctype/iscntrl.c \
|
||||
ctype/isdigit.c \
|
||||
ctype/islower.c \
|
||||
ctype/isupper.c \
|
||||
ctype/isprint.c \
|
||||
ctype/ispunct.c \
|
||||
ctype/isspace.c \
|
||||
ctype/iswctype.c \
|
||||
ctype/iswalnum.c \
|
||||
ctype/iswalpha.c \
|
||||
ctype/iswblank.c \
|
||||
ctype/iswcntrl.c \
|
||||
ctype/iswdigit.c \
|
||||
ctype/iswgraph.c \
|
||||
ctype/iswlower.c \
|
||||
ctype/iswprint.c \
|
||||
ctype/iswpunct.c \
|
||||
ctype/iswspace.c \
|
||||
ctype/iswupper.c \
|
||||
ctype/iswxdigit.c \
|
||||
ctype/isxdigit.c \
|
||||
ctype/isalnum.c \
|
||||
ctype/isalpha.c \
|
||||
ctype/iscntrl.c \
|
||||
ctype/isdigit.c \
|
||||
ctype/islower.c \
|
||||
ctype/isupper.c \
|
||||
ctype/isprint.c \
|
||||
ctype/ispunct.c \
|
||||
ctype/isspace.c \
|
||||
ctype/iswctype.c \
|
||||
ctype/iswalnum.c \
|
||||
ctype/iswalpha.c \
|
||||
ctype/iswblank.c \
|
||||
ctype/iswcntrl.c \
|
||||
ctype/iswdigit.c \
|
||||
ctype/iswgraph.c \
|
||||
ctype/iswlower.c \
|
||||
ctype/iswprint.c \
|
||||
ctype/iswpunct.c \
|
||||
ctype/iswspace.c \
|
||||
ctype/iswupper.c \
|
||||
ctype/iswxdigit.c \
|
||||
ctype/isxdigit.c \
|
||||
ctype/toascii.c \
|
||||
ctype/tolower.c \
|
||||
ctype/tolower.c \
|
||||
ctype/toupper.c \
|
||||
ctype/towctrans.c \
|
||||
ctype/towlower.c \
|
||||
ctype/towupper.c \
|
||||
ctype/towctrans.c \
|
||||
ctype/towlower.c \
|
||||
ctype/towupper.c \
|
||||
ctype/wctrans.c \
|
||||
ctype/wctype.c \
|
||||
errno/errno.c \
|
||||
ctype/wctype.c \
|
||||
errno/errno.c \
|
||||
locale/locale.c \
|
||||
locale/lctype.c \
|
||||
reent/impure.c \
|
||||
reent/getreent.c \
|
||||
reent/impure.c \
|
||||
reent/init_reent.c \
|
||||
reent/getreent.c \
|
||||
reent/mutex.c \
|
||||
reent/gettimeofdayr.c \
|
||||
reent/hdlman.c \
|
||||
reent/hdlman.c \
|
||||
reent/isattyr.c \
|
||||
reent/openr.c \
|
||||
reent/closer.c \
|
||||
reent/readr.c \
|
||||
reent/lseekr.c \
|
||||
reent/fstatr.c \
|
||||
reent/writer.c \
|
||||
search/qsort.c \
|
||||
search/bsearch.c \
|
||||
reent/openr.c \
|
||||
reent/closer.c \
|
||||
reent/readr.c \
|
||||
reent/lseekr.c \
|
||||
reent/fstatr.c \
|
||||
reent/writer.c \
|
||||
search/qsort.c \
|
||||
search/bsearch.c \
|
||||
signal/signal.c \
|
||||
sys/create.c \
|
||||
sys/delete.c \
|
||||
sys/finfo.c \
|
||||
sys/read.c \
|
||||
sys/write.c \
|
||||
sys/fsize.c \
|
||||
sys/fload.c \
|
||||
time/asctime.c \
|
||||
time/asctime_r.c \
|
||||
time/clock.c \
|
||||
time/ctime.c \
|
||||
time/ctime_r.c \
|
||||
sys/create.c \
|
||||
sys/delete.c \
|
||||
sys/finfo.c \
|
||||
sys/read.c \
|
||||
sys/write.c \
|
||||
sys/fsize.c \
|
||||
sys/fload.c \
|
||||
time/asctime.c \
|
||||
time/asctime_r.c \
|
||||
time/clock.c \
|
||||
time/ctime.c \
|
||||
time/ctime_r.c \
|
||||
time/difftime.c \
|
||||
time/gettzinfo.c \
|
||||
time/gmtime.c \
|
||||
time/gettzinfo.c \
|
||||
time/gmtime.c \
|
||||
time/gmtime_r.c \
|
||||
time/mktime.c \
|
||||
time/mktm_r.c \
|
||||
time/lcltime.c \
|
||||
time/lcltime_r.c \
|
||||
time/mktime.c \
|
||||
time/mktm_r.c \
|
||||
time/lcltime.c \
|
||||
time/lcltime_r.c \
|
||||
time/strftime.c \
|
||||
time/time.c \
|
||||
time/tzlock.c \
|
||||
time/tzvars.c \
|
||||
time/time.c \
|
||||
time/tzlock.c \
|
||||
time/tzvars.c \
|
||||
unpack/unpacker.asm
|
||||
|
||||
|
||||
STDLIB_SRCS= \
|
||||
STDLIB_SRCS= \
|
||||
__atexit.c \
|
||||
__call_atexit.c \
|
||||
abort.c \
|
||||
abs.c \
|
||||
atof.c \
|
||||
atoi.c \
|
||||
atol.c \
|
||||
atol.c \
|
||||
div.c \
|
||||
dtoa.c \
|
||||
dtoastub.c \
|
||||
@ -160,93 +163,93 @@ STDLIB_SRCS= \
|
||||
strtoull_r.c \
|
||||
system.c \
|
||||
wcrtomb.c \
|
||||
wctomb_r.c
|
||||
wctomb_r.c
|
||||
|
||||
|
||||
STRING_SRCS= memcpy.c \
|
||||
memcmp.c \
|
||||
memmove.c \
|
||||
memset.c \
|
||||
memchr.c \
|
||||
strcat.c \
|
||||
strchr.c \
|
||||
strcmp.c \
|
||||
strcoll.c \
|
||||
strcasecmp.c \
|
||||
strncasecmp.c \
|
||||
strncat.c \
|
||||
strncmp.c \
|
||||
strncpy.c \
|
||||
strndup.c \
|
||||
strndup_r.c \
|
||||
strnlen.c \
|
||||
strcasestr.c \
|
||||
strdup.c \
|
||||
strdup_r.c \
|
||||
strerror.c \
|
||||
strlen.c \
|
||||
strrchr.c \
|
||||
strpbrk.c \
|
||||
strsep.c \
|
||||
strstr.c \
|
||||
strtok.c \
|
||||
strtok_r.c \
|
||||
strupr.c \
|
||||
strcspn.c \
|
||||
strspn.c \
|
||||
strcpy.c \
|
||||
STRING_SRCS= memcpy.c \
|
||||
memcmp.c \
|
||||
memmove.c \
|
||||
memset.c \
|
||||
memchr.c \
|
||||
strcat.c \
|
||||
strchr.c \
|
||||
strcmp.c \
|
||||
strcoll.c \
|
||||
strcasecmp.c \
|
||||
strncasecmp.c \
|
||||
strncat.c \
|
||||
strncmp.c \
|
||||
strncpy.c \
|
||||
strndup.c \
|
||||
strndup_r.c \
|
||||
strnlen.c \
|
||||
strcasestr.c \
|
||||
strdup.c \
|
||||
strdup_r.c \
|
||||
strerror.c \
|
||||
strlen.c \
|
||||
strrchr.c \
|
||||
strpbrk.c \
|
||||
strsep.c \
|
||||
strstr.c \
|
||||
strtok.c \
|
||||
strtok_r.c \
|
||||
strupr.c \
|
||||
strcspn.c \
|
||||
strspn.c \
|
||||
strcpy.c \
|
||||
u_strerr.c
|
||||
|
||||
STDIO_SRCS= \
|
||||
STDIO_SRCS= \
|
||||
clearerr.c \
|
||||
diprintf.c \
|
||||
dprintf.c \
|
||||
printf.c \
|
||||
putchar.c \
|
||||
fgetc.c \
|
||||
fgets.c \
|
||||
fopen.c \
|
||||
fgetc.c \
|
||||
fgets.c \
|
||||
fopen.c \
|
||||
fclose.c \
|
||||
fdopen.c \
|
||||
fflush.c \
|
||||
flags.c \
|
||||
flags.c \
|
||||
fileno.c \
|
||||
findfp.c \
|
||||
fiprintf.c \
|
||||
fiscanf.c \
|
||||
fprintf.c \
|
||||
fputc.c \
|
||||
fputs.c \
|
||||
fputc.c \
|
||||
fputs.c \
|
||||
fputwc.c \
|
||||
fread.c \
|
||||
fread.c \
|
||||
freopen.c \
|
||||
fscanf.c \
|
||||
fseek.c \
|
||||
fseek.c \
|
||||
fseeko.c \
|
||||
ftell.c \
|
||||
ftell.c \
|
||||
ftello.c \
|
||||
fwrite.c \
|
||||
fvwrite.c \
|
||||
fwalk.c \
|
||||
putc.c \
|
||||
puts.c \
|
||||
fwalk.c \
|
||||
putc.c \
|
||||
puts.c \
|
||||
refill.c \
|
||||
rget.c \
|
||||
rget.c \
|
||||
remove.c \
|
||||
rename.c \
|
||||
setvbuf.c \
|
||||
stdio.c \
|
||||
stdio.c \
|
||||
tmpfile.c \
|
||||
tmpnam.c \
|
||||
ungetc.c \
|
||||
vscanf.c \
|
||||
vsprintf.c \
|
||||
vsnprintf.c \
|
||||
vsnprintf.c \
|
||||
vsscanf.c \
|
||||
makebuf.c \
|
||||
makebuf.c \
|
||||
wsetup.c \
|
||||
wbuf.c \
|
||||
sccl.c \
|
||||
wbuf.c \
|
||||
sccl.c \
|
||||
sniprintf.c \
|
||||
snprintf.c \
|
||||
sprintf.c \
|
||||
|
@ -54,25 +54,6 @@ char * __libc_getenv(const char *name)
|
||||
}
|
||||
|
||||
void __main (){};
|
||||
void init_reent();
|
||||
|
||||
void __attribute__((noreturn))
|
||||
__thread_startup (int (*entry)(void*), void *param,
|
||||
void *stacklow, void *stackhigh)
|
||||
{
|
||||
int retval;
|
||||
|
||||
__asm__ __volatile__( // save stack limits
|
||||
"movl %0, %%fs:4 \n\t" // use TLS
|
||||
"movl %1, %%fs:8 \n\t"
|
||||
::"r"(stacklow), "r"(stackhigh));
|
||||
|
||||
init_reent(); // initialize thread reentry structure
|
||||
|
||||
retval = entry(param); // call user thread function
|
||||
|
||||
_exit(retval);
|
||||
};
|
||||
|
||||
struct app_hdr
|
||||
{
|
||||
@ -86,6 +67,19 @@ struct app_hdr
|
||||
char *path;
|
||||
};
|
||||
|
||||
typedef void (*ctp)();
|
||||
static void __do_global_ctors ()
|
||||
{
|
||||
extern int __CTOR_LIST__;
|
||||
int *c = &__CTOR_LIST__;
|
||||
c++;
|
||||
while (*c)
|
||||
{
|
||||
ctp d = (ctp)*c;
|
||||
(d)();
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
void __attribute__((noreturn))
|
||||
__crt_startup (void)
|
||||
@ -102,7 +96,7 @@ __crt_startup (void)
|
||||
__cpu_features_init (); /* Do we have SSE, etc.*/
|
||||
// _fpreset (); /* Supplied by the runtime library. */
|
||||
|
||||
__initPOSIXHandles();
|
||||
__do_global_ctors();
|
||||
|
||||
__appcwdlen = strrchr(&__pgmname, '/') - &__pgmname + 1;
|
||||
__appcwdlen = __appcwdlen > 1023 ? 1023 : __appcwdlen;
|
||||
|
22
programs/develop/libraries/newlib/crt/crt2.c
Normal file
22
programs/develop/libraries/newlib/crt/crt2.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <newlib.h>
|
||||
|
||||
void init_reent();
|
||||
|
||||
void __attribute__((noreturn))
|
||||
__thread_startup (int (*entry)(void*), void *param,
|
||||
void *stacklow, void *stackhigh)
|
||||
{
|
||||
int retval;
|
||||
|
||||
__asm__ __volatile__( // save stack limits
|
||||
"movl %0, %%fs:4 \n\t" // use TLS
|
||||
"movl %1, %%fs:8 \n\t"
|
||||
::"r"(stacklow), "r"(stackhigh));
|
||||
|
||||
init_reent(); // initialize thread reentry structure
|
||||
|
||||
retval = entry(param); // call user thread function
|
||||
|
||||
_exit(retval);
|
||||
};
|
||||
|
@ -29,40 +29,6 @@ void init_reent()
|
||||
__sinit(ent);
|
||||
}
|
||||
|
||||
void init_global_reent()
|
||||
{
|
||||
struct _reent *ent;
|
||||
|
||||
ent =_GLOBAL_REENT;
|
||||
|
||||
_REENT_INIT_PTR(ent);
|
||||
|
||||
__asm__ __volatile__(
|
||||
"movl %0, %%fs:12"
|
||||
::"r"(ent));
|
||||
__sinit(ent);
|
||||
}
|
||||
|
||||
|
||||
void __mutex_lock(volatile int *val)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"0:\n\t"
|
||||
"mov %0, %1\n\t"
|
||||
"testl %1, %1\n\t"
|
||||
"jz 1f\n\t"
|
||||
|
||||
"movl $68, %%eax\n\t"
|
||||
"movl $1, %%ebx\n\t"
|
||||
"int $0x40\n\t"
|
||||
"jmp 0b\n\t"
|
||||
"1:\n\t"
|
||||
"incl %1\n\t"
|
||||
"xchgl %0, %1\n\t"
|
||||
"testl %1, %1\n\t"
|
||||
"jnz 0b\n"
|
||||
: "+m" (*val), "=&r"(tmp)
|
||||
::"eax","ebx" );
|
||||
}
|
||||
|
@ -54,6 +54,8 @@
|
||||
|
||||
void __ChkTTYIOMode( int handle );
|
||||
|
||||
void __initPOSIXHandles( void ) __attribute__ ((constructor));
|
||||
|
||||
void __grow_iomode( int num );
|
||||
int debugwrite(const char *path,const void *buff,
|
||||
size_t offset, size_t count, size_t *writes);
|
||||
|
18
programs/develop/libraries/newlib/reent/init_reent.c
Normal file
18
programs/develop/libraries/newlib/reent/init_reent.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <_ansi.h>
|
||||
#include <string.h>
|
||||
#include <reent.h>
|
||||
|
||||
void init_global_reent()
|
||||
{
|
||||
struct _reent *ent;
|
||||
|
||||
ent =_GLOBAL_REENT;
|
||||
|
||||
_REENT_INIT_PTR(ent);
|
||||
|
||||
__asm__ __volatile__(
|
||||
"movl %0, %%fs:12"
|
||||
::"r"(ent));
|
||||
// __sinit(ent);
|
||||
}
|
||||
|
23
programs/develop/libraries/newlib/reent/mutex.c
Normal file
23
programs/develop/libraries/newlib/reent/mutex.c
Normal file
@ -0,0 +1,23 @@
|
||||
void __mutex_lock(volatile int *val)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"0:\n\t"
|
||||
"mov %0, %1\n\t"
|
||||
"testl %1, %1\n\t"
|
||||
"jz 1f\n\t"
|
||||
|
||||
"movl $68, %%eax\n\t"
|
||||
"movl $1, %%ebx\n\t"
|
||||
"int $0x40\n\t"
|
||||
"jmp 0b\n\t"
|
||||
"1:\n\t"
|
||||
"incl %1\n\t"
|
||||
"xchgl %0, %1\n\t"
|
||||
"testl %1, %1\n\t"
|
||||
"jnz 0b\n"
|
||||
: "+m" (*val), "=&r"(tmp)
|
||||
::"eax","ebx" );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user