From 2dc6238d5b2bfbfd6aad4fa92e63633e0f669d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Wed, 4 Jun 2003 18:56:54 +0000 Subject: latest missing files --- mdk-stage1/dietlibc/binshstr.h | 6 ++++++ mdk-stage1/dietlibc/dietdns.h | 4 ++++ mdk-stage1/dietlibc/dieticonv.h | 12 +++++++++++ mdk-stage1/dietlibc/dietlibm.h | 5 +++++ mdk-stage1/dietlibc/dietuglyweaks.h | 24 ++++++++++++++++++++++ mdk-stage1/dietlibc/dyn_start.c | 40 +++++++++++++++++++++++++++++++++++++ mdk-stage1/dietlibc/dyn_stop.c | 23 +++++++++++++++++++++ mdk-stage1/dietlibc/linuxnet.h | 19 ++++++++++++++++++ mdk-stage1/dietlibc/parselib.h | 23 +++++++++++++++++++++ 9 files changed, 156 insertions(+) create mode 100644 mdk-stage1/dietlibc/binshstr.h create mode 100644 mdk-stage1/dietlibc/dietdns.h create mode 100644 mdk-stage1/dietlibc/dieticonv.h create mode 100644 mdk-stage1/dietlibc/dietlibm.h create mode 100644 mdk-stage1/dietlibc/dietuglyweaks.h create mode 100644 mdk-stage1/dietlibc/dyn_start.c create mode 100644 mdk-stage1/dietlibc/dyn_stop.c create mode 100644 mdk-stage1/dietlibc/linuxnet.h create mode 100644 mdk-stage1/dietlibc/parselib.h (limited to 'mdk-stage1') diff --git a/mdk-stage1/dietlibc/binshstr.h b/mdk-stage1/dietlibc/binshstr.h new file mode 100644 index 000000000..f1bf789fe --- /dev/null +++ b/mdk-stage1/dietlibc/binshstr.h @@ -0,0 +1,6 @@ + +extern const char __binsh [8]; + +#define __sh (__binsh + 5 ) + +/* end of binshstr.h */ diff --git a/mdk-stage1/dietlibc/dietdns.h b/mdk-stage1/dietlibc/dietdns.h new file mode 100644 index 000000000..c4c1c5f72 --- /dev/null +++ b/mdk-stage1/dietlibc/dietdns.h @@ -0,0 +1,4 @@ + +int __dns_gethostbyx_r(const char* name, struct hostent* result, + char *buf, size_t buflen, + struct hostent **RESULT, int *h_errnop, int lookfor); diff --git a/mdk-stage1/dietlibc/dieticonv.h b/mdk-stage1/dietlibc/dieticonv.h new file mode 100644 index 000000000..540ef2f6f --- /dev/null +++ b/mdk-stage1/dietlibc/dieticonv.h @@ -0,0 +1,12 @@ +enum charset { + INVALID=0, + ISO_8859_1, + UTF_8, + UCS_2, + UCS_4 +}; + +#define ic_from(x) (((x) )&0xffff) +#define ic_to(x) (((x)>>16)&0xffff) + +#include diff --git a/mdk-stage1/dietlibc/dietlibm.h b/mdk-stage1/dietlibc/dietlibm.h new file mode 100644 index 000000000..fe735e40d --- /dev/null +++ b/mdk-stage1/dietlibc/dietlibm.h @@ -0,0 +1,5 @@ +#include + +double __poly(double x, size_t n, const double* c); +double exp2(double x); +double log2(double x); diff --git a/mdk-stage1/dietlibc/dietuglyweaks.h b/mdk-stage1/dietlibc/dietuglyweaks.h new file mode 100644 index 000000000..4b2aa231a --- /dev/null +++ b/mdk-stage1/dietlibc/dietuglyweaks.h @@ -0,0 +1,24 @@ +#ifndef __DIET_UGLY_WEAKS__ +#define __DIET_UGLY_WEAKS__ + +/* if you change something here ... KNOW what you're doing ! + * it'll effect ALL platforms ! */ + +.weak __thread_doexit +__thread_doexit: +.weak __fflush_stdin +__fflush_stdin: +.weak __fflush_stdout +__fflush_stdout: +.weak __fflush_stderr +__fflush_stderr: +.weak flockfile +flockfile: +.weak funlockfile +funlockfile: +.weak __nop +__nop: +.global __you_tried_to_link_a_dietlibc_object_against_glibc +__you_tried_to_link_a_dietlibc_object_against_glibc: + +#endif diff --git a/mdk-stage1/dietlibc/dyn_start.c b/mdk-stage1/dietlibc/dyn_start.c new file mode 100644 index 000000000..391797e12 --- /dev/null +++ b/mdk-stage1/dietlibc/dyn_start.c @@ -0,0 +1,40 @@ +#include "dietfeatures.h" + +#ifdef WANT_DYNAMIC +#include + +typedef void(*structor)(void); + +__attribute__((section(".ctors"))) +static structor __CTOR_LIST__[1]={((structor)-1)}; + +__attribute__((section(".dtors"))) +static structor __DTOR_LIST__[1]={((structor)-1)}; + +static void __do_global_dtors_aux(void) +{ + structor *df=__CTOR_LIST__; /* ugly trick to prevent warning */ + for (df=((__DTOR_LIST__)+1);(*df) != (structor)0; df++) (*df)(); +} + +void _fini(void) __attribute__((section(".fini"))); +__attribute__((section(".fini"))) void _fini(void) +{ + __do_global_dtors_aux(); +} + +#ifndef __DYN_LIB_SHARED +/* pre main, post _start */ +int _dyn_start(int argc, char **argv, char **envp, structor dl_init); +int _dyn_start(int argc, char **argv, char **envp, structor dl_init) +{ + static __attribute__((section(".init"))) void _init(void); + int main(int argc, char **argv, char **envp); + + if (dl_init) atexit(dl_init); + _init(); + atexit(_fini); + return main(argc, argv, envp); +} +#endif +#endif diff --git a/mdk-stage1/dietlibc/dyn_stop.c b/mdk-stage1/dietlibc/dyn_stop.c new file mode 100644 index 000000000..7213a8089 --- /dev/null +++ b/mdk-stage1/dietlibc/dyn_stop.c @@ -0,0 +1,23 @@ +#include "dietfeatures.h" + +#ifdef WANT_DYNAMIC +typedef void(*structor)(void); + +__attribute__((section(".ctors"))) +static structor __CTOR_END__[1]={((structor)0)}; + +__attribute__((section(".dtors"))) +static structor __DTOR_END__[1]={((structor)0)}; + +static void __do_global_ctors_aux(void) +{ + structor *cf=__DTOR_END__; /* ugly trick to prevent warning */ + for(cf=((__CTOR_END__)-1); (*cf) != (structor)-1; cf--) (*cf)(); +} + +void _init() __attribute__((section(".init"))); +__attribute__((section(".init"))) void _init() +{ + __do_global_ctors_aux(); +} +#endif diff --git a/mdk-stage1/dietlibc/linuxnet.h b/mdk-stage1/dietlibc/linuxnet.h new file mode 100644 index 000000000..8e2204701 --- /dev/null +++ b/mdk-stage1/dietlibc/linuxnet.h @@ -0,0 +1,19 @@ + +#define SYS_SOCKET 1 /* sys_socket(2) */ +#define SYS_BIND 2 /* sys_bind(2) */ +#define SYS_CONNECT 3 /* sys_connect(2) */ +#define SYS_LISTEN 4 /* sys_listen(2) */ +#define SYS_ACCEPT 5 /* sys_accept(2) */ +#define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */ +#define SYS_GETPEERNAME 7 /* sys_getpeername(2) */ +#define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */ +#define SYS_SEND 9 /* sys_send(2) */ +#define SYS_RECV 10 /* sys_recv(2) */ +#define SYS_SENDTO 11 /* sys_sendto(2) */ +#define SYS_RECVFROM 12 /* sys_recvfrom(2) */ +#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ +#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */ +#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ +#define SYS_SENDMSG 16 /* sys_sendmsg(2) */ +#define SYS_RECVMSG 17 /* sys_recvmsg(2) */ + diff --git a/mdk-stage1/dietlibc/parselib.h b/mdk-stage1/dietlibc/parselib.h new file mode 100644 index 000000000..831d9da2b --- /dev/null +++ b/mdk-stage1/dietlibc/parselib.h @@ -0,0 +1,23 @@ +/* parse lib: parse mmapped text with \n terminated lines */ + +/* a memory buffer. */ +struct state { + const unsigned char* buffirst;/* pointer to the buffer */ + size_t buflen; /* length of the buffer */ + size_t cur; /* already parsed bytes */ +}; + +/* open and mmap file, fill in struct state */ +void __prepare_parse(const char* filename,struct state* s); +/* unmap file */ +void __end_parse(struct state* s); + +/* return the length of the matching string, 0 on error */ +/* match while pred returns nonzero */ +size_t __parse(struct state* s,int (*pred)(int ch)); + +size_t __parse_ws(struct state* s); /* skip ' ' or '\t', break at '\n' or '#' */ +size_t __parse_nws(struct state* s); /* skip non-whitespace, break at '\n' or '#' */ +size_t __parse_1(struct state* s,char c); /* skip to c */ + +size_t scan_ulong(const char* s,unsigned long* l); -- cgit v1.2.1