mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
* elf/dl-misc.c: Include <sysdep.h>.
(_dl_debug_vdprintf): Only take dl_load_lock if not _dl_starting_up. * sysdeps/generic/ldsodefs.h (_dl_starting_up): Declare it here. * sysdeps/unix/sysv/linux/init-first.c: Not here. * sysdeps/powerpc/elf/libc-start.c: Or here. * sysdeps/unix/sysv/aix/libc-start.c: Or here. * sysdeps/unix/sysv/aix/start-libc.c: Or here. * sysdeps/unix/sysv/aix/init-first.c: Or here. * sysdeps/generic/libc-start.c: Or here. * sysdeps/unix/sysv/linux/init-first.c (init): Protect _dl_starting_up access with [! SHARED]. * sysdeps/unix/sysv/aix/init-first.c (init): Likewise.
This commit is contained in:
14
ChangeLog
14
ChangeLog
@ -1,5 +1,8 @@
|
|||||||
2002-10-24 Jakub Jelinek <jakub@redhat.com>
|
2002-10-24 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* elf/dl-misc.c: Include <sysdep.h>.
|
||||||
|
(_dl_debug_vdprintf): Only take dl_load_lock if not _dl_starting_up.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (INTERNAL_SYSCALL,
|
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (INTERNAL_SYSCALL,
|
||||||
INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): New macros.
|
INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): New macros.
|
||||||
(INLINE_SYSCALL): Use that.
|
(INLINE_SYSCALL): Use that.
|
||||||
@ -27,6 +30,17 @@
|
|||||||
|
|
||||||
2002-10-24 Roland McGrath <roland@redhat.com>
|
2002-10-24 Roland McGrath <roland@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/generic/ldsodefs.h (_dl_starting_up): Declare it here.
|
||||||
|
* sysdeps/unix/sysv/linux/init-first.c: Not here.
|
||||||
|
* sysdeps/powerpc/elf/libc-start.c: Or here.
|
||||||
|
* sysdeps/unix/sysv/aix/libc-start.c: Or here.
|
||||||
|
* sysdeps/unix/sysv/aix/start-libc.c: Or here.
|
||||||
|
* sysdeps/unix/sysv/aix/init-first.c: Or here.
|
||||||
|
* sysdeps/generic/libc-start.c: Or here.
|
||||||
|
* sysdeps/unix/sysv/linux/init-first.c (init): Protect _dl_starting_up
|
||||||
|
access with [! SHARED].
|
||||||
|
* sysdeps/unix/sysv/aix/init-first.c (init): Likewise.
|
||||||
|
|
||||||
* libio/bug-wfflush.c: New file.
|
* libio/bug-wfflush.c: New file.
|
||||||
* libio/Makefile (tests): Add bug-wfflush.
|
* libio/Makefile (tests): Add bug-wfflush.
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
#include <sysdep.h>
|
||||||
#include <stdio-common/_itoa.h>
|
#include <stdio-common/_itoa.h>
|
||||||
#include <bits/libc-lock.h>
|
#include <bits/libc-lock.h>
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Bare-bone printf implementation. This function only knows about
|
/* Bare-bones printf implementation. This function only knows about
|
||||||
the formats and flags needed and can handle only up to 64 stripes in
|
the formats and flags needed and can handle only up to 64 stripes in
|
||||||
the output. */
|
the output. */
|
||||||
static void
|
static void
|
||||||
@ -250,10 +251,17 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg)
|
|||||||
INTERNAL_SYSCALL (writev, 3, fd, iov, niov);
|
INTERNAL_SYSCALL (writev, 3, fd, iov, niov);
|
||||||
#elif RTLD_PRIVATE_ERRNO
|
#elif RTLD_PRIVATE_ERRNO
|
||||||
/* We have to take this lock just to be sure we don't clobber the private
|
/* We have to take this lock just to be sure we don't clobber the private
|
||||||
errno when it's being used by another thread that cares about it. */
|
errno when it's being used by another thread that cares about it.
|
||||||
__libc_lock_lock_recursive (GL(dl_load_lock));
|
Yet we must be sure not to try calling the lock functions before
|
||||||
__writev (fd, iov, niov);
|
the thread library is fully initialized. */
|
||||||
__libc_lock_unlock_recursive (GL(dl_load_lock));
|
if (__builtin_expect (INTUSE (_dl_starting_up), 0))
|
||||||
|
__writev (fd, iov, niov);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
__libc_lock_lock_recursive (GL(dl_load_lock));
|
||||||
|
__writev (fd, iov, niov);
|
||||||
|
__libc_lock_unlock_recursive (GL(dl_load_lock));
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
__writev (fd, iov, niov);
|
__writev (fd, iov, niov);
|
||||||
#endif
|
#endif
|
||||||
|
@ -416,6 +416,13 @@ extern const char _dl_out_of_memory[];
|
|||||||
extern const char _dl_out_of_memory_internal[] attribute_hidden;
|
extern const char _dl_out_of_memory_internal[] attribute_hidden;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHARED
|
||||||
|
/* Flag set at startup and cleared when the last initializer has run. */
|
||||||
|
extern int _dl_starting_up;
|
||||||
|
weak_extern (_dl_starting_up)
|
||||||
|
#elif defined IS_IN_rtld
|
||||||
|
extern int _dl_starting_up_internal attribute_hidden;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* OS-dependent function to open the zero-fill device. */
|
/* OS-dependent function to open the zero-fill device. */
|
||||||
extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */
|
extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
|
|
||||||
extern void __libc_init_first (int argc, char **argv, char **envp);
|
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;
|
extern int __libc_multiple_libcs;
|
||||||
extern void *__libc_stack_end;
|
extern void *__libc_stack_end;
|
||||||
|
|
||||||
|
@ -24,9 +24,6 @@
|
|||||||
|
|
||||||
extern void __libc_init_first (int argc, char **argv, char **envp);
|
extern void __libc_init_first (int argc, char **argv, char **envp);
|
||||||
|
|
||||||
extern int _dl_starting_up;
|
|
||||||
weak_extern (_dl_starting_up)
|
|
||||||
|
|
||||||
extern int __cache_line_size;
|
extern int __cache_line_size;
|
||||||
weak_extern (__cache_line_size)
|
weak_extern (__cache_line_size)
|
||||||
|
|
||||||
|
@ -37,9 +37,6 @@ extern void __libc_init (int, char **, char **);
|
|||||||
/* The function is called from assembly stubs the compiler can't see. */
|
/* The function is called from assembly stubs the compiler can't see. */
|
||||||
static void init (int, char **, char **) __attribute__ ((unused));
|
static void init (int, char **, char **) __attribute__ ((unused));
|
||||||
|
|
||||||
extern int _dl_starting_up;
|
|
||||||
weak_extern (_dl_starting_up)
|
|
||||||
|
|
||||||
/* Set nonzero if we have to be prepared for more then one libc being
|
/* Set nonzero if we have to be prepared for more then one libc being
|
||||||
used in the process. Safe assumption if initializer never runs. */
|
used in the process. Safe assumption if initializer never runs. */
|
||||||
int __libc_multiple_libcs attribute_hidden = 1;
|
int __libc_multiple_libcs attribute_hidden = 1;
|
||||||
@ -60,10 +57,12 @@ init (int argc, char **argv, char **envp)
|
|||||||
If the address would be taken inside the expression the optimizer
|
If the address would be taken inside the expression the optimizer
|
||||||
would try to be too smart and throws it away. Grrr. */
|
would try to be too smart and throws it away. Grrr. */
|
||||||
|
|
||||||
|
#ifndef SHARED
|
||||||
/* XXX disable dl for now
|
/* XXX disable dl for now
|
||||||
int *dummy_addr = &_dl_starting_up;
|
int *dummy_addr = &_dl_starting_up;
|
||||||
|
|
||||||
__libc_multiple_libcs = dummy_addr && !_dl_starting_up; */
|
__libc_multiple_libcs = dummy_addr && !_dl_starting_up; */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Save the command-line arguments. */
|
/* Save the command-line arguments. */
|
||||||
__libc_argc = argc;
|
__libc_argc = argc;
|
||||||
|
@ -31,8 +31,6 @@ typedef unsigned char uchar;
|
|||||||
extern void __libc_init_first (int argc, char **argv, char **envp);
|
extern void __libc_init_first (int argc, char **argv, char **envp);
|
||||||
|
|
||||||
/* XXX disable for now
|
/* XXX disable for now
|
||||||
extern int _dl_starting_up;
|
|
||||||
weak_extern (_dl_starting_up)
|
|
||||||
extern int __libc_multiple_libcs; */
|
extern int __libc_multiple_libcs; */
|
||||||
|
|
||||||
/* XXX normally defined in generic/dl-sydep.c, hack it into existance
|
/* XXX normally defined in generic/dl-sydep.c, hack it into existance
|
||||||
|
@ -31,8 +31,6 @@ typedef unsigned char uchar;
|
|||||||
extern void __libc_init_first (int argc, char **argv, char **envp);
|
extern void __libc_init_first (int argc, char **argv, char **envp);
|
||||||
|
|
||||||
/* XXX disable for now
|
/* XXX disable for now
|
||||||
extern int _dl_starting_up;
|
|
||||||
weak_extern (_dl_starting_up)
|
|
||||||
extern int __libc_multiple_libcs; */
|
extern int __libc_multiple_libcs; */
|
||||||
|
|
||||||
/* XXX normally defined in generic/dl-sydep.c, hack it into existance
|
/* XXX normally defined in generic/dl-sydep.c, hack it into existance
|
||||||
|
@ -35,9 +35,6 @@
|
|||||||
/* The function is called from assembly stubs the compiler can't see. */
|
/* The function is called from assembly stubs the compiler can't see. */
|
||||||
static void init (int, char **, char **) __attribute__ ((unused));
|
static void init (int, char **, char **) __attribute__ ((unused));
|
||||||
|
|
||||||
extern int _dl_starting_up;
|
|
||||||
weak_extern (_dl_starting_up)
|
|
||||||
|
|
||||||
/* Set nonzero if we have to be prepared for more then one libc being
|
/* Set nonzero if we have to be prepared for more then one libc being
|
||||||
used in the process. Safe assumption if initializer never runs. */
|
used in the process. Safe assumption if initializer never runs. */
|
||||||
int __libc_multiple_libcs attribute_hidden = 1;
|
int __libc_multiple_libcs attribute_hidden = 1;
|
||||||
@ -54,12 +51,15 @@ init (int argc, char **argv, char **envp)
|
|||||||
#ifdef USE_NONOPTION_FLAGS
|
#ifdef USE_NONOPTION_FLAGS
|
||||||
extern void __getopt_clean_environment (char **);
|
extern void __getopt_clean_environment (char **);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SHARED
|
||||||
/* The next variable is only here to work around a bug in gcc <= 2.7.2.2.
|
/* 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
|
If the address would be taken inside the expression the optimizer
|
||||||
would try to be too smart and throws it away. Grrr. */
|
would try to be too smart and throws it away. Grrr. */
|
||||||
int *dummy_addr = &_dl_starting_up;
|
int *dummy_addr = &_dl_starting_up;
|
||||||
|
|
||||||
__libc_multiple_libcs = dummy_addr && !_dl_starting_up;
|
__libc_multiple_libcs = dummy_addr && !_dl_starting_up;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Make sure we don't initialize twice. */
|
/* Make sure we don't initialize twice. */
|
||||||
if (!__libc_multiple_libcs)
|
if (!__libc_multiple_libcs)
|
||||||
|
Reference in New Issue
Block a user