Move global variables for SHARED code in struct _rtld_global. Export

this struct, remove all exports for the signal variables.
This commit is contained in:
Ulrich Drepper 2002-02-01 01:32:06 +00:00
parent 6fbd2f3d0c
commit f71d7f5726
11 changed files with 68 additions and 77 deletions

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. Alpha version.
Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <rth@tamu.edu>.
@ -110,11 +110,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
{
*(Elf64_Addr *)(plt + 16) = (Elf64_Addr) &_dl_runtime_profile;
if (_dl_name_match_p (_dl_profile, l))
if (_dl_name_match_p (GL(dl_profile), l))
{
/* This is the object we are looking for. Say that we really
want profiling and the timers are started. */
_dl_profile_map = l;
GL(dl_profile_map) = l;
}
}
@ -328,7 +328,7 @@ $fixup_stack_ret: \n\
" RTLD_START_SPECIAL_INIT " \n\
/* Call _dl_init(_dl_loaded, argc, argv, envp) to run \n\
initializers. */ \n\
ldq $16, _dl_loaded \n\
ldq $16, _rtld_global \n\
ldq $17, 0($sp) \n\
lda $18, 8($sp) \n\
s8addq $17, 8, $19 \n\
@ -498,7 +498,7 @@ elf_machine_rela (struct link_map *map,
{
unsigned long int const r_type = ELF64_R_TYPE (reloc->r_info);
#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
#if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC && !defined SHARED
/* This is defined in rtld.c, but nowhere in the static libc.a; make the
reference weak so static programs can still link. This declaration
cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP)
@ -515,7 +515,7 @@ elf_machine_rela (struct link_map *map,
{
# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
/* Already done in dynamic linker. */
if (map != &_dl_rtld_map)
if (map != &GL(dl_rtld_map))
# endif
{
/* XXX Make some timings. Maybe it's preverable to test for

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. ARM version.
Copyright (C) 1995,96,97,98,99,2000,2001 Free Software Foundation, Inc.
Copyright (C) 1995,96,97,98,99,2000,2001,2002 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,10 +109,10 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
{
got[2] = (Elf32_Addr) &_dl_runtime_profile;
if (_dl_name_match_p (_dl_profile, l))
if (_dl_name_match_p (GL(dl_profile), l))
/* Say that we really want profiling and the timers are
started. */
_dl_profile_map = l;
GL(dl_profile_map) = l;
}
else
/* This function will get called to fix up the GOT entry indicated by
@ -324,7 +324,7 @@ _dl_start_user:
.L_STACK_END:
.word __libc_stack_end(GOT)
.L_LOADED:
.word _dl_loaded(GOT)
.word _rtld_global(GOT)
.previous\n\
");
@ -347,14 +347,12 @@ _dl_start_user:
_dl_sysdep_start. */
#define DL_PLATFORM_INIT dl_platform_init ()
extern const char *_dl_platform;
static inline void __attribute__ ((unused))
dl_platform_init (void)
{
if (_dl_platform != NULL && *_dl_platform == '\0')
if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0')
/* Avoid an empty string which would disturb us. */
_dl_platform = NULL;
GL(dl_platform) = NULL;
}
static inline Elf32_Addr
@ -452,7 +450,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
found. */
break;
if (sym->st_size > refsym->st_size
|| (_dl_verbose && sym->st_size < refsym->st_size))
|| (GL(dl_verbose) && sym->st_size < refsym->st_size))
{
const char *strtab;
@ -484,7 +482,9 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP) because
rtld.c contains the common defn for _dl_rtld_map, which
is incompatible with a weak decl in the same file. */
# ifndef SHARED
weak_extern (_dl_rtld_map);
# endif
if (map == &_dl_rtld_map)
/* Undo the relocation done here during bootstrapping.
Now we will relocate it anew, possibly using a

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. CRIS version.
Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
Copyright (C) 1996-2001, 2002 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
@ -106,11 +106,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
{
got[2] = (Elf32_Addr) &_dl_runtime_profile;
if (_dl_name_match_p (_dl_profile, l))
if (_dl_name_match_p (GL(dl_profile), l))
{
/* This is the object we are looking for. Say that we really
want profiling and the timers are started. */
_dl_profile_map = l;
GL(dl_profile_map) = l;
}
}
else
@ -212,7 +212,7 @@ _dl_start_user:
move.d $sp,$r12
addq 4,$r12
; main_map: at _dl_loaded.
move.d [$r0+_dl_loaded:GOT16],$r9
move.d [$r0+_rtld_global:GOT16],$r9
move.d [$r9],$r10
move.d _dl_init:PLTG,$r9
add.d $r0,$r9
@ -246,14 +246,12 @@ _dl_start_user:
_dl_sysdep_start. */
#define DL_PLATFORM_INIT dl_platform_init ()
extern const char *_dl_platform;
static inline void __attribute__ ((unused))
dl_platform_init (void)
{
if (_dl_platform != NULL && *_dl_platform == '\0')
if (GL(dl_platform) != NULL && *GL(dl_platform) == '\0')
/* Avoid an empty string which would disturb us. */
_dl_platform = NULL;
GL(dl_platform) = NULL;
}
static inline Elf32_Addr
@ -314,7 +312,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
found. */
break;
if (sym->st_size > refsym->st_size
|| (_dl_verbose && sym->st_size < refsym->st_size))
|| (GL(dl_verbose) && sym->st_size < refsym->st_size))
{
extern char **_dl_argv;
const char *strtab;

View File

@ -1,5 +1,5 @@
/* Make dynamic PLABELs for function pointers. HPPA version.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2002 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
@ -44,10 +44,9 @@ static int __hppa_fptr_lock = 1;
#ifdef MAP_ANON
/* The fd is not examined when using MAP_ANON. */
#define ANONFD -1
# define ANONFD -1
#else
extern int _dl_zerofd;
#define ANONFD _dl_zerofd
# define ANONFD GL(dl_zerofd)
#endif
struct hppa_fptr __boot_ldso_fptr[HPPA_BOOT_FPTR_SIZE];
@ -95,10 +94,10 @@ __hppa_make_fptr (const struct link_map *sym_map, Elf32_Addr value,
{
#ifndef MAP_ANON
# define MAP_ANON 0
if (_dl_zerofd == -1)
if (GL(dl_zerofd) == -1)
{
_dl_zerofd = _dl_sysdep_open_zero_fill ();
if (_dl_zerofd == -1)
GL(dl_zerofd) = _dl_sysdep_open_zero_fill ();
if (GL(dl_zerofd) == -1)
{
__close (fd);
_dl_signal_error (errno, NULL, NULL,
@ -107,11 +106,11 @@ __hppa_make_fptr (const struct link_map *sym_map, Elf32_Addr value,
}
#endif
__fptr_next = __mmap (0, _dl_pagesize, PROT_READ | PROT_WRITE,
__fptr_next = __mmap (0, GL(dl_pagesize), PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, ANONFD, 0);
if (__fptr_next == MAP_FAILED)
_dl_signal_error(errno, NULL, NULL, "cannot map page for fptr");
__fptr_count = _dl_pagesize / sizeof (struct hppa_fptr);
__fptr_count = GL(dl_pagesize) / sizeof (struct hppa_fptr);
}
f = __fptr_next++;
__fptr_count--;

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. PA-RISC version.
Copyright (C) 1995,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
Copyright (C) 1995-1997,1999,2000,2001,2002 Free Software Foundation, Inc.
Contributed by David Huggins-Daines <dhd@debian.org>
This file is part of the GNU C Library.
@ -227,12 +227,12 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
((unsigned long) &_dl_runtime_resolve & ~3))->func;
else
{
if (_dl_name_match_p (_dl_profile, l))
if (_dl_name_match_p (GL(dl_profile), l))
{
/* This is the object we are looking for. Say that
we really want profiling and the timers are
started. */
_dl_profile_map = l;
GL(dl_profile_map) = l;
}
got[-2] =
(Elf32_Addr) ((struct hppa_fptr *)
@ -362,8 +362,8 @@ asm ( \
" stw %r24,-44(%sp)\n" \
\
".Lnofix:\n" \
" addil LT'_dl_loaded,%r19\n" \
" ldw RT'_dl_loaded(%r1),%r26\n" \
" addil LT'_rtld_global,%r19\n" \
" ldw RT'_rtld_global(%r1),%r26\n" \
" bl set_dp, %r2\n" \
" ldw 0(%r26),%r26\n" \
\
@ -488,13 +488,13 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
struct link_map *sym_map;
Elf32_Addr value;
#ifndef RTLD_BOOTSTRAP
#if !defined RTLD_BOOTSTRAP && !defined SHARED
/* This is defined in rtld.c, but nowhere in the static libc.a; make the
reference weak so static programs can still link. This declaration
cannot be done when compiling rtld.c (i.e. #ifdef RTLD_BOOTSTRAP)
because rtld.c contains the common defn for _dl_rtld_map, which is
incompatible with a weak decl in the same file. */
weak_extern (_dl_rtld_map);
weak_extern (GL(dl_rtld_map));
#endif
/* RESOLVE_MAP will return a null value for undefined syms, and
@ -527,7 +527,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
other ones will have their values reset. In particular,
__fptr_next will be reset, sometimes causing endless loops in
__hppa_make_fptr(). So don't do that. */
if (map == &_dl_rtld_map)
if (map == &GL(dl_rtld_map))
return;
#endif
/* .eh_frame can have unaligned relocs. */
@ -604,7 +604,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
break;
if (__builtin_expect (sym->st_size > refsym->st_size, 0)
|| (__builtin_expect (sym->st_size < refsym->st_size, 0)
&& __builtin_expect (_dl_verbose, 0)))
&& __builtin_expect (GL(dl_verbose), 0)))
{
const char *strtab;

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. m68k version.
Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
Copyright (C) 1996-2001, 2002 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
@ -85,11 +85,11 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
{
got[2] = (Elf32_Addr) &_dl_runtime_profile;
if (_dl_name_match_p (_dl_profile, l))
if (_dl_name_match_p (GL(dl_profile), l))
{
/* This is the object we are looking for. Say that we really
want profiling and the timers are started. */
_dl_profile_map = l;
GL(dl_profile_map) = l;
}
}
else
@ -176,7 +176,7 @@ _dl_start_user:
pea 8(%sp, %d1*4)
pea 8(%sp)
move.l %d1, -(%sp)
move.l ([_dl_loaded@GOT.w, %a5]), -(%sp)
move.l ([_rtld_global@GOT.w, %a5]), -(%sp)
jbsr _dl_init@PLTPC
addq.l #8, %sp
addq.l #8, %sp
@ -251,7 +251,7 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
found. */
break;
if (sym->st_size > refsym->st_size
|| (sym->st_size < refsym->st_size && _dl_verbose))
|| (sym->st_size < refsym->st_size && GL(dl_verbose)))
{
extern char **_dl_argv;
const char *strtab;

View File

@ -216,7 +216,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
}
{
struct link_map *l = _dl_loaded;
struct link_map *l = GL(dl_loaded);
while (l)
{
@ -441,7 +441,7 @@ _dl_start_user:\n\
# Save back the modified argument count.\n\
sw $4, 0($29)\n\
1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\
lw $4, _dl_loaded\n\
lw $4, _rtld_global\n\
lw $5, 0($29)\n\
la $6, 4($29)\n\
sll $7, $5, 2\n\
@ -477,14 +477,14 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
{
const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
#ifndef RTLD_BOOTSTRAP
#if !defined RTLD_BOOTSTRAP && !defined SHARED
/* This is defined in rtld.c, but nowhere in the static libc.a;
make the reference weak so static programs can still link. This
declaration cannot be done when compiling rtld.c (i.e. #ifdef
RTLD_BOOTSTRAP) because rtld.c contains the common defn for
_dl_rtld_map, which is incompatible with a weak decl in the same
file. */
weak_extern (_dl_rtld_map);
weak_extern (GL(dl_rtld_map));
#endif
switch (r_type)
@ -501,7 +501,7 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
if (symidx < gotsym)
{
#ifndef RTLD_BOOTSTRAP
if (map != &_dl_rtld_map)
if (map != &GL(dl_rtld_map))
#endif
*reloc_addr += sym->st_value + map->l_addr;
}
@ -520,7 +520,7 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
}
else
#ifndef RTLD_BOOTSTRAP
if (map != &_dl_rtld_map)
if (map != &GL(dl_rtld_map))
#endif
*reloc_addr += map->l_addr;
}
@ -561,7 +561,7 @@ elf_machine_got_rel (struct link_map *map, int lazy)
({ \
const ElfW(Sym) *ref = sym; \
const struct r_found_version *version \
= vernum ? &map->l_versions [vernum [sym_index]] : NULL; \
= vernum ? &map->l_versions[vernum[sym_index]] : NULL; \
ElfW(Addr) value; \
value = RESOLVE (&ref, version, R_MIPS_REL32); \
(ref)? value + ref->st_value: 0; \
@ -576,7 +576,7 @@ elf_machine_got_rel (struct link_map *map, int lazy)
n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;
/* The dynamic linker's local got entries have already been relocated. */
if (map != &_dl_rtld_map)
if (map != &GL(dl_rtld_map))
{
/* got[0] is reserved. got[1] is also reserved for the dynamic object
generated by gnu ld. Skip these reserved entries from relocation. */

View File

@ -1,5 +1,5 @@
/* Machine-dependent ELF dynamic relocation inline functions. MIPS64 version.
Copyright (C) 1996, 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1996,1997,1999,2000,2001,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
@ -289,7 +289,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
}
{
struct link_map *l = _dl_loaded;
struct link_map *l = GL(dl_loaded);
while (l)
{
@ -480,7 +480,7 @@ _dl_start_user:\n\
# Save back the modified argument count.\n\
sd $4, 0($29)\n\
1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\
ld $4, _dl_loaded\n\
ld $4, _rtld_global\n\
ld $5, 0($29)\n\
dla $6, 4($29)\n\
dla $7, 8($29)\n\
@ -492,7 +492,7 @@ _dl_start_user:\n\
dla $31, _dl_fini\n\
# Jump to the user entry point.\n\
1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\
lw $4, _dl_loaded\n\
lw $4, _rtld_global\n\
lw $5, 0($29)\n\
la $6, 4($29)\n\
la $7, 8($29)\n\
@ -553,8 +553,10 @@ elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
RTLD_BOOTSTRAP) because rtld.c contains the common defn for
_dl_rtld_map, which is incompatible with a weak decl in the same
file. */
weak_extern (_dl_rtld_map);
if (map == &_dl_rtld_map)
# ifndef SHARED
weak_extern (GL(dl_rtld_map));
# endif
if (map == &GL(dl_rtld_map))
/* Undo the relocation done here during bootstrapping. Now we will
relocate it anew, possibly using a binding found in the user
program or a loaded library rather than the dynamic linker's

View File

@ -1,5 +1,5 @@
/* Initialization code run first thing by the XCOFF startup code. AIX version.
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001, 2002 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
@ -73,10 +73,6 @@ extern int __loadx (int flag, void *module, void *arg1, void *arg2,
/* Needed by setenv */
char **__environ;
/* Needed by dl-support.c */
/* XXX stubbing out dl-support.c for now..
size_t _dl_pagesize = 0; */
/*
* Find __rtinit symbol
*
@ -277,7 +273,7 @@ __libc_start_main (void)
/* Call the initializer of the program, if any. */
#ifdef SHARED
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ninitialize program: %s\n\n",
__libc_start_data.argv[0]);
#endif
@ -285,7 +281,7 @@ __libc_start_main (void)
(*__libc_start_data.init) ();
#ifdef SHARED
if (__builtin_expect (_dl_debug_mask & DL_DEBUG_IMPCALLS, 0))
if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
_dl_debug_printf ("\ntransferring control: %s\n\n",
__libc_start_data.argv[0]);
#endif

View File

@ -1,5 +1,5 @@
/* Initialization code run first thing by the XCOFF startup code. AIX version.
Copyright (C) 2001 Free Software Foundation, Inc.
Copyright (C) 2001, 2002 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
@ -74,10 +74,6 @@ extern int __loadx (int flag, void *module, void *arg1, void *arg2,
/* Needed by setenv */
char **__environ;
/* Needed by dl-support.c */
/* XXX stubbing out dl-support.c for now..
size_t _dl_pagesize = 0; */
/*
Find __rtinit symbol

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000 Free Software Foundation, Inc.
/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@suse.de>.
@ -21,6 +21,7 @@
#include <sys/param.h>
#include <errno.h>
#include <ldsodefs.h>
#include <sysdep.h>
#include <sys/syscall.h>
@ -28,13 +29,12 @@
int
__getpagesize ()
{
extern size_t _dl_pagesize;
#ifdef __NR_getpagesize
int result;
#endif
if (_dl_pagesize != 0)
return _dl_pagesize;
if (GL(dl_pagesize) != 0)
return GL(dl_pagesize);
#ifdef __NR_getpagesize
result = INLINE_SYSCALL (getpagesize, 0);