diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-03-03 13:34:35 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2005-03-03 13:34:35 +0000 |
commit | d0fec8d06cc2234c8114b51f630466eff9d5f841 (patch) | |
tree | 223a7fdae69137bd5670e59249442bc6a2db1ad1 /sysdeps | |
parent | 00e4559b612f179492ff3721f86c92498894432f (diff) |
Updated to fedora-glibc-20050302T1820
Diffstat (limited to 'sysdeps')
35 files changed, 231 insertions, 143 deletions
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 761f8daeaa..e8015ac5fe 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation inline functions. ARM version. - Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -350,13 +350,14 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc, #endif /* !dl_machine_h */ -#ifdef RESOLVE /* ARM never uses Elf32_Rela relocations for the dynamic linker. Prelinked libraries may use Elf32_Rela though. */ -# ifdef RTLD_BOOTSTRAP -# define ELF_MACHINE_NO_RELA 1 -# endif +#ifdef RTLD_BOOTSTRAP +# define ELF_MACHINE_NO_RELA 1 +#endif + +#ifdef RESOLVE /* Deal with an out-of-range PC24 reloc. */ static Elf32_Addr diff --git a/sysdeps/generic/bits/byteswap.h b/sysdeps/generic/bits/byteswap.h index 38d8540130..5f08fed613 100644 --- a/sysdeps/generic/bits/byteswap.h +++ b/sysdeps/generic/bits/byteswap.h @@ -1,5 +1,5 @@ /* Macros to swap the order of bytes in integer values. - Copyright (C) 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1997,1998,2000,2001,2002,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 @@ -29,28 +29,28 @@ # define __bswap_16(x) \ (__extension__ \ ({ unsigned short int __bsx = (x); \ - ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); })) + ((((__bsx) >> 8) & 0xffu) | (((__bsx) & 0xffu) << 8)); })) #else static __inline unsigned short int __bswap_16 (unsigned short int __bsx) { - return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8)); + return ((((__bsx) >> 8) & 0xffu) | (((__bsx) & 0xffu) << 8)); } #endif /* Swap bytes in 32 bit value. */ #ifdef __GNUC__ # define __bswap_32(x) \ - (__extension__ \ - ({ unsigned int __bsx = (x); \ - ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | \ - (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); })) + (__extension__ \ + ({ unsigned int __bsx = (x); \ + ((((__bsx) & 0xff000000u) >> 24) | (((__bsx) & 0x00ff0000u) >> 8) | \ + (((__bsx) & 0x0000ff00u) << 8) | (((__bsx) & 0x000000ffu) << 24)); })) #else static __inline unsigned int __bswap_32 (unsigned int __bsx) { - return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) | - (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24)); + return ((((__bsx) & 0xff000000u) >> 24) | (((__bsx) & 0x00ff0000u) >> 8) | + (((__bsx) & 0x0000ff00u) << 8) | (((__bsx) & 0x000000ffu) << 24)); } #endif diff --git a/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h index ce48964f14..65c8a9fe90 100644 --- a/sysdeps/generic/bits/types.h +++ b/sysdeps/generic/bits/types.h @@ -1,5 +1,5 @@ /* bits/types.h -- definitions of __*_t types underlying *_t types. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 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 @@ -114,6 +114,9 @@ typedef struct # define __ULONG32_TYPE unsigned long int # define __S64_TYPE __quad_t # define __U64_TYPE __u_quad_t +/* We want __extension__ before typedef's that use nonstandard base types + such as `long long' in C89 mode. */ +# define __STD_TYPE __extension__ typedef #elif __WORDSIZE == 64 # define __SQUAD_TYPE long int # define __UQUAD_TYPE unsigned long int @@ -123,15 +126,13 @@ typedef struct # define __ULONG32_TYPE unsigned int # define __S64_TYPE long int # define __U64_TYPE unsigned long int +/* No need to mark the typedef with __extension__. */ +# define __STD_TYPE typedef #else # error #endif #include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */ -/* We want __extension__ before typedef's that use nonstandard base types - such as `long long' in C89 mode. */ -#define __STD_TYPE __extension__ typedef - __STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */ __STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */ diff --git a/sysdeps/generic/dl-hash.h b/sysdeps/generic/dl-hash.h index a84bf2416d..243ae14b51 100644 --- a/sysdeps/generic/dl-hash.h +++ b/sysdeps/generic/dl-hash.h @@ -1,5 +1,5 @@ /* Compute hash value for given string according to ELF standard. - Copyright (C) 1995, 1996, 1997, 1998, 2003 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,1998,2003,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 @@ -25,8 +25,9 @@ first five operations no overflow is possible so we optimized it a bit. */ static unsigned int -_dl_elf_hash (const unsigned char *name) +_dl_elf_hash (const char *name_arg) { + const unsigned char *name = (const unsigned char *) name_arg; unsigned long int hash = 0; if (*name != '\0') { diff --git a/sysdeps/generic/dl-tls.c b/sysdeps/generic/dl-tls.c index 099742ceff..fdd569b587 100644 --- a/sysdeps/generic/dl-tls.c +++ b/sysdeps/generic/dl-tls.c @@ -52,7 +52,6 @@ oom (void) # endif - size_t internal_function _dl_next_tls_modid (void) @@ -98,7 +97,6 @@ _dl_next_tls_modid (void) /* The new index must indeed be exactly one higher than the previous high. */ assert (result == GL(dl_tls_max_dtv_idx) + 1); - /* There is no gap anymore. */ GL(dl_tls_dtv_gaps) = false; @@ -109,14 +107,15 @@ _dl_next_tls_modid (void) { /* No gaps, allocate a new entry. */ nogaps: + result = ++GL(dl_tls_max_dtv_idx); } return result; } -# ifdef SHARED +# ifdef SHARED void internal_function _dl_determine_tlsoffset (void) diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c index 5bb8a9b352..f0d69b443b 100644 --- a/sysdeps/generic/libc-start.c +++ b/sysdeps/generic/libc-start.c @@ -81,9 +81,9 @@ STATIC int LIBC_START_MAIN (int (*main) (int, char **, char ** __attribute__ ((noreturn)); -/* Note: the fini parameter is ignored here. It used to be registered - with __cxa_atexit. This had the disadvantage that finalizers were - called in more than one place. */ +/* Note: the fini parameter is ignored here for shared library. It + is registered with __cxa_atexit. This had the disadvantage that + finalizers were called in more than one place. */ STATIC int LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), int argc, char *__unbounded *__unbounded ubp_av, @@ -98,7 +98,6 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), void (*fini) (void), void (*rtld_fini) (void), void *__unbounded stack_end) { - char *__unbounded *__unbounded ubp_ev = &ubp_av[argc + 1]; #if __BOUNDED_POINTERS__ char **argv; #else @@ -111,6 +110,8 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), __libc_multiple_libcs = &_dl_starting_up && !_dl_starting_up; #ifndef SHARED + char *__unbounded *__unbounded ubp_ev = &ubp_av[argc + 1]; + INIT_ARGV_and_ENVIRON; /* Store the lowest stack address. This is done in ld.so if this is @@ -155,14 +156,16 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), if (__builtin_expect (rtld_fini != NULL, 1)) __cxa_atexit ((void (*) (void *)) rtld_fini, NULL, NULL); +#ifndef SHARED /* Call the initializer of the libc. This is only needed here if we are compiling for the static library in which case we haven't run the constructors in `_dl_start_user'. */ -#ifndef SHARED __libc_init_first (argc, argv, __environ); -#endif -#ifndef SHARED + /* Register the destructor of the program, if any. */ + if (fini) + __cxa_atexit ((void (*) (void *)) fini, NULL, NULL); + /* Some security at this point. Prevent starting a SUID binary where the standard file descriptors are not opened. We have to do this only for statically linked applications since otherwise the dynamic @@ -238,10 +241,10 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), terminate the entire process. */ result = 0; # ifdef SHARED - int *const ptr = __libc_pthread_functions.ptr_nthreads; + unsigned int *const ptr = __libc_pthread_functions.ptr_nthreads; # else - extern int __nptl_nthreads __attribute ((weak)); - int *const ptr = &__nptl_nthreads; + extern unsigned int __nptl_nthreads __attribute ((weak)); + unsigned int *const ptr = &__nptl_nthreads; # endif if (! atomic_decrement_and_test (ptr)) diff --git a/sysdeps/generic/libc-tls.c b/sysdeps/generic/libc-tls.c index b88ede06a2..0cf884ca08 100644 --- a/sysdeps/generic/libc-tls.c +++ b/sysdeps/generic/libc-tls.c @@ -1,5 +1,5 @@ /* Initialization code for TLS in statically linked application. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 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 @@ -34,8 +34,7 @@ extern ElfW(Phdr) *_dl_phdr; extern size_t _dl_phnum; -/* DTV with just one element plus overhead. */ -static dtv_t static_dtv[3]; +static dtv_t static_dtv[2 + TLS_SLOTINFO_SURPLUS]; static struct @@ -173,7 +172,7 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign) & ~(max_align - 1)); /* Initialize the dtv. [0] is the length, [1] the generation counter. */ - static_dtv[0].counter = 1; + static_dtv[0].counter = (sizeof (static_dtv) / sizeof (static_dtv[0])) - 2; // static_dtv[1].counter = 0; would be needed if not already done /* Initialize the TLS block. */ diff --git a/sysdeps/generic/memset_chk.c b/sysdeps/generic/memset_chk.c index c311914395..d6206ffc99 100644 --- a/sysdeps/generic/memset_chk.c +++ b/sysdeps/generic/memset_chk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1997, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1997, 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 diff --git a/sysdeps/generic/recv.c b/sysdeps/generic/recv.c index 9c28b4b306..62af8fedf2 100644 --- a/sysdeps/generic/recv.c +++ b/sysdeps/generic/recv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995, 1996, 1997, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1991,1995,1996,1997,2001,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 @@ -22,7 +22,7 @@ /* Read N bytes into BUF from socket FD. Returns the number read or -1 for errors. */ ssize_t -recv (fd, buf, n, flags) +__recv (fd, buf, n, flags) int fd; void *buf; size_t n; @@ -31,7 +31,7 @@ recv (fd, buf, n, flags) __set_errno (ENOSYS); return -1; } - +weak_alias (__recv, recv) stub_warning (recv) #include <stub-tag.h> diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 78c083f6ab..a965a4a5fc 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -299,14 +299,14 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rel *reloc, #endif /* !dl_machine_h */ -#ifdef RESOLVE_MAP - /* The i386 never uses Elf32_Rela relocations for the dynamic linker. Prelinked libraries may use Elf32_Rela though. */ #ifdef RTLD_BOOTSTRAP # define ELF_MACHINE_NO_RELA 1 #endif +#ifdef RESOLVE_MAP + /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ diff --git a/sysdeps/i386/i686/dl-hash.h b/sysdeps/i386/i686/dl-hash.h index 61183d80da..4bdd998aa8 100644 --- a/sysdeps/i386/i686/dl-hash.h +++ b/sysdeps/i386/i686/dl-hash.h @@ -1,5 +1,5 @@ /* Compute hash alue for given string according to ELF standard. - Copyright (C) 1998, 2003 Free Software Foundation, Inc. + Copyright (C) 1998, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -27,7 +27,7 @@ would be much slower than the generic C implementation. So don't use it. */ static unsigned int -_dl_elf_hash (const unsigned char *name) +_dl_elf_hash (const char *name) { unsigned int result; unsigned int temp0; @@ -71,7 +71,7 @@ _dl_elf_hash (const unsigned char *name) "jnz 2b\n" "1:\t" : "=&r" (result), "=r" (name), "=&c" (temp0), "=&r" (temp1) - : "0" (0), "1" (name)); + : "0" (0), "1" ((const unsigned char *) name)); return result; } diff --git a/sysdeps/i386/i686/memset.S b/sysdeps/i386/i686/memset.S index 561188ffec..0b47547141 100644 --- a/sysdeps/i386/i686/memset.S +++ b/sysdeps/i386/i686/memset.S @@ -1,6 +1,6 @@ /* memset/bzero -- set memory area to CH/0 Highly optimized version for ix86, x>=6. - Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. @@ -101,3 +101,9 @@ ENTRY (BP_SYM (memset)) #endif END (BP_SYM (memset)) libc_hidden_builtin_def (memset) + +#if defined PIC && !defined NOT_IN_libc && !BZERO_P +strong_alias (__memset_chk, __memset_zero_constant_len_parameter) + .section .gnu.warning.__memset_zero_constant_len_parameter + .string "memset used with constant zero length parameter; this could be due to transposed parameters" +#endif diff --git a/sysdeps/i386/i686/memset_chk.S b/sysdeps/i386/i686/memset_chk.S index d178654994..cd93d5ee10 100644 --- a/sysdeps/i386/i686/memset_chk.S +++ b/sysdeps/i386/i686/memset_chk.S @@ -1,5 +1,5 @@ -/* Checking memset for x86-64. - Copyright (C) 2004 Free Software Foundation, Inc. +/* Checking memset for i686. + Copyright (C) 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 diff --git a/sysdeps/mach/hurd/recv.c b/sysdeps/mach/hurd/recv.c index a2b8fd5be5..b001729d18 100644 --- a/sysdeps/mach/hurd/recv.c +++ b/sysdeps/mach/hurd/recv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1997, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1994,1997,2001,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 @@ -26,9 +26,8 @@ /* Read N bytes into BUF from socket FD. Returns the number read or -1 for errors. */ -/* XXX should be __recv ? */ ssize_t -recv (fd, buf, n, flags) +__recv (fd, buf, n, flags) int fd; void *buf; size_t n; @@ -62,3 +61,4 @@ recv (fd, buf, n, flags) return nread; } +weak_alias (__recv, recv) diff --git a/sysdeps/mach/hurd/setresgid.c b/sysdeps/mach/hurd/setresgid.c index d0ee412b46..5e3c7f0836 100644 --- a/sysdeps/mach/hurd/setresgid.c +++ b/sysdeps/mach/hurd/setresgid.c @@ -1,5 +1,5 @@ /* setresgid -- set effective group ID, real group ID, and saved-set group ID - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 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 @@ -75,3 +75,4 @@ __setresgid (gid_t egid, gid_t rgid, gid_t sgid) return err; } libc_hidden_def (__setresgid) +weak_alias (__setresgid, setresgid) diff --git a/sysdeps/mach/hurd/setresuid.c b/sysdeps/mach/hurd/setresuid.c index 2d05dbc850..f9d76a95ca 100644 --- a/sysdeps/mach/hurd/setresuid.c +++ b/sysdeps/mach/hurd/setresuid.c @@ -1,5 +1,5 @@ /* setresuid -- set effective user ID, real user ID, and saved-set user ID - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 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 @@ -75,3 +75,4 @@ __setresuid (uid_t euid, uid_t ruid, uid_t suid) return err; } libc_hidden_def (__setresuid) +weak_alias (__setresuid, setresuid) diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index c9081345ab..5ec7262157 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -680,7 +680,7 @@ gaih_inet (const char *name, const struct gaih_service *service, h->h_length); else { - int32_t *addr = (uint32_t *) (*pat)->addr; + uint32_t *addr = (uint32_t *) (*pat)->addr; addr[3] = *(uint32_t *) h->h_addr_list[i]; addr[2] = htonl (0xffff); addr[1] = 0; diff --git a/sysdeps/powerpc/powerpc32/dl-machine.h b/sysdeps/powerpc/powerpc32/dl-machine.h index de3b9e923a..545c19b300 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.h +++ b/sysdeps/powerpc/powerpc32/dl-machine.h @@ -204,7 +204,7 @@ extern void _dl_reloc_overflow (struct link_map *map, LOADADDR is the load address of the object; INFO is an array indexed by DT_* of the .dynamic section info. */ -inline void +auto inline void __attribute__ ((always_inline)) elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, const Elf32_Sym *sym, const struct r_found_version *version, void *const reloc_addr_arg) @@ -298,7 +298,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc, } } -static inline void +auto inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, void *const reloc_addr_arg) { @@ -306,7 +306,7 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc, *reloc_addr = l_addr + reloc->r_addend; } -static inline void +auto inline void __attribute__ ((always_inline)) elf_machine_lazy_rel (struct link_map *map, Elf32_Addr l_addr, const Elf32_Rela *reloc) { diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index 5ddc22e3c9..33fc1b6a9c 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -487,7 +487,7 @@ extern void _dl_reloc_overflow (struct link_map *map, const Elf64_Sym *refsym) attribute_hidden; -static inline void +auto inline void __attribute__ ((always_inline)) elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) { @@ -497,7 +497,7 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) /* This computes the value used by TPREL* relocs. */ -static Elf64_Addr __attribute__ ((const)) +auto inline Elf64_Addr __attribute__ ((always_inline, const)) elf_machine_tprel (struct link_map *map, struct link_map *sym_map, const Elf64_Sym *sym, @@ -518,7 +518,7 @@ elf_machine_tprel (struct link_map *map, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -static inline void +auto inline void __attribute__ ((always_inline)) elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, const Elf64_Sym *sym, @@ -803,11 +803,12 @@ elf_machine_rela (struct link_map *map, MODIFIED_CODE_NOQUEUE (reloc_addr); } -static inline void +auto inline void __attribute__ ((always_inline)) elf_machine_lazy_rel (struct link_map *map, Elf64_Addr l_addr, const Elf64_Rela *reloc) { /* elf_machine_runtime_setup handles this. */ } + #endif /* RESOLVE */ diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index b66b4f0e42..e73c6d79c3 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -256,11 +256,11 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, #endif /* !dl_machine_h */ -#ifdef RESOLVE_MAP - /* SH never uses Elf32_Rel relocations. */ #define ELF_MACHINE_NO_REL 1 +#ifdef RESOLVE_MAP + /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index 3bbce1c6fd..7b3f233566 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -16,7 +16,6 @@ oldsemctl EXTRA semctl i:iiii __old_semctl semctl@GLIBC_2.0 sigstack - sigstack 2 sigstack vfork - vfork 0 __vfork vfork -getpeername - getpeername i:ipp __getpeername getpeername getpriority - getpriority i:ii __getpriority getpriority open - open Ci:siv __libc_open __open open !__libc_open64 __open64 open64 open64 open - diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list index 31c7718d8b..c55c70ef54 100644 --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list @@ -2,7 +2,6 @@ umount2 - umount 2 __umount2 umount2 -getpeername - getpeername i:ipp __getpeername getpeername getpriority - getpriority i:ii __getpriority getpriority # semaphore and shm system calls diff --git a/sysdeps/unix/sysv/linux/libc_fatal.c b/sysdeps/unix/sysv/linux/libc_fatal.c index a79cfbabb9..c7fac6ab51 100644 --- a/sysdeps/unix/sysv/linux/libc_fatal.c +++ b/sysdeps/unix/sysv/linux/libc_fatal.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993-1995,1997,2000,2002-2004 Free Software Foundation, Inc. +/* Copyright (C) 1993-1995,1997,2000,2002-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 @@ -27,6 +27,7 @@ #include <sysdep.h> #include <unistd.h> #include <sys/syslog.h> +#include <execinfo.h> /* Abort with an error message. */ #include <not-cancel.h> @@ -141,8 +142,33 @@ __libc_message (int do_abort, const char *fmt, ...) va_end (ap_copy); if (do_abort) - /* Terminate the process. */ - abort (); + { + if (do_abort > 1 && written) + { + void *addrs[64]; +#define naddrs (sizeof (addrs) / sizeof (addrs[0])) + int n = __backtrace (addrs, naddrs); + if (n > 2) + { +#define strnsize(str) str, strlen (str) +#define writestr(str) write_not_cancel (fd, str) + writestr (strnsize ("======= Backtrace: =========\n")); + __backtrace_symbols_fd (addrs + 1, n - 1, fd); + + writestr (strnsize ("======= Memory map: ========\n")); + int fd2 = open_not_cancel_2 ("/proc/self/maps", O_RDONLY); + char buf[1024]; + ssize_t n2; + while ((n2 = read_not_cancel (fd2, buf, sizeof (buf))) > 0) + if (write_not_cancel (fd, buf, n2) != n2) + break; + close_not_cancel_no_status (fd2); + } + } + + /* Terminate the process. */ + abort (); + } } diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile index d5e4f6b72d..72fa87b3ff 100644 --- a/sysdeps/unix/sysv/linux/mips/Makefile +++ b/sysdeps/unix/sysv/linux/mips/Makefile @@ -9,11 +9,73 @@ sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h no_syscall_list_h = 1 -# Generate the list of SYS_* macros for the system calls (__NR_* macros). -# We generate not only SYS_<syscall>, pointing at SYS_<abi>_<syscall> if -# it exists, but also define SYS_<abi>_<syscall> for all ABIs. +# A callable macro that expands to a shell command. Preprocess file $(1) +# using ABI option $(2) and see which macros it defines. Print FOO for each +# macro of the form __NR$(3)_FOO, filtering out ABI-specific __NR macros +# that have a prefix other than $(3). +mips_list_syscalls = $(filter-out -m%,$(CC)) -E -x c $(+includes) \ + $(sysincludes) -D_LIBC -dM -mabi=$(2) $(1) | \ + sed -n 's@^\#define __NR$(3)_\([^ ]*\) .*@\1@p' | \ + sed -e '/^[ON]32_/d' -e '/^N64_/d' -e '/^64_/d' | \ + LC_ALL=C sort + +# Generate a list of SYS_* macros from the linux __NR macros. +# +# Before version 2.6, linux had separate 32-bit and 64-bit MIPS ports, +# each with its own set of headers. The ports were merged for 2.6 and +# this merged port defines the syscalls in a slightly different way. +# There are therefore three sets of headers that we need to consider: +# +# (1) Headers from the separate 32-bit MIPS port. They just define +# a single list of __NR macros. +# +# (2) Headers from the separate 64-bit MIPS port. They unconditionally +# define syscalls for all three ABIs, with o32 syscalls prefixed +# by __NR_O32, n32 syscalls prefixed by __NR_N32 and n64 syscalls +# prefixed by plain __NR. +# +# (3) Headers from the combined port. They use the _MIPS_SIM macro to +# define the right set of syscalls for the current ABI. The syscalls +# themselves have no special ABI prefix, but the headers also define: +# +# __NR_O32_Linux{,_syscalls} +# __NR_N32_Linux{,_syscalls} +# __NR_64_Linux{,_syscalls} +# +# In case (1) we just want a simple list of SYS_* macros. In cases (2) +# and (3) we want a file that will work for all three ABIs, regardless +# of which ABI we are currently using. We also want the file to work +# if the user later moves from (2) to (3). Thus the file we create +# for (2) and (3) has the form: +# +# #if _MIPS_SIM == _ABIN32 +# # ifdef __NR_N32_open +# # define SYS_n32syscall1 __NR_N32_n32syscall1 +# # ... +# # else +# # define SYS_n32syscall1 __NR_n32syscall1 +# # ... +# # endif +# #elif _MIPS_SIM == _ABI64 +# # define SYS_n64syscall1 __NR_n64syscall1 +# # ... +# #else +# # ifdef __NR_O32_open +# # define SYS_o32syscall1 __NR_O32_o32syscall1 +# # ... +# # else +# # define SYS_o32syscall1 __NR_o32syscall1 +# # ... +# # endif +# #endif +# +# Here, __NR_N32_open and __NR_O32_open are used to detect case (2) +# over case (3). The n64 SYS_* macros can always use the normal +# ABI-less names. $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/syscall.h $(make-target-directory) + $(CC) -E -x c $(+includes) $(sysincludes) -D_LIBC $< -MD -MP \ + -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' > /dev/null { \ echo '/* Generated at libc build time from kernel syscall list. */';\ echo ''; \ @@ -22,28 +84,38 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/s echo '#endif'; \ echo ''; \ echo '#include <sgidefs.h>'; \ - rm -f $(@:.d=.h).newt; \ - $(CC) -E -MD -MP -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' \ - -x c $(+includes) $(sysincludes) $< -D_LIBC -dM | \ - sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' \ - > $(@:.d=.h).newt; \ - if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \ + rm -f $(@:.d=.h).new32 $(@:.d=.h).newn32 $(@:.d=.h).new64; \ + $(call mips_list_syscalls,$<,n32,_N32) > $(@:.d=.h).newn32; \ + if test -s $(@:.d=.h).newn32; then \ + if grep open $(@:.d=.h).newn32 > /dev/null; then \ + $(call mips_list_syscalls,$<,32,_O32) > $(@:.d=.h).new32; \ + $(call mips_list_syscalls,$<,64,) > $(@:.d=.h).new64; \ + else \ + $(call mips_list_syscalls,$<,32,) > $(@:.d=.h).new32; \ + $(call mips_list_syscalls,$<,n32,) > $(@:.d=.h).newn32; \ + $(call mips_list_syscalls,$<,64,) > $(@:.d=.h).new64; \ + fi; \ echo '#if _MIPS_SIM == _ABIN32'; \ - sed -n 's/^\(#define SYS_\)N32_/\1/p' < $(@:.d=.h).newt | \ - LC_ALL=C sort; \ + echo '# ifdef __NR_N32_open'; \ + sed 's@\(.*\)@# define SYS_\1 __NR_N32_\1@' < $(@:.d=.h).newn32; \ + echo '# else'; \ + sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).newn32; \ + echo '# endif'; \ echo '#elif _MIPS_SIM == _ABI64'; \ - sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt | \ - LC_ALL=C sort; \ + sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).new64; \ echo '#else'; \ - sed -n 's/^\(#define SYS_\)O32_/\1/p' < $(@:.d=.h).newt | \ - LC_ALL=C sort; \ + echo '# ifdef __NR_O32_open'; \ + sed 's@\(.*\)@# define SYS_\1 __NR_O32_\1@' < $(@:.d=.h).new32; \ + echo '# else'; \ + sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).new32; \ + echo '# endif'; \ echo '#endif'; \ - sed -n '/^#define SYS_\([ON]32\|N64\)_/p' < $(@:.d=.h).newt | \ - LC_ALL=C sort +1.8; \ else \ - cat $(@:.d=.h).newt; \ + $(CC) -E -x c $(+includes) $(sysincludes) -D_LIBC -dM $< | \ + sed -n 's@^\#define __NR_\([^ ]*\) .*@\#define SYS_\1 __NR_\1@p' | \ + LC_ALL=C sort; \ fi; \ - rm $(@:.d=.h).newt; \ + rm -f $(@:.d=.h).new32 $(@:.d=.h).newn32 $(@:.d=.h).new64; \ } > $(@:.d=.h).new mv -f $(@:.d=.h).new $(@:.d=.h) ifneq (,$(objpfx)) diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure index c081795aa1..4d9568f001 100755 --- a/sysdeps/unix/sysv/linux/mips/configure +++ b/sysdeps/unix/sysv/linux/mips/configure @@ -18,7 +18,7 @@ mips*64*) { echo "$as_me:$LINENO: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&5 echo "$as_me: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&2;} echo '#include <asm/unistd.h>' > asm-unistd.h - else + elif grep __NR_N32_open "$asm_unistd_h" > /dev/null; then # The point of this preprocessing is to turn __NR_<syscall> into # __NR_N64_<syscall>, as well as to define __NR_<syscall> to # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined @@ -68,6 +68,8 @@ BEGIN { print "#include <sgidefs.h>"; } { print; }' + else + echo '#include <asm/unistd.h>' > asm-unistd.h fi ;; mips*) rm -f asm-unistd.h diff --git a/sysdeps/unix/sysv/linux/mips/configure.in b/sysdeps/unix/sysv/linux/mips/configure.in index 67d965dfda..e2e5d16c55 100644 --- a/sysdeps/unix/sysv/linux/mips/configure.in +++ b/sysdeps/unix/sysv/linux/mips/configure.in @@ -18,7 +18,7 @@ mips*64*) if test ! -f "$asm_unistd_h"; then AC_MSG_WARN([*** asm/unistd.h not found, it will not be pre-processed]) echo '#include <asm/unistd.h>' > asm-unistd.h - else + elif grep __NR_N32_open "$asm_unistd_h" > /dev/null; then # The point of this preprocessing is to turn __NR_<syscall> into # __NR_N64_<syscall>, as well as to define __NR_<syscall> to # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined @@ -68,6 +68,8 @@ BEGIN { print "#include <sgidefs.h>"; } { print; }' + else + echo '#include <asm/unistd.h>' > asm-unistd.h fi ;; mips*) rm -f asm-unistd.h diff --git a/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h index b0316b657b..e69de29bb2 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h @@ -1,36 +0,0 @@ -/* Copyright (C) 2000, 2002, 2003 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. */ - -#ifndef _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H -#define _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H 1 - -/* There is some commonality. */ -#include <sysdeps/unix/sysv/linux/mips/mips32/sysdep.h> - -/* For Linux we can use the system call table in the header file - /usr/include/asm/unistd.h - of the kernel. But these symbols do not follow the SYS_* syntax - so we have to redefine the `SYS_ify' macro here. */ -#undef SYS_ify -#ifdef __STDC__ -# define SYS_ify(syscall_name) __NR_O32_##syscall_name -#else -# define SYS_ify(syscall_name) __NR_O32_/**/syscall_name -#endif - -#endif /* linux/mips/mips32/kern64/sysdep.h */ diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h index be343aabca..e6013669a4 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2000, 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 @@ -28,9 +28,9 @@ so we have to redefine the `SYS_ify' macro here. */ #undef SYS_ify #ifdef __STDC__ -# define SYS_ify(syscall_name) __NR_N32_##syscall_name +# define SYS_ify(syscall_name) __NR_##syscall_name #else -# define SYS_ify(syscall_name) __NR_N32_/**/syscall_name +# define SYS_ify(syscall_name) __NR_/**/syscall_name #endif #ifdef __ASSEMBLER__ diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h index f30a465081..dc0a1a0edc 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2000, 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 @@ -28,9 +28,9 @@ so we have to redefine the `SYS_ify' macro here. */ #undef SYS_ify #ifdef __STDC__ -# define SYS_ify(syscall_name) __NR_N64_##syscall_name +# define SYS_ify(syscall_name) __NR_##syscall_name #else -# define SYS_ify(syscall_name) __NR_N64_/**/syscall_name +# define SYS_ify(syscall_name) __NR_/**/syscall_name #endif #ifdef __ASSEMBLER__ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h index 2ee3e60229..81f37c5103 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,1997-2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1992,1997-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 @@ -109,7 +109,7 @@ # undef INTERNAL_SYSCALL_ERROR_P # define INTERNAL_SYSCALL_ERROR_P(val, err) \ - (__builtin_expect (err & (1 << 28), 0)) + ((void) (val), __builtin_expect ((err) & (1 << 28), 0)) # undef INTERNAL_SYSCALL_ERRNO # define INTERNAL_SYSCALL_ERRNO(val, err) (val) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index 38a376fa90..17bfa9014f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. +/* Copyright (C) 1992,1997,1998,1999,2000,2001,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 @@ -122,7 +122,7 @@ #undef INTERNAL_SYSCALL_ERROR_P #define INTERNAL_SYSCALL_ERROR_P(val, err) \ - (__builtin_expect (err & (1 << 28), 0)) + ((void) (err), __builtin_expect ((err) & (1 << 28), 0)) #undef INTERNAL_SYSCALL_ERRNO #define INTERNAL_SYSCALL_ERRNO(val, err) (val) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list index 477f8a9f09..791ab9ba52 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list +++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list @@ -1,6 +1,5 @@ # File name Caller Syscall name # args Strong name Weak names -getpeername - getpeername i:ipp __getpeername getpeername vfork - vfork 0 __vfork vfork # semaphore and shm system calls diff --git a/sysdeps/unix/sysv/linux/sys/kd.h b/sysdeps/unix/sysv/linux/sys/kd.h index e0d2e869cf..d459c079ed 100644 --- a/sysdeps/unix/sysv/linux/sys/kd.h +++ b/sysdeps/unix/sysv/linux/sys/kd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 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 @@ -21,9 +21,15 @@ /* Make sure the <linux/types.h> header is not loaded. */ #ifndef _LINUX_TYPES_H -# define _LINUX_TYPES_H 1 +# define _LINUX_TYPES_H 1 +# define __undef_LINUX_TYPES_H #endif #include <linux/kd.h> +#ifdef __undef_LINUX_TYPES_H +# undef _LINUX_TYPES_H +# undef __undef_LINUX_TYPES_H +#endif + #endif /* sys/kd.h */ diff --git a/sysdeps/x86_64/memset.S b/sysdeps/x86_64/memset.S index 6c47f4c863..6b718b7126 100644 --- a/sysdeps/x86_64/memset.S +++ b/sysdeps/x86_64/memset.S @@ -1,6 +1,6 @@ /* memset/bzero -- set memory area to CH/0 Optimized version for x86-64. - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>. @@ -138,3 +138,9 @@ END (memset) #if !BZERO_P libc_hidden_builtin_def (memset) #endif + +#if !BZERO_P && defined PIC && !defined NOT_IN_libc +strong_alias (__memset_chk, __memset_zero_constant_len_parameter) + .section .gnu.warning.__memset_zero_constant_len_parameter + .string "memset used with constant zero length parameter; this could be due to transposed parameters" +#endif diff --git a/sysdeps/x86_64/memset_chk.S b/sysdeps/x86_64/memset_chk.S index e62cb58cc0..c1c8c23f90 100644 --- a/sysdeps/x86_64/memset_chk.S +++ b/sysdeps/x86_64/memset_chk.S @@ -1,5 +1,5 @@ /* Checking memset for x86-64. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 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 |