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)
|
INCLUDES:= -I $(LIBC_INCLUDES)
|
||||||
|
|
||||||
AMZ_SRCS:= \
|
AMZ_SRCS:= \
|
||||||
crt/crt_amz.S \
|
crt/crt_amz.S \
|
||||||
crt/chkstk.S \
|
crt/chkstk.S \
|
||||||
crt/exit.S \
|
crt/exit.S \
|
||||||
crt/pseudo-reloc.c \
|
crt/pseudo-reloc.c \
|
||||||
crt/dllstart.c \
|
crt/dllstart.c \
|
||||||
crt/setjmp.S
|
crt/setjmp.S
|
||||||
|
|
||||||
STATIC_SRCS:= \
|
STATIC_SRCS:= \
|
||||||
crt/start.S \
|
crt/start.S \
|
||||||
crt/crt1.c \
|
crt/crt1.c \
|
||||||
crt/chkstk.S \
|
crt/crt2.c \
|
||||||
|
crt/chkstk.S \
|
||||||
crt/exit.S \
|
crt/exit.S \
|
||||||
crt/setjmp.S
|
crt/setjmp.S
|
||||||
|
|
||||||
DLL_SRCS:= \
|
DLL_SRCS:= \
|
||||||
crt/crtdll.c \
|
crt/crtdll.c \
|
||||||
crt/chkstk.S \
|
crt/chkstk.S \
|
||||||
crt/exit.S \
|
crt/exit.S \
|
||||||
crt/setjmp.S \
|
crt/setjmp.S \
|
||||||
pe/loader.c
|
pe/loader.c
|
||||||
|
|
||||||
CORE_SRCS:= \
|
CORE_SRCS:= \
|
||||||
argz/buf_findstr.c \
|
argz/buf_findstr.c \
|
||||||
argz/envz_get.c \
|
argz/envz_get.c \
|
||||||
crt/emutls.c \
|
crt/emutls.c \
|
||||||
crt/thread.S \
|
crt/thread.S \
|
||||||
crt/tls.S \
|
crt/tls.S \
|
||||||
crt/assert.c \
|
crt/assert.c \
|
||||||
crt/cpu_features.c \
|
crt/cpu_features.c \
|
||||||
ctype/ctype_.c \
|
ctype/ctype_.c \
|
||||||
ctype/isascii.c \
|
ctype/isascii.c \
|
||||||
ctype/isblank.c \
|
ctype/isblank.c \
|
||||||
ctype/isalnum.c \
|
ctype/isalnum.c \
|
||||||
ctype/isalpha.c \
|
ctype/isalpha.c \
|
||||||
ctype/iscntrl.c \
|
ctype/iscntrl.c \
|
||||||
ctype/isdigit.c \
|
ctype/isdigit.c \
|
||||||
ctype/islower.c \
|
ctype/islower.c \
|
||||||
ctype/isupper.c \
|
ctype/isupper.c \
|
||||||
ctype/isprint.c \
|
ctype/isprint.c \
|
||||||
ctype/ispunct.c \
|
ctype/ispunct.c \
|
||||||
ctype/isspace.c \
|
ctype/isspace.c \
|
||||||
ctype/iswctype.c \
|
ctype/iswctype.c \
|
||||||
ctype/iswalnum.c \
|
ctype/iswalnum.c \
|
||||||
ctype/iswalpha.c \
|
ctype/iswalpha.c \
|
||||||
ctype/iswblank.c \
|
ctype/iswblank.c \
|
||||||
ctype/iswcntrl.c \
|
ctype/iswcntrl.c \
|
||||||
ctype/iswdigit.c \
|
ctype/iswdigit.c \
|
||||||
ctype/iswgraph.c \
|
ctype/iswgraph.c \
|
||||||
ctype/iswlower.c \
|
ctype/iswlower.c \
|
||||||
ctype/iswprint.c \
|
ctype/iswprint.c \
|
||||||
ctype/iswpunct.c \
|
ctype/iswpunct.c \
|
||||||
ctype/iswspace.c \
|
ctype/iswspace.c \
|
||||||
ctype/iswupper.c \
|
ctype/iswupper.c \
|
||||||
ctype/iswxdigit.c \
|
ctype/iswxdigit.c \
|
||||||
ctype/isxdigit.c \
|
ctype/isxdigit.c \
|
||||||
ctype/toascii.c \
|
ctype/toascii.c \
|
||||||
ctype/tolower.c \
|
ctype/tolower.c \
|
||||||
ctype/toupper.c \
|
ctype/toupper.c \
|
||||||
ctype/towctrans.c \
|
ctype/towctrans.c \
|
||||||
ctype/towlower.c \
|
ctype/towlower.c \
|
||||||
ctype/towupper.c \
|
ctype/towupper.c \
|
||||||
ctype/wctrans.c \
|
ctype/wctrans.c \
|
||||||
ctype/wctype.c \
|
ctype/wctype.c \
|
||||||
errno/errno.c \
|
errno/errno.c \
|
||||||
locale/locale.c \
|
locale/locale.c \
|
||||||
locale/lctype.c \
|
locale/lctype.c \
|
||||||
reent/impure.c \
|
reent/impure.c \
|
||||||
reent/getreent.c \
|
reent/init_reent.c \
|
||||||
|
reent/getreent.c \
|
||||||
|
reent/mutex.c \
|
||||||
reent/gettimeofdayr.c \
|
reent/gettimeofdayr.c \
|
||||||
reent/hdlman.c \
|
reent/hdlman.c \
|
||||||
reent/isattyr.c \
|
reent/isattyr.c \
|
||||||
reent/openr.c \
|
reent/openr.c \
|
||||||
reent/closer.c \
|
reent/closer.c \
|
||||||
reent/readr.c \
|
reent/readr.c \
|
||||||
reent/lseekr.c \
|
reent/lseekr.c \
|
||||||
reent/fstatr.c \
|
reent/fstatr.c \
|
||||||
reent/writer.c \
|
reent/writer.c \
|
||||||
search/qsort.c \
|
search/qsort.c \
|
||||||
search/bsearch.c \
|
search/bsearch.c \
|
||||||
signal/signal.c \
|
signal/signal.c \
|
||||||
sys/create.c \
|
sys/create.c \
|
||||||
sys/delete.c \
|
sys/delete.c \
|
||||||
sys/finfo.c \
|
sys/finfo.c \
|
||||||
sys/read.c \
|
sys/read.c \
|
||||||
sys/write.c \
|
sys/write.c \
|
||||||
sys/fsize.c \
|
sys/fsize.c \
|
||||||
sys/fload.c \
|
sys/fload.c \
|
||||||
time/asctime.c \
|
time/asctime.c \
|
||||||
time/asctime_r.c \
|
time/asctime_r.c \
|
||||||
time/clock.c \
|
time/clock.c \
|
||||||
time/ctime.c \
|
time/ctime.c \
|
||||||
time/ctime_r.c \
|
time/ctime_r.c \
|
||||||
time/difftime.c \
|
time/difftime.c \
|
||||||
time/gettzinfo.c \
|
time/gettzinfo.c \
|
||||||
time/gmtime.c \
|
time/gmtime.c \
|
||||||
time/gmtime_r.c \
|
time/gmtime_r.c \
|
||||||
time/mktime.c \
|
time/mktime.c \
|
||||||
time/mktm_r.c \
|
time/mktm_r.c \
|
||||||
time/lcltime.c \
|
time/lcltime.c \
|
||||||
time/lcltime_r.c \
|
time/lcltime_r.c \
|
||||||
time/strftime.c \
|
time/strftime.c \
|
||||||
time/time.c \
|
time/time.c \
|
||||||
time/tzlock.c \
|
time/tzlock.c \
|
||||||
time/tzvars.c \
|
time/tzvars.c \
|
||||||
unpack/unpacker.asm
|
unpack/unpacker.asm
|
||||||
|
|
||||||
|
|
||||||
STDLIB_SRCS= \
|
STDLIB_SRCS= \
|
||||||
__atexit.c \
|
__atexit.c \
|
||||||
__call_atexit.c \
|
__call_atexit.c \
|
||||||
abort.c \
|
abort.c \
|
||||||
abs.c \
|
abs.c \
|
||||||
atof.c \
|
atof.c \
|
||||||
atoi.c \
|
atoi.c \
|
||||||
atol.c \
|
atol.c \
|
||||||
div.c \
|
div.c \
|
||||||
dtoa.c \
|
dtoa.c \
|
||||||
dtoastub.c \
|
dtoastub.c \
|
||||||
@ -160,93 +163,93 @@ STDLIB_SRCS= \
|
|||||||
strtoull_r.c \
|
strtoull_r.c \
|
||||||
system.c \
|
system.c \
|
||||||
wcrtomb.c \
|
wcrtomb.c \
|
||||||
wctomb_r.c
|
wctomb_r.c
|
||||||
|
|
||||||
|
|
||||||
STRING_SRCS= memcpy.c \
|
STRING_SRCS= memcpy.c \
|
||||||
memcmp.c \
|
memcmp.c \
|
||||||
memmove.c \
|
memmove.c \
|
||||||
memset.c \
|
memset.c \
|
||||||
memchr.c \
|
memchr.c \
|
||||||
strcat.c \
|
strcat.c \
|
||||||
strchr.c \
|
strchr.c \
|
||||||
strcmp.c \
|
strcmp.c \
|
||||||
strcoll.c \
|
strcoll.c \
|
||||||
strcasecmp.c \
|
strcasecmp.c \
|
||||||
strncasecmp.c \
|
strncasecmp.c \
|
||||||
strncat.c \
|
strncat.c \
|
||||||
strncmp.c \
|
strncmp.c \
|
||||||
strncpy.c \
|
strncpy.c \
|
||||||
strndup.c \
|
strndup.c \
|
||||||
strndup_r.c \
|
strndup_r.c \
|
||||||
strnlen.c \
|
strnlen.c \
|
||||||
strcasestr.c \
|
strcasestr.c \
|
||||||
strdup.c \
|
strdup.c \
|
||||||
strdup_r.c \
|
strdup_r.c \
|
||||||
strerror.c \
|
strerror.c \
|
||||||
strlen.c \
|
strlen.c \
|
||||||
strrchr.c \
|
strrchr.c \
|
||||||
strpbrk.c \
|
strpbrk.c \
|
||||||
strsep.c \
|
strsep.c \
|
||||||
strstr.c \
|
strstr.c \
|
||||||
strtok.c \
|
strtok.c \
|
||||||
strtok_r.c \
|
strtok_r.c \
|
||||||
strupr.c \
|
strupr.c \
|
||||||
strcspn.c \
|
strcspn.c \
|
||||||
strspn.c \
|
strspn.c \
|
||||||
strcpy.c \
|
strcpy.c \
|
||||||
u_strerr.c
|
u_strerr.c
|
||||||
|
|
||||||
STDIO_SRCS= \
|
STDIO_SRCS= \
|
||||||
clearerr.c \
|
clearerr.c \
|
||||||
diprintf.c \
|
diprintf.c \
|
||||||
dprintf.c \
|
dprintf.c \
|
||||||
printf.c \
|
printf.c \
|
||||||
putchar.c \
|
putchar.c \
|
||||||
fgetc.c \
|
fgetc.c \
|
||||||
fgets.c \
|
fgets.c \
|
||||||
fopen.c \
|
fopen.c \
|
||||||
fclose.c \
|
fclose.c \
|
||||||
fdopen.c \
|
fdopen.c \
|
||||||
fflush.c \
|
fflush.c \
|
||||||
flags.c \
|
flags.c \
|
||||||
fileno.c \
|
fileno.c \
|
||||||
findfp.c \
|
findfp.c \
|
||||||
fiprintf.c \
|
fiprintf.c \
|
||||||
fiscanf.c \
|
fiscanf.c \
|
||||||
fprintf.c \
|
fprintf.c \
|
||||||
fputc.c \
|
fputc.c \
|
||||||
fputs.c \
|
fputs.c \
|
||||||
fputwc.c \
|
fputwc.c \
|
||||||
fread.c \
|
fread.c \
|
||||||
freopen.c \
|
freopen.c \
|
||||||
fscanf.c \
|
fscanf.c \
|
||||||
fseek.c \
|
fseek.c \
|
||||||
fseeko.c \
|
fseeko.c \
|
||||||
ftell.c \
|
ftell.c \
|
||||||
ftello.c \
|
ftello.c \
|
||||||
fwrite.c \
|
fwrite.c \
|
||||||
fvwrite.c \
|
fvwrite.c \
|
||||||
fwalk.c \
|
fwalk.c \
|
||||||
putc.c \
|
putc.c \
|
||||||
puts.c \
|
puts.c \
|
||||||
refill.c \
|
refill.c \
|
||||||
rget.c \
|
rget.c \
|
||||||
remove.c \
|
remove.c \
|
||||||
rename.c \
|
rename.c \
|
||||||
setvbuf.c \
|
setvbuf.c \
|
||||||
stdio.c \
|
stdio.c \
|
||||||
tmpfile.c \
|
tmpfile.c \
|
||||||
tmpnam.c \
|
tmpnam.c \
|
||||||
ungetc.c \
|
ungetc.c \
|
||||||
vscanf.c \
|
vscanf.c \
|
||||||
vsprintf.c \
|
vsprintf.c \
|
||||||
vsnprintf.c \
|
vsnprintf.c \
|
||||||
vsscanf.c \
|
vsscanf.c \
|
||||||
makebuf.c \
|
makebuf.c \
|
||||||
wsetup.c \
|
wsetup.c \
|
||||||
wbuf.c \
|
wbuf.c \
|
||||||
sccl.c \
|
sccl.c \
|
||||||
sniprintf.c \
|
sniprintf.c \
|
||||||
snprintf.c \
|
snprintf.c \
|
||||||
sprintf.c \
|
sprintf.c \
|
||||||
|
@ -54,25 +54,6 @@ char * __libc_getenv(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void __main (){};
|
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
|
struct app_hdr
|
||||||
{
|
{
|
||||||
@ -86,6 +67,19 @@ struct app_hdr
|
|||||||
char *path;
|
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))
|
void __attribute__((noreturn))
|
||||||
__crt_startup (void)
|
__crt_startup (void)
|
||||||
@ -102,7 +96,7 @@ __crt_startup (void)
|
|||||||
__cpu_features_init (); /* Do we have SSE, etc.*/
|
__cpu_features_init (); /* Do we have SSE, etc.*/
|
||||||
// _fpreset (); /* Supplied by the runtime library. */
|
// _fpreset (); /* Supplied by the runtime library. */
|
||||||
|
|
||||||
__initPOSIXHandles();
|
__do_global_ctors();
|
||||||
|
|
||||||
__appcwdlen = strrchr(&__pgmname, '/') - &__pgmname + 1;
|
__appcwdlen = strrchr(&__pgmname, '/') - &__pgmname + 1;
|
||||||
__appcwdlen = __appcwdlen > 1023 ? 1023 : __appcwdlen;
|
__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);
|
__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 __ChkTTYIOMode( int handle );
|
||||||
|
|
||||||
|
void __initPOSIXHandles( void ) __attribute__ ((constructor));
|
||||||
|
|
||||||
void __grow_iomode( int num );
|
void __grow_iomode( int num );
|
||||||
int debugwrite(const char *path,const void *buff,
|
int debugwrite(const char *path,const void *buff,
|
||||||
size_t offset, size_t count, size_t *writes);
|
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