From 3116126871400c8737a9df0145f66534f097c06c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 18 Mar 1998 14:42:25 +0000 Subject: Update. 1998-03-18 14:25 Ulrich Drepper * string/bits/string2.h: Add optimization for strdup. Always define __strsep and __strtok_r and make real names available when feature select macros are defined. 1998-03-18 Andreas Jaeger * manual/install.texi (Installation): Use i486-linux as example instead of the unsupported sunos4. (Reporting Bugs): Mention glibcbug script. (Tools for Installation): gcc 2.8.1/egcs 1.0.2 is required. 1998-03-16 Andreas Schwab * posix/wordexp-tst.sh: Make portable. Add more tests. * posix/Makefile (do-globtest do-wordexp-test): New targets. 1998-03-18 13:38 Ulrich Drepper * sysdeps/unix/sysv/linux/libc-start.c: Moved to ... * sysdeps/generic/libc-start.c: ...here, replacing former content. * sysdeps/unix/sysv/linux/Dist: Add netash/ash.h and netpacket/packet.h. * sysdeps/unix/sysv/linux/bits/socket.h: Pretty print. 1998-03-17 Andreas Schwab * sysdeps/unix/sysv/linux/bits/resource.h: Remove trailing comma in enumerator for strict standard compliance. * sysdeps/generic/bits/resource.h: Likewise. 1998-03-18 10:04 Philip Blundell * sysdeps/arm/sysdep.h (__ARM_USES_FP): Deleted. (PLTJMP): New macro. * sysdeps/arm/fpu/__longjmp.S: New file, implementation of longjmp() when floating point enabled. * sysdeps/arm/fpu/setjmp.S: Likewise for setjmp(). * sysdeps/arm/__longjmp.S: Remove floating point code. * sysdeps/arm/setjmp.S: Likewise. * sysdeps/arm/bsd-setjmp.S: Call __sigsetjmp by correct name. * sysdeps/arm/bsd-_setjmp.S: Likewise. * sysdeps/arm/memset.S: New file; optimised ARM implementation of memset(). * sysdeps/generic/setsockopt.c (setsockopt): Keep in step with prototype. 1998-03-17 16:16 Philip Blundell Based on patches from Pat Beirne and Scott Bambrough: * sysdeps/arm/__longjmp.S: Use ip, not r2, as temporary. * sysdeps/arm/bits/fenv.h: New file. * sysdeps/arm/dl-machine.h: New file. Add ELF support. * sysdeps/arm/elf/setjmp.S: Likewise. * sysdeps/arm/elf/start.S: Likewise. * sysdeps/arm/init-first.c: Likewise. * sysdeps/arm/setjmp.S: Call __sigjmp_save through PLT * sysdeps/arm/sysdep.h: Change format of .type directive. Correct comment about floating point to reflect current reality. * sysdeps/unix/arm/brk.S: Support PIC. * sysdeps/unix/arm/sysdep.S (syscall_error): Support PIC and re-entrant code. * sysdeps/unix/sysv/linux/arm/socket.S: Check correctly for error return; call syscall_error through PLT. * sysdeps/unix/sysv/linux/arm/sysdep.h (ENTRY): Correct error jump. 1998-03-04 12:01 Philip Blundell * sysdeps/unix/sysv/linux/netpacket/packet.h: New file. * sysdeps/unix/sysv/linux/netash/ash.h: Likewise. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Install them. --- sysdeps/unix/arm/brk.S | 19 ++++++-- sysdeps/unix/arm/sysdep.S | 36 +++++++++++++-- sysdeps/unix/sysv/linux/Dist | 2 + sysdeps/unix/sysv/linux/Makefile | 2 +- sysdeps/unix/sysv/linux/arm/socket.S | 6 +-- sysdeps/unix/sysv/linux/arm/sysdep.h | 6 +-- sysdeps/unix/sysv/linux/bits/resource.h | 4 +- sysdeps/unix/sysv/linux/bits/socket.h | 18 ++++---- sysdeps/unix/sysv/linux/libc-start.c | 73 ------------------------------ sysdeps/unix/sysv/linux/netash/ash.h | 34 ++++++++++++++ sysdeps/unix/sysv/linux/netpacket/packet.h | 61 +++++++++++++++++++++++++ 11 files changed, 164 insertions(+), 97 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/libc-start.c create mode 100644 sysdeps/unix/sysv/linux/netash/ash.h create mode 100644 sysdeps/unix/sysv/linux/netpacket/packet.h (limited to 'sysdeps/unix') diff --git a/sysdeps/unix/arm/brk.S b/sysdeps/unix/arm/brk.S index 0150bcde80..b3924a3d6d 100644 --- a/sysdeps/unix/arm/brk.S +++ b/sysdeps/unix/arm/brk.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1995, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 95, 97, 98 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 @@ -33,11 +33,24 @@ C_LABEL(__curbrk) .text SYSCALL__ (brk, 1) +#ifdef PIC + ldr r1, 1f + add r1, r1, pc +2: ldr r2, _cb_addr + add r1, r1, r2 +#else ldr r1, _cb_addr +#endif str r0, [r1] mov r0, $0 RETINSTR(mov, pc, r14) -_cb_addr: .long C_SYMBOL_NAME(__curbrk) - +#ifdef PIC +1: .long _GLOBAL_OFFSET_TABLE_ - 2b - 4 +_cb_addr: + .long C_SYMBOL_NAME(__curbrk)(GOTOFF) +#else +_cb_addr: + .long C_SYMBOL_NAME(__curbrk) +#endif weak_alias (__brk, brk) diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S index d59500e47a..c1da5255b0 100644 --- a/sysdeps/unix/arm/sysdep.S +++ b/sysdeps/unix/arm/sysdep.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,94,95,96,97,98 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 @@ -23,8 +23,6 @@ .globl C_SYMBOL_NAME(errno) .globl syscall_error -_errno_loc: .long C_SYMBOL_NAME(errno) - #undef syscall_error #ifdef NO_UNDERSCORES __syscall_error: @@ -38,12 +36,44 @@ syscall_error: cmp r0, $EWOULDBLOCK_sys /* Is it the old EWOULDBLOCK? */ moveq r0, $EAGAIN /* Yes; translate it to EAGAIN. */ #endif + #ifndef PIC ldr r1, _errno_loc str r0, [r1] +#ifdef _LIBC_REENTRANT + stmdb sp!, {r0, lr} + /* put another copy of r0 at a specific errno location */ + bl __errno_location + ldmia sp!, {r1, lr} + str r1, [r0] +#endif +#else + stmdb sp!,{r10, lr} + @ we have to establish our PIC register + ldr r10, 1f + add r10, pc, r10 +0: ldr r1, 2f + ldr r1, [r10, r1] + @ store a copy in _errno_loc + str r0, [r1] +#ifdef _LIBC_REENTRANT + @ and another copy in thread copy of _errno_loc + mov r10, r0 + bl __errno_location(PLT) + str r10, [r0] +#endif + ldmia sp!, {r10, lr} + b 4f +1: .word _GLOBAL_OFFSET_TABLE_ - 0b - 4 +2: .word C_SYMBOL_NAME(errno)(GOT) +4: #endif mvn r0, $0 RETINSTR(mov, pc, r14) +#ifndef PIC +_errno_loc: .long C_SYMBOL_NAME(errno) +#endif + #undef __syscall_error END (__syscall_error) diff --git a/sysdeps/unix/sysv/linux/Dist b/sysdeps/unix/sysv/linux/Dist index 4471224bcc..709f9abae5 100644 --- a/sysdeps/unix/sysv/linux/Dist +++ b/sysdeps/unix/sysv/linux/Dist @@ -22,6 +22,7 @@ net/if_slip.h net/ppp-comp.h net/ppp_defs.h net/route.h +netash/ash.h netatalk/at.h netax25/ax25.h netinet/if_fddi.h @@ -30,6 +31,7 @@ netinet/igmp.h netinet/in_systm.h netinet/ip_fw.h netinet/ip_icmp.h +netpacket/packet.h netinet/tcp.h netinet/udp.h netipx/ipx.h diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 7b53e3a399..7a73ded547 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -74,7 +74,7 @@ sysdep_headers += netinet/in_systm.h netinet/udp.h \ netinet/if_fddi.h netinet/if_tr.h netinet/igmp.h \ netinet/ip_fw.h netinet/ip_icmp.h netipx/ipx.h \ sys/socketvar.h netax25/ax25.h netrom/netrom.h \ - netrose/rose.h + netrose/rose.h netpacket/packet.h netash/ash.h endif ifeq ($(subdir),posix) diff --git a/sysdeps/unix/sysv/linux/arm/socket.S b/sysdeps/unix/sysv/linux/arm/socket.S index 1940061dda..0ff6dd0164 100644 --- a/sysdeps/unix/sysv/linux/arm/socket.S +++ b/sysdeps/unix/sysv/linux/arm/socket.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997, 1998 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 @@ -41,9 +41,9 @@ ENTRY (__socket) /* Do the system call trap. */ swi SYS_ify(socketcall) - /* %eax is < 0 if there was an error. */ + /* r0 is < 0 if there was an error. */ cmn r0, $124 - bge syscall_error + bge syscall_error(PLT) /* Successful; return the syscall's value. */ RETINSTR(mov,pc,r14) diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index af08277a63..3b7ffe08d9 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 93, 95, 96, 97 Free Software Foundation, Inc. +/* Copyright (C) 1992, 93, 95, 96, 97, 98 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, , August 1995. ARM changes by Philip Blundell, , May 1997. @@ -41,7 +41,7 @@ Since version 2.1 the return value of a system call might be negative even if the call succeeded. E.g., the `lseek' system call might return a large offset. Therefore we must not anymore test - for < 0, but test for a real error by making sure the value in %eax + for < 0, but test for a real error by making sure the value in R0 is a real error number. Linus said he will make sure the no syscall returns a value in -1 .. -4095 as a valid result so we can savely test with -4095. */ @@ -51,7 +51,7 @@ ENTRY (name) \ DO_CALL (args, syscall_name); \ cmn r0, $4096; \ - bge syscall_error; + bgt syscall_error; #undef PSEUDO_END #define PSEUDO_END(name) \ diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h index c649217e7e..faa493e7e3 100644 --- a/sysdeps/unix/sysv/linux/bits/resource.h +++ b/sysdeps/unix/sysv/linux/bits/resource.h @@ -1,5 +1,5 @@ /* Bit values & structures for resource limits. Linux version. - Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 1996, 1997, 1998 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 @@ -99,7 +99,7 @@ enum __rlimit_resource RLIMIT_NLIMITS = RLIM_NLIMITS, #undef RLIM_NLIMITS - RLIM_NLIMITS = RLIMIT_NLIMITS, + RLIM_NLIMITS = RLIMIT_NLIMITS #define RLIMIT_NLIMITS RLIMIT_NLIMITS #define RLIM_NLIMITS RLIM_NLIMITS }; diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 2b3b098926..91eec61d28 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -66,16 +66,16 @@ enum __socket_type #define PF_AAL5 8 /* Reserved for Werner's ATM. */ #define PF_X25 9 /* Reserved for X.25 project. */ #define PF_INET6 10 /* IP version 6. */ -#define PF_ROSE 11 /* Amateur Radio X.25 PLP */ -#define PF_DECnet 12 /* Reserved for DECnet project */ -#define PF_NETBEUI 13 /* Reserved for 802.2LLC project*/ -#define PF_SECURITY 14 /* Security callback pseudo AF */ -#define PF_KEY 15 /* PF_KEY key management API */ +#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */ +#define PF_DECnet 12 /* Reserved for DECnet project. */ +#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */ +#define PF_SECURITY 14 /* Security callback pseudo AF. */ +#define PF_KEY 15 /* PF_KEY key management API. */ #define PF_NETLINK 16 -#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD */ -#define PF_PACKET 17 /* Packet family */ -#define PF_ASH 18 /* Ash */ -#define PF_MAX 32 /* For now.. */ +#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */ +#define PF_PACKET 17 /* Packet family. */ +#define PF_ASH 18 /* Ash. */ +#define PF_MAX 32 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC diff --git a/sysdeps/unix/sysv/linux/libc-start.c b/sysdeps/unix/sysv/linux/libc-start.c deleted file mode 100644 index d32e54f162..0000000000 --- a/sysdeps/unix/sysv/linux/libc-start.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright (C) 1998 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library 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 -#include -#include - -extern void __libc_init_first (int argc, char **argv, char **envp); - -extern int _dl_starting_up; -weak_extern (_dl_starting_up) -extern int __libc_multiple_libcs; - -int -__libc_start_main (int (*main) (int, char **, char **), int argc, - char **argv, void (*init) (void), void (*fini) (void), - void (*rtld_fini) (void)) -{ -#ifndef PIC - /* The next variable is only here to work around a bug in gcc <= 2.7.2.2. - If the address would be taken inside the expression the optimizer - would try to be too smart and throws it away. Grrr. */ - int *dummy_addr = &_dl_starting_up; - - __libc_multiple_libcs = dummy_addr && !_dl_starting_up; -#endif - - /* Register the destructor of the dynamic linker if there is any. */ - if (rtld_fini != NULL) - atexit (rtld_fini); - - /* Set the global _environ variable correctly. */ - __environ = &argv[argc + 1]; - - /* Call the initializer of the libc. */ -#ifdef PIC - if (_dl_debug_impcalls) - _dl_debug_message (1, "\ninitialize libc\n\n", NULL); -#endif - __libc_init_first (argc, argv, __environ); - - /* Call the initializer of the program. */ -#ifdef PIC - if (_dl_debug_impcalls) - _dl_debug_message (1, "\ninitialize program: ", argv[0], "\n\n", NULL); -#endif - (*init) (); - - /* Register the destructor of the program. */ - atexit (fini); - -#ifdef PIC - if (_dl_debug_impcalls) - _dl_debug_message (1, "\ntransferring control: ", argv[0], "\n\n", NULL); -#endif - - exit ((*main) (argc, argv, __environ)); -} diff --git a/sysdeps/unix/sysv/linux/netash/ash.h b/sysdeps/unix/sysv/linux/netash/ash.h new file mode 100644 index 0000000000..e4feec44ab --- /dev/null +++ b/sysdeps/unix/sysv/linux/netash/ash.h @@ -0,0 +1,34 @@ +/* Definitions for use with Linux AF_ASH sockets. + Copyright (C) 1998 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library 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. */ + +#ifndef __NETASH_ASH_H +#define __NETASH_ASH_H 1 + +#include +#include +#include + +struct sockaddr_ash + { + _SOCKADDR_COMMON (sash_); /* Common data: address family etc. */ + int if_index; /* Interface to use. */ + int channel; /* Realtime or control. */ + }; + +#endif /* netash/ash.h */ diff --git a/sysdeps/unix/sysv/linux/netpacket/packet.h b/sysdeps/unix/sysv/linux/netpacket/packet.h new file mode 100644 index 0000000000..a382654326 --- /dev/null +++ b/sysdeps/unix/sysv/linux/netpacket/packet.h @@ -0,0 +1,61 @@ +/* Definitions for use with Linux AF_PACKET sockets. + Copyright (C) 1998 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library 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. */ + +#ifndef __NETPACKET_PACKET_H +#define __NETPACKET_PACKET_H 1 + +struct sockaddr_ll + { + unsigned short int sll_family; + unsigned short int sll_protocol; + int sll_ifindex; + unsigned short int sll_hatype; + unsigned char sll_pkttype; + unsigned char sll_halen; + unsigned char sll_addr[8]; + }; + +/* Packet types. */ + +#define PACKET_HOST 0 /* To us. */ +#define PACKET_BROADCAST 1 /* To all. */ +#define PACKET_MULTICAST 2 /* To group. */ +#define PACKET_OTHERHOST 3 /* To someone else. */ +#define PACKET_OUTGOING 4 /* Originated by us . */ +#define PACKET_LOOPBACK 5 +#define PACKET_FASTROUTE 6 + +/* Packet socket options. */ + +#define PACKET_ADD_MEMBERSHIP 1 +#define PACKET_DROP_MEMBERSHIP 2 + +struct packet_mreq + { + int mr_ifindex; + unsigned short int mr_type; + unsigned short int mr_alen; + unsigned char mr_address[8]; + }; + +#define PACKET_MR_MULTICAST 0 +#define PACKET_MR_PROMISC 1 +#define PACKET_MR_ALLMULTI 2 + +#endif /* netpacket/packet.h */ -- cgit v1.2.3