summaryrefslogtreecommitdiff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-03-03 13:34:35 +0000
committerJakub Jelinek <jakub@redhat.com>2005-03-03 13:34:35 +0000
commitd0fec8d06cc2234c8114b51f630466eff9d5f841 (patch)
tree223a7fdae69137bd5670e59249442bc6a2db1ad1 /sysdeps/generic
parent00e4559b612f179492ff3721f86c92498894432f (diff)
Updated to fedora-glibc-20050302T1820
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/bits/byteswap.h18
-rw-r--r--sysdeps/generic/bits/types.h11
-rw-r--r--sysdeps/generic/dl-hash.h5
-rw-r--r--sysdeps/generic/dl-tls.c5
-rw-r--r--sysdeps/generic/libc-start.c23
-rw-r--r--sysdeps/generic/libc-tls.c7
-rw-r--r--sysdeps/generic/memset_chk.c2
-rw-r--r--sysdeps/generic/recv.c6
8 files changed, 40 insertions, 37 deletions
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>