diff options
-rw-r--r-- | include/netinet/ip_fw.h | 1 | ||||
-rw-r--r-- | include/netinet/ip_tcp.h | 72 | ||||
-rw-r--r-- | include/netinet/ip_udp.h | 1 | ||||
-rw-r--r-- | libc/misc/elf/Makefile | 12 | ||||
-rw-r--r-- | libc/misc/elf/Makefile.in | 19 | ||||
-rw-r--r-- | libc/misc/elf/dl-core.c | 20 | ||||
-rw-r--r-- | libc/misc/elf/dl-iterate-phdr.c | 84 | ||||
-rw-r--r-- | libc/misc/elf/dl-support.c | 68 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/__syscall_ipc.c | 17 |
9 files changed, 203 insertions, 91 deletions
diff --git a/include/netinet/ip_fw.h b/include/netinet/ip_fw.h deleted file mode 100644 index 278a0393f..000000000 --- a/include/netinet/ip_fw.h +++ /dev/null @@ -1 +0,0 @@ -#include <linux/ip_fw.h> diff --git a/include/netinet/ip_tcp.h b/include/netinet/ip_tcp.h deleted file mode 100644 index 600aebc1c..000000000 --- a/include/netinet/ip_tcp.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#)tcp.h 7.5 (Berkeley) 6/29/88 - */ - -#ifndef _NETINET_IP_TCP_H -#define _NETINET_IP_TCP_H - -#include <endian.h> -#include <linux/socket.h> -#include <sys/types.h> - -typedef u_int32_t tcp_seq; -/* - * TCP header. - * Per RFC 793, September, 1981. - */ -struct tcphdr { - u_short th_sport; /* source port */ - u_short th_dport; /* destination port */ - tcp_seq th_seq; /* sequence number */ - tcp_seq th_ack; /* acknowledgement number */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - u_char th_x2:4, /* (unused) */ - th_off:4; /* data offset */ -#endif -#if __BYTE_ORDER == __BIG_ENDIAN - u_char th_off:4, /* data offset */ - th_x2:4; /* (unused) */ -#endif - u_char th_flags; -#define TH_FIN 0x01 -#define TH_SYN 0x02 -#define TH_RST 0x04 -#define TH_PUSH 0x08 -#define TH_ACK 0x10 -#define TH_URG 0x20 - u_short th_win; /* window */ - u_short th_sum; /* checksum */ - u_short th_urp; /* urgent pointer */ -}; - -#define TCPOPT_EOL 0 -#define TCPOPT_NOP 1 -#define TCPOPT_MAXSEG 2 - -/* - * Default maximum segment size for TCP. - * With an IP MSS of 576, this is 536, - * but 512 is probably more convenient. - */ -#ifdef lint -#define TCP_MSS 536 -#else -#define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr)) -#endif - -#endif /* _NETINET_TCP_H */ diff --git a/include/netinet/ip_udp.h b/include/netinet/ip_udp.h deleted file mode 100644 index 3f0d8ef7c..000000000 --- a/include/netinet/ip_udp.h +++ /dev/null @@ -1 +0,0 @@ -#include <linux/udp.h> diff --git a/libc/misc/elf/Makefile b/libc/misc/elf/Makefile new file mode 100644 index 000000000..4bb6872a1 --- /dev/null +++ b/libc/misc/elf/Makefile @@ -0,0 +1,12 @@ +# Copyright (C) 2008 STMicroelectronics Ltd. +# Author: Carmelo Amoroso <carmelo.amoroso@st.com> + +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +top_srcdir=../../../ +top_builddir=../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.in +include $(top_srcdir)Makerules diff --git a/libc/misc/elf/Makefile.in b/libc/misc/elf/Makefile.in new file mode 100644 index 000000000..b9cab8eb3 --- /dev/null +++ b/libc/misc/elf/Makefile.in @@ -0,0 +1,19 @@ +# Copyright (C) 2008 STMicroelectronics Ltd. +# Author: Carmelo Amoroso <carmelo.amoroso@st.com> + +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +libc_a_CSRC = dl-support.c dl-core.c dl-iterate-phdr.c +CFLAGS-dl-iterate-phdr.c=-D_GNU_SOURCE + +MISC_ELF_OUT:=$(top_builddir)libc/misc/elf +MISC_ELF_OBJ:=$(patsubst %.c,$(MISC_ELF_OUT)/%.o,$(libc_a_CSRC)) + +libc-static-y += $(MISC_ELF_OBJ) +libc-shared-y += $(MISC_ELF_OUT)/dl-iterate-phdr.oS + +objclean-y+= misc_elf_objclean + +misc_elf_objclean: + $(RM) $(MISC_ELF_OUT)/*.{o,os,oS} diff --git a/libc/misc/elf/dl-core.c b/libc/misc/elf/dl-core.c new file mode 100644 index 000000000..b32dcf828 --- /dev/null +++ b/libc/misc/elf/dl-core.c @@ -0,0 +1,20 @@ +/* + * This contains all symbols and functions to support + * dynamic linking into static libc. + + * Copyright (c) 2008 STMicroelectronics Ltd + * Author: Carmelo Amoroso <carmelo.amoroso@st.com> + * + * Based on draft work by Peter S. Mazinger <ps.m@gmx.net> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * + */ + +#ifdef SHARED +#error "This file is not suitable for linking into dynamic libc" +#else +/* Include ldso symbols and functions used into static libc */ +#include "../../../ldso/ldso/dl-symbols.c" +#endif + diff --git a/libc/misc/elf/dl-iterate-phdr.c b/libc/misc/elf/dl-iterate-phdr.c new file mode 100644 index 000000000..a23ca700d --- /dev/null +++ b/libc/misc/elf/dl-iterate-phdr.c @@ -0,0 +1,84 @@ +/* Get loaded objects program headers. + Copyright (C) 2001,2002,2003,2004,2006,2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2001. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + */ + + +#include <link.h> +#include <ldso.h> + +/* we want this in libc but nowhere else */ +#ifdef __USE_GNU + +extern __typeof(dl_iterate_phdr) __dl_iterate_phdr; + +hidden_proto(__dl_iterate_phdr) +int +__dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, size_t size, void *data), void *data) +{ + struct elf_resolve *l; + struct dl_phdr_info info; + int ret = 0; + + for (l = _dl_loaded_modules; l != NULL; l = l->next) { + info.dlpi_addr = l->loadaddr; + info.dlpi_name = l->libname; + info.dlpi_phdr = l->ppnt; + info.dlpi_phnum = l->n_phent; + ret = callback (&info, sizeof (struct dl_phdr_info), data); + if (ret) + break; + } + return ret; +} +hidden_def (__dl_iterate_phdr) + +# ifdef SHARED + +weak_alias(__dl_iterate_phdr, dl_iterate_phdr) + +# else + +/* dl-support.c defines these and initializes them early on. */ +extern ElfW(Phdr) *_dl_phdr; +extern size_t _dl_phnum; + +int +dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, + size_t size, void *data), void *data) +{ + if (_dl_phnum != 0) + { + /* This entry describes this statically-linked program itself. */ + struct dl_phdr_info info; + int ret; + info.dlpi_addr = 0; + info.dlpi_name = ""; + info.dlpi_phdr = _dl_phdr; + info.dlpi_phnum = _dl_phnum; + ret = (*callback) (&info, sizeof (struct dl_phdr_info), data); + if (ret) + return ret; + } + /* Then invoke callback on loaded modules, if any */ + return __dl_iterate_phdr (callback, data); +} + +# endif +#endif diff --git a/libc/misc/elf/dl-support.c b/libc/misc/elf/dl-support.c new file mode 100644 index 000000000..b8f0c07a6 --- /dev/null +++ b/libc/misc/elf/dl-support.c @@ -0,0 +1,68 @@ +/* Support for dynamic linking code in static libc. + Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file defines some things that for the dynamic linker are defined in + rtld.c and dl-sysdep.c in ways appropriate to bootstrap dynamic linking. */ + +#include <assert.h> +#include <tls.h> +#include <link.h> +#include <ldsodefs.h> +#include <string.h> + +void (*_dl_init_static_tls) (struct link_map *) = &_dl_nothread_init_static_tls; + +ElfW(Phdr) *_dl_phdr; +size_t _dl_phnum; + +void +internal_function +_dl_aux_init (ElfW(auxv_t) *av) +{ + /* Get the program headers base address from the aux vect */ + GL(dl_phdr) = (ElfW(Phdr) *) av[AT_PHDR].a_un.a_val; + + /* Get the number of program headers from the aux vect */ + GL(dl_phnum) = (size_t) av[AT_PHNUM].a_un.a_val; +} + +/* Initialize static TLS area and DTV for current (only) thread. + libpthread implementations should provide their own hook + to handle all threads. */ +void +_dl_nothread_init_static_tls (struct link_map *map) +{ +# if TLS_TCB_AT_TP + void *dest = (char *) THREAD_SELF - map->l_tls_offset; +# elif TLS_DTV_AT_TP + void *dest = (char *) THREAD_SELF + map->l_tls_offset + TLS_PRE_TCB_SIZE; +# else +# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined" +# endif + + /* Fill in the DTV slot so that a later LD/GD access will find it. */ + dtv_t *dtv = THREAD_DTV (); + assert (map->l_tls_modid <= dtv[-1].counter); + dtv[map->l_tls_modid].pointer.val = dest; + dtv[map->l_tls_modid].pointer.is_static = true; + + /* Initialize the memory. */ + memset (mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size), + '\0', map->l_tls_blocksize - map->l_tls_initimage_size); +} diff --git a/libc/sysdeps/linux/common/__syscall_ipc.c b/libc/sysdeps/linux/common/__syscall_ipc.c deleted file mode 100644 index decc65ae5..000000000 --- a/libc/sysdeps/linux/common/__syscall_ipc.c +++ /dev/null @@ -1,17 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * __syscall_ipc() for uClibc - * - * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ - -#include "syscalls.h" - -#ifdef __NR_ipc -#define __NR___syscall_ipc __NR_ipc -#include "../../../misc/sysvipc/ipc.h" -_syscall5(int, __syscall_ipc, unsigned int, call, int, first, int, second, int, - third, void *, ptr); -#endif |