glibc/elf/link.h

310 lines
13 KiB
C
Raw Normal View History

/* Run-time dynamic linker data structures for loaded ELF shared objects.
Copyright (C) 1995, 1996 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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#ifndef _LINK_H
#define _LINK_H 1
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
#define __need_size_t
#include <stddef.h>
#include <elf.h>
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
/* We use this macro to refer to ELF types independent of the native wordsize.
`ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */
#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type)
#define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type)
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
#define _ElfW(e,w,t) _ElfW_1 (e, w, _##t)
#define _ElfW_1(e,w,t) e##w##t
#include <elfclass.h> /* Defines __ELF_NATIVE_CLASS. */
/* Rendezvous structure used by the run-time dynamic linker to communicate
details of shared object loading to the debugger. If the executable's
dynamic section has a DT_DEBUG element, the run-time linker sets that
element's value to the address where this structure can be found. */
struct r_debug
{
int r_version; /* Version number for this protocol. */
struct link_map *r_map; /* Head of the chain of loaded objects. */
/* This is the address of a function internal to the run-time linker,
that will always be called when the linker begins to map in a
library or unmap it, and again when the mapping change is complete.
The debugger can set a breakpoint at this address if it wants to
notice shared object mapping changes. */
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
ElfW(Addr) r_brk;
enum
{
/* This state value describes the mapping change taking place when
the `r_brk' address is called. */
RT_CONSISTENT, /* Mapping change is complete. */
RT_ADD, /* Beginning to add a new object. */
RT_DELETE, /* Beginning to remove an object mapping. */
} r_state;
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */
};
Thu Jun 13 00:02:25 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-lookup.c (_dl_lookup_symbol): If no value and *REF is null, consider it a strong reference and give the error. Wed Jun 12 15:52:46 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-open.c (_dl_open): Correctly terminate relocating loop after relocating NEW when it's the only new object. * elf/dl-init.c (_dl_init_next): When out of initializers, set _r_debug.r_state to RT_CONSISTENT and call _dl_debug_state just before return. * elf/rtld.c (dl_main): Move _dl_debug_initialize call after relocation. Call it unconditionally and only fill in DT_DEBUG if it's present. Then call _dl_debug_state with r_state RT_ADD before running initializers. * elf/dl-open.c (_dl_open): Call _dl_debug_initialize and then call _dl_debug_state with r_state RT_ADD before running initializers * elf/dl-close.c (_dl_close): Call _dl_debug_state with r_state RT_DELETE before running finalizers and with RT_CONSISTENT just before return. * elf/Makefile (dl-routines): Add dl-debug. * elf/dl-debug.c: New file. * elf/rtld.c (_dl_r_debug): Rename to _r_debug and move to dl-debug.c. (_dl_r_debug_state): Rename to _dl_debug_state and likewise move. (dl_main): Use _dl_debug_initialize. * elf/link.h: Fix name to _dl_debug_state in decl. (_dl_debug_initialize): Declare new function from dl-debug.c. (_r_debug): Declare it. * Makerules (distinfo-vars): Add install-{lib,data,bin,sbin,others}. In distinfo set $(subdir)-VAR and then set VAR to $($(subdir)-VAR). * Makeconfig (rpath-link): New variable; add $(elfobjdir). (default-rpath): Use it. (built-program-cmd): Use it in LD_LIBRARY_PATH. * Makeconfig (sysdep-configures): Prepend $(sysdep_dir) to names tried. * sysdeps/unix/Dist: Add make-syscalls.sh. * misc/Makefile (headers): Add sys/swap.h. * posix/unistd.h: Remove decls for swapon, swapoff. * sysdeps/generic/sys/swap.h: New file. * sysdeps/unix/sysv/linux/sys/swap.h: New file. * sysdeps/unix/sysv/linux/gnu/types.h: Remove temporary hack #define of __kernel_fsid_t. It is correctly defines in <linux/types.h> now.
1996-06-13 06:06:45 +02:00
/* This is the instance of that structure used by the dynamic linker. */
extern struct r_debug _r_debug;
/* This symbol refers to the "dynamic structure" in the `.dynamic' section
of whatever module refers to `_DYNAMIC'. So, to find its own
`struct r_debug', a program could do:
for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL)
if (dyn->d_tag == DT_DEBUG) r_debug = (struct r_debug) dyn->d_un.d_ptr;
*/
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
extern ElfW(Dyn) _DYNAMIC[];
/* Structure describing a loaded shared object. The `l_next' and `l_prev'
members form a chain of all the shared objects loaded at startup.
These data structures exist in space used by the run-time dynamic linker;
modifying them may have disastrous results. */
struct link_map
{
/* These first few members are part of the protocol with the debugger.
This is the same format used in SVR4. */
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
ElfW(Addr) l_addr; /* Base address shared object is loaded at. */
char *l_name; /* Absolute file name object was found in. */
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */
struct link_map *l_next, *l_prev; /* Chain of loaded objects. */
/* All following members are internal to the dynamic linker.
They may change without notice. */
const char *l_libname; /* Name requested (before search). */
/* Indexed pointers to dynamic section.
[0,DT_NUM) are indexed by the processor-independent tags.
[DT_NUM,DT_NUM+DT_PROCNUM] are indexed by the tag minus DT_LOPROC. */
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
ElfW(Dyn) *l_info[DT_NUM + DT_PROCNUM];
const ElfW(Phdr) *l_phdr; /* Pointer to program header table in core. */
ElfW(Addr) l_entry; /* Entry point location. */
ElfW(Half) l_phnum; /* Number of program header entries. */
/* Array of DT_NEEDED dependencies and their dependencies, in
dependency order for symbol lookup. This is null before the
dependencies have been loaded. */
struct link_map **l_searchlist;
unsigned int l_nsearchlist;
* Makerules ($(common-objpfx)libc.so): Depend on $(elfobjdir)/ld.so. * elf/dl-close.c: New file. * elf/link.h: Declare _dl_close. * elf/Makefile (routines): Add dl-close. * elf/dlclose.c (dlclose): Use _dl_close. * elf/Makefile ($(objpfx)librtld.so): Remove libelf from deps. * elf/dl-runtime.c (_dl_global_scope): New variable. (_dl_object_relocation_scope): New function. (fixup): Use it. * elf/rtld.c (dl_main): Use it. * elf/dl-open.c (_dl_open): Use it. If (MODE & RTLD_GLOBAL), set the l_global bit and append the new map to _dl_global_scope. * elf/link.h: Declare _dl_global_scope, _dl_global_scope_alloc, and _dl_object_relocation_scope. * elf/link.h (struct link_map): Add l_loader member. Remove _dl_map_object_from_fd decl. * elf/dl-load.c (_dl_map_object): Pass LOADER to ... (_dl_map_object_from_fd): Take new arg LOADER and set l_loader member. (_dl_map_object): Try DT_RPATH from all loaders up the chain. * elf/dl-object.c (_dl_loaded): Variable removed. (_dl_default_scope): New variable replaces it. * elf/link.h (_dl_loaded): Remove variable decl; instead define as macro for _dl_default_scope[2]. (_dl_default_scope): Declare it. * sysdeps/i386/dl-machine.h (RTLD_START): Use _dl_default_scope[2] instead of _dl_loaded. * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. * elf/rtld.c (dl_main): Use _dl_default_scope for symbol lookups. * elf/dl-reloc.c (_dl_relocate_object): Remove check for _dl_rtld_map. * elf/rtld.c (dl_main): Pass 0 for LAZY flag when re-relocating self. * elf/link.h (struct link_map.l_type): Remove lt_interpreter. (struct link_map): Add new flag member l_global. * elf/dl-reloc.c (_dl_relocate_object): Check for _dl_rtld_map directly instead of looking for lt_interpreter. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. * elf/rtld.c (_dl_start): Don't bother setting BOOTSTRAP_MAP.l_type. (dl_main): Set _dl_rtld_map.l_type to lt_library. * elf/dl-deps.c (_dl_map_object_deps): Propagate MAP->l_type to dependencies loaded, downgrading lt_executable -> lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Take new arg TYPE and set l_type from that, translating lt_library->lt_executable based on the file's ELF type. (_dl_map_object): Likewise. * elf/link.h: Update prototypes. * elf/dl-open.c: Pass type lt_loaded. * elf/rtld.c: Pass type lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Handle null return from _dl_new_object. (_dl_map_object_from_fd: lose): Unchain and free L if it's not null. Free REALNAME, and just use NAME in error message. * elf/dl-object.c (_dl_new_object): If malloc fails, return null instead of calling _dl_signal_error. * elf/dl-load.c (_dl_map_object_from_fd): Close FD before signalling error for _dl_zerofd setup failure. * elf/dl-object.c (_dl_startup_loaded): Variable removed. * elf/link.h: Remove its decl. * elf/dl-reloc.c (_dl_relocate_object): Take new SCOPE arg and pass it through to _dl_lookup_symbol. * elf/link.h (_dl_relocate_object): Update comment and prototype. * elf/rtld.c (dl_main): Pass scope vector to _dl_relocate_object. * elf/dl-lookup.c (_dl_lookup_symbol): Arg SYMBOL_SCOPE is now a null-terminated vector of pointers, no longer a vector of exactly two. * elf/link.h (_dl_lookup_symbol): Update comment and prototype. * elf/dl-runtime.c (fixup): Set up scope for symbol lookup properly as done in _dl_relocate_object. * elf/dlopen.c: Pass "" to _dl_open when FILE is null.
1996-06-10 22:19:39 +02:00
/* Dependent object that first caused this object to be loaded. */
struct link_map *l_loader;
/* Symbol hash table. */
ElfW(Symndx) l_nbuckets;
const ElfW(Symndx) *l_buckets, *l_chain;
unsigned int l_opencount; /* Reference count for dlopen/dlclose. */
enum /* Where this object came from. */
{
lt_executable, /* The main executable program. */
lt_library, /* Library needed by main executable. */
lt_loaded, /* Extra run-time loaded shared object. */
} l_type:2;
unsigned int l_relocated:1; /* Nonzero if object's relocations done. */
unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */
unsigned int l_init_running:1; /* Nonzero while DT_INIT function runs. */
* Makerules ($(common-objpfx)libc.so): Depend on $(elfobjdir)/ld.so. * elf/dl-close.c: New file. * elf/link.h: Declare _dl_close. * elf/Makefile (routines): Add dl-close. * elf/dlclose.c (dlclose): Use _dl_close. * elf/Makefile ($(objpfx)librtld.so): Remove libelf from deps. * elf/dl-runtime.c (_dl_global_scope): New variable. (_dl_object_relocation_scope): New function. (fixup): Use it. * elf/rtld.c (dl_main): Use it. * elf/dl-open.c (_dl_open): Use it. If (MODE & RTLD_GLOBAL), set the l_global bit and append the new map to _dl_global_scope. * elf/link.h: Declare _dl_global_scope, _dl_global_scope_alloc, and _dl_object_relocation_scope. * elf/link.h (struct link_map): Add l_loader member. Remove _dl_map_object_from_fd decl. * elf/dl-load.c (_dl_map_object): Pass LOADER to ... (_dl_map_object_from_fd): Take new arg LOADER and set l_loader member. (_dl_map_object): Try DT_RPATH from all loaders up the chain. * elf/dl-object.c (_dl_loaded): Variable removed. (_dl_default_scope): New variable replaces it. * elf/link.h (_dl_loaded): Remove variable decl; instead define as macro for _dl_default_scope[2]. (_dl_default_scope): Declare it. * sysdeps/i386/dl-machine.h (RTLD_START): Use _dl_default_scope[2] instead of _dl_loaded. * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. * elf/rtld.c (dl_main): Use _dl_default_scope for symbol lookups. * elf/dl-reloc.c (_dl_relocate_object): Remove check for _dl_rtld_map. * elf/rtld.c (dl_main): Pass 0 for LAZY flag when re-relocating self. * elf/link.h (struct link_map.l_type): Remove lt_interpreter. (struct link_map): Add new flag member l_global. * elf/dl-reloc.c (_dl_relocate_object): Check for _dl_rtld_map directly instead of looking for lt_interpreter. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. * elf/rtld.c (_dl_start): Don't bother setting BOOTSTRAP_MAP.l_type. (dl_main): Set _dl_rtld_map.l_type to lt_library. * elf/dl-deps.c (_dl_map_object_deps): Propagate MAP->l_type to dependencies loaded, downgrading lt_executable -> lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Take new arg TYPE and set l_type from that, translating lt_library->lt_executable based on the file's ELF type. (_dl_map_object): Likewise. * elf/link.h: Update prototypes. * elf/dl-open.c: Pass type lt_loaded. * elf/rtld.c: Pass type lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Handle null return from _dl_new_object. (_dl_map_object_from_fd: lose): Unchain and free L if it's not null. Free REALNAME, and just use NAME in error message. * elf/dl-object.c (_dl_new_object): If malloc fails, return null instead of calling _dl_signal_error. * elf/dl-load.c (_dl_map_object_from_fd): Close FD before signalling error for _dl_zerofd setup failure. * elf/dl-object.c (_dl_startup_loaded): Variable removed. * elf/link.h: Remove its decl. * elf/dl-reloc.c (_dl_relocate_object): Take new SCOPE arg and pass it through to _dl_lookup_symbol. * elf/link.h (_dl_relocate_object): Update comment and prototype. * elf/rtld.c (dl_main): Pass scope vector to _dl_relocate_object. * elf/dl-lookup.c (_dl_lookup_symbol): Arg SYMBOL_SCOPE is now a null-terminated vector of pointers, no longer a vector of exactly two. * elf/link.h (_dl_lookup_symbol): Update comment and prototype. * elf/dl-runtime.c (fixup): Set up scope for symbol lookup properly as done in _dl_relocate_object. * elf/dlopen.c: Pass "" to _dl_open when FILE is null.
1996-06-10 22:19:39 +02:00
unsigned int l_global:1; /* Nonzero if object in _dl_global_scope. */
unsigned int l_reserved:2; /* Reserved for internal use. */
};
/* Internal functions of the run-time dynamic linker.
These can be accessed if you link again the dynamic linker
as a shared library, as in `-lld' or `/lib/ld.so' explicitly;
but are not normally of interest to user programs.
The `-ldl' library functions in <dlfcn.h> provide a simple
user interface to run-time dynamic linking. */
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
/* Cached value of `getpagesize ()'. */
extern size_t _dl_pagesize;
/* File descriptor referring to the zero-fill device. */
extern int _dl_zerofd;
/* OS-dependent function to open the zero-fill device. */
extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */
/* OS-dependent function to write a message on the standard output.
All arguments are `const char *'; args until a null pointer
are concatenated to form the message to print. */
extern void _dl_sysdep_message (const char *string, ...);
/* OS-dependent function to give a fatal error message and exit
when the dynamic linker fails before the program is fully linked.
All arguments are `const char *'; args until a null pointer
are concatenated to form the message to print. */
extern void _dl_sysdep_fatal (const char *string, ...)
__attribute__ ((__noreturn__));
/* Nonzero if the program should be "secure" (i.e. it's setuid or somesuch).
This tells the dynamic linker to ignore environment variables. */
extern int _dl_secure;
/* This function is called by all the internal dynamic linker functions
when they encounter an error. ERRCODE is either an `errno' code or
zero; OBJECT is the name of the problematical shared object, or null if
it is a general problem; ERRSTRING is a string describing the specific
problem. */
extern void _dl_signal_error (int errcode,
const char *object,
const char *errstring)
__attribute__ ((__noreturn__));
/* Call OPERATE, catching errors from `dl_signal_error'. If there is no
error, *ERRSTRING is set to null. If there is an error, *ERRSTRING and
*OBJECT are set to the strings passed to _dl_signal_error, and the error
code passed is the return value. */
extern int _dl_catch_error (const char **errstring,
const char **object,
void (*operate) (void));
/* Helper function for <dlfcn.h> functions. Runs the OPERATE function via
_dl_catch_error. Returns zero for success, nonzero for failure; and
arranges for `dlerror' to return the error details. */
extern int _dlerror_run (void (*operate) (void));
/* Open the shared object NAME and map in its segments.
LOADER's DT_RPATH is used in searching for NAME.
If the object is already opened, returns its existing map. */
extern struct link_map *_dl_map_object (struct link_map *loader,
* Makerules ($(common-objpfx)libc.so): Depend on $(elfobjdir)/ld.so. * elf/dl-close.c: New file. * elf/link.h: Declare _dl_close. * elf/Makefile (routines): Add dl-close. * elf/dlclose.c (dlclose): Use _dl_close. * elf/Makefile ($(objpfx)librtld.so): Remove libelf from deps. * elf/dl-runtime.c (_dl_global_scope): New variable. (_dl_object_relocation_scope): New function. (fixup): Use it. * elf/rtld.c (dl_main): Use it. * elf/dl-open.c (_dl_open): Use it. If (MODE & RTLD_GLOBAL), set the l_global bit and append the new map to _dl_global_scope. * elf/link.h: Declare _dl_global_scope, _dl_global_scope_alloc, and _dl_object_relocation_scope. * elf/link.h (struct link_map): Add l_loader member. Remove _dl_map_object_from_fd decl. * elf/dl-load.c (_dl_map_object): Pass LOADER to ... (_dl_map_object_from_fd): Take new arg LOADER and set l_loader member. (_dl_map_object): Try DT_RPATH from all loaders up the chain. * elf/dl-object.c (_dl_loaded): Variable removed. (_dl_default_scope): New variable replaces it. * elf/link.h (_dl_loaded): Remove variable decl; instead define as macro for _dl_default_scope[2]. (_dl_default_scope): Declare it. * sysdeps/i386/dl-machine.h (RTLD_START): Use _dl_default_scope[2] instead of _dl_loaded. * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. * elf/rtld.c (dl_main): Use _dl_default_scope for symbol lookups. * elf/dl-reloc.c (_dl_relocate_object): Remove check for _dl_rtld_map. * elf/rtld.c (dl_main): Pass 0 for LAZY flag when re-relocating self. * elf/link.h (struct link_map.l_type): Remove lt_interpreter. (struct link_map): Add new flag member l_global. * elf/dl-reloc.c (_dl_relocate_object): Check for _dl_rtld_map directly instead of looking for lt_interpreter. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. * elf/rtld.c (_dl_start): Don't bother setting BOOTSTRAP_MAP.l_type. (dl_main): Set _dl_rtld_map.l_type to lt_library. * elf/dl-deps.c (_dl_map_object_deps): Propagate MAP->l_type to dependencies loaded, downgrading lt_executable -> lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Take new arg TYPE and set l_type from that, translating lt_library->lt_executable based on the file's ELF type. (_dl_map_object): Likewise. * elf/link.h: Update prototypes. * elf/dl-open.c: Pass type lt_loaded. * elf/rtld.c: Pass type lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Handle null return from _dl_new_object. (_dl_map_object_from_fd: lose): Unchain and free L if it's not null. Free REALNAME, and just use NAME in error message. * elf/dl-object.c (_dl_new_object): If malloc fails, return null instead of calling _dl_signal_error. * elf/dl-load.c (_dl_map_object_from_fd): Close FD before signalling error for _dl_zerofd setup failure. * elf/dl-object.c (_dl_startup_loaded): Variable removed. * elf/link.h: Remove its decl. * elf/dl-reloc.c (_dl_relocate_object): Take new SCOPE arg and pass it through to _dl_lookup_symbol. * elf/link.h (_dl_relocate_object): Update comment and prototype. * elf/rtld.c (dl_main): Pass scope vector to _dl_relocate_object. * elf/dl-lookup.c (_dl_lookup_symbol): Arg SYMBOL_SCOPE is now a null-terminated vector of pointers, no longer a vector of exactly two. * elf/link.h (_dl_lookup_symbol): Update comment and prototype. * elf/dl-runtime.c (fixup): Set up scope for symbol lookup properly as done in _dl_relocate_object. * elf/dlopen.c: Pass "" to _dl_open when FILE is null.
1996-06-10 22:19:39 +02:00
const char *name, int type);
Sun Jul 14 01:51:39 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * manual/Makefile (glibc-targets): Variable and targets removed. Sat Jul 13 23:50:17 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * manual/Makefile (lib): New phony target. Depend on stamp files. ($(objpfx)stamp%-$(subdir)): New rule to create them when necessary. 1996-07-13 Paul Eggert <eggert@twinsun.com> * time/strftime.c (strftime): Use space padding for %e, %k, %l, to match Emacs format-time-string specification. (DO_NUMBER_SPACEPAD): Renamed from DO_NUMBER_NOPAD. Sat Jul 13 20:17:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-deps.c (_dl_map_object_deps): Take new args PRELOADS and NPRELOADS, vector of `struct link_map *'s; add them to the searchlist between MAP and its deps. * elf/link.h: Fix decl. * elf/rtld.c (dl_main): If not secure, parse LD_PRELOAD for colon-separated list of names, map those and pass vector of ptrs as PRELOADS list to _dl_map_object_deps. * elf/dl-runtime.c (_dl_object_relocation_scope): Pass new args to _dl_map_object_deps with empty preload list. * elf/dl-open.c (_dl_open): Likewise. * sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_open_zero_fill): Function removed. (__mmap): Pass MACH_PORT_NULL for memobj port when (flags & MAP_ANON). * sysdeps/generic/dl-sysdep.c (_dl_sysdep_open_zero_fill): Conditionalize defn on [! MAP_ANON]. * elf/dl-minimal.c (malloc): Conditionalize use of _dl_zerofd on [! MAP_ANON]. * elf/rtld.c (dl_main): Likewise. * elf/dl-load.c (_dl_zerofd): Conditionalize defn on [! MAP_ANON]. (_dl_map_object_from_fd): Conditionalize initialization of _dl_zerofd. * elf/dl-fini.c (_dl_fini): Skip finalizer for executable itself. Sat Jul 13 02:47:53 1996 David Mosberger-Tang <davidm@azstarnet.com> * stdlib/random.c (__random): Declare as int32_t to be in sync with declaration. * socket/Makefile (headers): Add socketbits.h. * misc/mntent.c (endmntent): Allow for NULL stream. SunOS does it that way. * grp/initgroups.c (initgroups): Add groups that user is a member of, not the ones he is _not_ a member of. * nss/nsswitch.c (known_compare): Make known_compare() a static instead of a local function. The latter are difficult to debug and slow to execute on certain platforms. * sysdeps/posix/ttyname_r.c (ttyname_r): Use sizeof (dev) - 1 in place of sizeof (dev). The size of a literal string includes the NUL byte. * sysdeps/unix/getlogin.c (getlogin): Initialize ut_fd with -1. Thu Jul 11 16:59:10 1996 David Mosberger-Tang <davidm@azstarnet.com> * misc/mntent.c (addmntent): Seek to end of file before writing entry. Return 1 on error, not -1. Tue Jul 9 19:08:05 1996 David Mosberger-Tang <davidm@azstarnet.com> * sysdeps/unix/sysv/linux/syscalls.list: Mark bdflush as EXTRA syscall. Fri Jul 5 18:44:55 1996 David Mosberger-Tang <davidm@azstarnet.com> * sysdeps/unix/sysv/linux/alpha/ioperm.c (port_to_cpu_addr): Size shift amount for Jensen must be 5 not 4. Sat Jul 13 20:04:28 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * socket/sys/socket.h (struct osockaddr): New type. Sat Jul 13 03:50:53 1996 Ulrich Drepper <drepper@cygnus.com> * misc/Makefile (routines): Add qefgcvt and qefgcvt_r. * misc/efgcvt.c, misc/efgcvt_r.c: Change code so that the `double' and `long double' versions can be generated. * misc/qefgcvt.c, misc/qefgcvt_r.c: New files. Define macros so that included efgcvt{,_r}.c file generate `long double' versions. * stdlib/stdlib.h: Add prototypes for q[efg]cvt() and q[ef]cvt_r() functions. * manual/startup.texi: Document new getsubopt function. * manual/examples/subopt.c: New example program for documenting getsubopt function. Fri Jul 12 23:58:37 1996 Ulrich Drepper <drepper@cygnus.com> * stdlib/Makefile (routines): Add getsubopt. * stdlib/stdlib.h: Add prototype for getsubopt. * stdlib/getsubopt.c: New file. Implement getsubopt function to handle suboption parsing.
1996-07-14 08:04:09 +02:00
/* Call _dl_map_object on the dependencies of MAP, and set up
MAP->l_searchlist. PRELOADS points to a vector of NPRELOADS previously
loaded objects that will be inserted into MAP->l_searchlist after MAP
but before its dependencies. */
extern void _dl_map_object_deps (struct link_map *map,
struct link_map **preloads,
unsigned int npreloads);
/* Cache the locations of MAP's hash table. */
extern void _dl_setup_hash (struct link_map *map);
/* Open the shared object NAME, relocate it, and run its initializer if it
hasn't already been run. MODE is as for `dlopen' (see <dlfcn.h>). If
the object is already opened, returns its existing map. */
extern struct link_map *_dl_open (const char *name, int mode);
* Makerules ($(common-objpfx)libc.so): Depend on $(elfobjdir)/ld.so. * elf/dl-close.c: New file. * elf/link.h: Declare _dl_close. * elf/Makefile (routines): Add dl-close. * elf/dlclose.c (dlclose): Use _dl_close. * elf/Makefile ($(objpfx)librtld.so): Remove libelf from deps. * elf/dl-runtime.c (_dl_global_scope): New variable. (_dl_object_relocation_scope): New function. (fixup): Use it. * elf/rtld.c (dl_main): Use it. * elf/dl-open.c (_dl_open): Use it. If (MODE & RTLD_GLOBAL), set the l_global bit and append the new map to _dl_global_scope. * elf/link.h: Declare _dl_global_scope, _dl_global_scope_alloc, and _dl_object_relocation_scope. * elf/link.h (struct link_map): Add l_loader member. Remove _dl_map_object_from_fd decl. * elf/dl-load.c (_dl_map_object): Pass LOADER to ... (_dl_map_object_from_fd): Take new arg LOADER and set l_loader member. (_dl_map_object): Try DT_RPATH from all loaders up the chain. * elf/dl-object.c (_dl_loaded): Variable removed. (_dl_default_scope): New variable replaces it. * elf/link.h (_dl_loaded): Remove variable decl; instead define as macro for _dl_default_scope[2]. (_dl_default_scope): Declare it. * sysdeps/i386/dl-machine.h (RTLD_START): Use _dl_default_scope[2] instead of _dl_loaded. * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. * elf/rtld.c (dl_main): Use _dl_default_scope for symbol lookups. * elf/dl-reloc.c (_dl_relocate_object): Remove check for _dl_rtld_map. * elf/rtld.c (dl_main): Pass 0 for LAZY flag when re-relocating self. * elf/link.h (struct link_map.l_type): Remove lt_interpreter. (struct link_map): Add new flag member l_global. * elf/dl-reloc.c (_dl_relocate_object): Check for _dl_rtld_map directly instead of looking for lt_interpreter. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. * elf/rtld.c (_dl_start): Don't bother setting BOOTSTRAP_MAP.l_type. (dl_main): Set _dl_rtld_map.l_type to lt_library. * elf/dl-deps.c (_dl_map_object_deps): Propagate MAP->l_type to dependencies loaded, downgrading lt_executable -> lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Take new arg TYPE and set l_type from that, translating lt_library->lt_executable based on the file's ELF type. (_dl_map_object): Likewise. * elf/link.h: Update prototypes. * elf/dl-open.c: Pass type lt_loaded. * elf/rtld.c: Pass type lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Handle null return from _dl_new_object. (_dl_map_object_from_fd: lose): Unchain and free L if it's not null. Free REALNAME, and just use NAME in error message. * elf/dl-object.c (_dl_new_object): If malloc fails, return null instead of calling _dl_signal_error. * elf/dl-load.c (_dl_map_object_from_fd): Close FD before signalling error for _dl_zerofd setup failure. * elf/dl-object.c (_dl_startup_loaded): Variable removed. * elf/link.h: Remove its decl. * elf/dl-reloc.c (_dl_relocate_object): Take new SCOPE arg and pass it through to _dl_lookup_symbol. * elf/link.h (_dl_relocate_object): Update comment and prototype. * elf/rtld.c (dl_main): Pass scope vector to _dl_relocate_object. * elf/dl-lookup.c (_dl_lookup_symbol): Arg SYMBOL_SCOPE is now a null-terminated vector of pointers, no longer a vector of exactly two. * elf/link.h (_dl_lookup_symbol): Update comment and prototype. * elf/dl-runtime.c (fixup): Set up scope for symbol lookup properly as done in _dl_relocate_object. * elf/dlopen.c: Pass "" to _dl_open when FILE is null.
1996-06-10 22:19:39 +02:00
/* Close an object previously opened by _dl_open. */
extern void _dl_close (struct link_map *map);
/* Search loaded objects' symbol tables for a definition of the symbol
referred to by UNDEF. *SYM is the symbol table entry containing the
reference; it is replaced with the defining symbol, and the base load
* Makerules ($(common-objpfx)libc.so): Depend on $(elfobjdir)/ld.so. * elf/dl-close.c: New file. * elf/link.h: Declare _dl_close. * elf/Makefile (routines): Add dl-close. * elf/dlclose.c (dlclose): Use _dl_close. * elf/Makefile ($(objpfx)librtld.so): Remove libelf from deps. * elf/dl-runtime.c (_dl_global_scope): New variable. (_dl_object_relocation_scope): New function. (fixup): Use it. * elf/rtld.c (dl_main): Use it. * elf/dl-open.c (_dl_open): Use it. If (MODE & RTLD_GLOBAL), set the l_global bit and append the new map to _dl_global_scope. * elf/link.h: Declare _dl_global_scope, _dl_global_scope_alloc, and _dl_object_relocation_scope. * elf/link.h (struct link_map): Add l_loader member. Remove _dl_map_object_from_fd decl. * elf/dl-load.c (_dl_map_object): Pass LOADER to ... (_dl_map_object_from_fd): Take new arg LOADER and set l_loader member. (_dl_map_object): Try DT_RPATH from all loaders up the chain. * elf/dl-object.c (_dl_loaded): Variable removed. (_dl_default_scope): New variable replaces it. * elf/link.h (_dl_loaded): Remove variable decl; instead define as macro for _dl_default_scope[2]. (_dl_default_scope): Declare it. * sysdeps/i386/dl-machine.h (RTLD_START): Use _dl_default_scope[2] instead of _dl_loaded. * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. * elf/rtld.c (dl_main): Use _dl_default_scope for symbol lookups. * elf/dl-reloc.c (_dl_relocate_object): Remove check for _dl_rtld_map. * elf/rtld.c (dl_main): Pass 0 for LAZY flag when re-relocating self. * elf/link.h (struct link_map.l_type): Remove lt_interpreter. (struct link_map): Add new flag member l_global. * elf/dl-reloc.c (_dl_relocate_object): Check for _dl_rtld_map directly instead of looking for lt_interpreter. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. * elf/rtld.c (_dl_start): Don't bother setting BOOTSTRAP_MAP.l_type. (dl_main): Set _dl_rtld_map.l_type to lt_library. * elf/dl-deps.c (_dl_map_object_deps): Propagate MAP->l_type to dependencies loaded, downgrading lt_executable -> lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Take new arg TYPE and set l_type from that, translating lt_library->lt_executable based on the file's ELF type. (_dl_map_object): Likewise. * elf/link.h: Update prototypes. * elf/dl-open.c: Pass type lt_loaded. * elf/rtld.c: Pass type lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Handle null return from _dl_new_object. (_dl_map_object_from_fd: lose): Unchain and free L if it's not null. Free REALNAME, and just use NAME in error message. * elf/dl-object.c (_dl_new_object): If malloc fails, return null instead of calling _dl_signal_error. * elf/dl-load.c (_dl_map_object_from_fd): Close FD before signalling error for _dl_zerofd setup failure. * elf/dl-object.c (_dl_startup_loaded): Variable removed. * elf/link.h: Remove its decl. * elf/dl-reloc.c (_dl_relocate_object): Take new SCOPE arg and pass it through to _dl_lookup_symbol. * elf/link.h (_dl_relocate_object): Update comment and prototype. * elf/rtld.c (dl_main): Pass scope vector to _dl_relocate_object. * elf/dl-lookup.c (_dl_lookup_symbol): Arg SYMBOL_SCOPE is now a null-terminated vector of pointers, no longer a vector of exactly two. * elf/link.h (_dl_lookup_symbol): Update comment and prototype. * elf/dl-runtime.c (fixup): Set up scope for symbol lookup properly as done in _dl_relocate_object. * elf/dlopen.c: Pass "" to _dl_open when FILE is null.
1996-06-10 22:19:39 +02:00
address of the defining object is returned. SYMBOL_SCOPE is a
null-terminated list of object scopes to search; each object's
l_searchlist (i.e. the segment of the dependency tree starting at that
object) is searched in turn. REFERENCE_NAME should name the object
1996-08-15 03:23:29 +02:00
containing the reference; it is used in error messages. FLAGS is a
set of flags: */
#define DL_LOOKUP_NOEXEC 1 /* Don't search the executable for a
definition; this is used for copy
relocs. */
#define DL_LOOKUP_NOPLT 2 /* The reference must not be resolved
to a PLT entry. */
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
extern ElfW(Addr) _dl_lookup_symbol (const char *undef,
const ElfW(Sym) **sym,
* Makerules ($(common-objpfx)libc.so): Depend on $(elfobjdir)/ld.so. * elf/dl-close.c: New file. * elf/link.h: Declare _dl_close. * elf/Makefile (routines): Add dl-close. * elf/dlclose.c (dlclose): Use _dl_close. * elf/Makefile ($(objpfx)librtld.so): Remove libelf from deps. * elf/dl-runtime.c (_dl_global_scope): New variable. (_dl_object_relocation_scope): New function. (fixup): Use it. * elf/rtld.c (dl_main): Use it. * elf/dl-open.c (_dl_open): Use it. If (MODE & RTLD_GLOBAL), set the l_global bit and append the new map to _dl_global_scope. * elf/link.h: Declare _dl_global_scope, _dl_global_scope_alloc, and _dl_object_relocation_scope. * elf/link.h (struct link_map): Add l_loader member. Remove _dl_map_object_from_fd decl. * elf/dl-load.c (_dl_map_object): Pass LOADER to ... (_dl_map_object_from_fd): Take new arg LOADER and set l_loader member. (_dl_map_object): Try DT_RPATH from all loaders up the chain. * elf/dl-object.c (_dl_loaded): Variable removed. (_dl_default_scope): New variable replaces it. * elf/link.h (_dl_loaded): Remove variable decl; instead define as macro for _dl_default_scope[2]. (_dl_default_scope): Declare it. * sysdeps/i386/dl-machine.h (RTLD_START): Use _dl_default_scope[2] instead of _dl_loaded. * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. * elf/rtld.c (dl_main): Use _dl_default_scope for symbol lookups. * elf/dl-reloc.c (_dl_relocate_object): Remove check for _dl_rtld_map. * elf/rtld.c (dl_main): Pass 0 for LAZY flag when re-relocating self. * elf/link.h (struct link_map.l_type): Remove lt_interpreter. (struct link_map): Add new flag member l_global. * elf/dl-reloc.c (_dl_relocate_object): Check for _dl_rtld_map directly instead of looking for lt_interpreter. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. * elf/rtld.c (_dl_start): Don't bother setting BOOTSTRAP_MAP.l_type. (dl_main): Set _dl_rtld_map.l_type to lt_library. * elf/dl-deps.c (_dl_map_object_deps): Propagate MAP->l_type to dependencies loaded, downgrading lt_executable -> lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Take new arg TYPE and set l_type from that, translating lt_library->lt_executable based on the file's ELF type. (_dl_map_object): Likewise. * elf/link.h: Update prototypes. * elf/dl-open.c: Pass type lt_loaded. * elf/rtld.c: Pass type lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Handle null return from _dl_new_object. (_dl_map_object_from_fd: lose): Unchain and free L if it's not null. Free REALNAME, and just use NAME in error message. * elf/dl-object.c (_dl_new_object): If malloc fails, return null instead of calling _dl_signal_error. * elf/dl-load.c (_dl_map_object_from_fd): Close FD before signalling error for _dl_zerofd setup failure. * elf/dl-object.c (_dl_startup_loaded): Variable removed. * elf/link.h: Remove its decl. * elf/dl-reloc.c (_dl_relocate_object): Take new SCOPE arg and pass it through to _dl_lookup_symbol. * elf/link.h (_dl_relocate_object): Update comment and prototype. * elf/rtld.c (dl_main): Pass scope vector to _dl_relocate_object. * elf/dl-lookup.c (_dl_lookup_symbol): Arg SYMBOL_SCOPE is now a null-terminated vector of pointers, no longer a vector of exactly two. * elf/link.h (_dl_lookup_symbol): Update comment and prototype. * elf/dl-runtime.c (fixup): Set up scope for symbol lookup properly as done in _dl_relocate_object. * elf/dlopen.c: Pass "" to _dl_open when FILE is null.
1996-06-10 22:19:39 +02:00
struct link_map *symbol_scope[],
const char *reference_name,
1996-08-15 03:23:29 +02:00
int flags);
Tue Jun 4 21:01:20 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/getlogin_r.c: New file. Wed Jun 5 02:11:30 1996 Ulrich Drepper <drepper@cygnus.com> * io/Makefile (routines): Add ttyname_r. * resolv/res_debug.c, resolv/resolv.h: Update from bind-4.3.4-T4A. * sysdeps/libm-i387/e_asinl.S, sysdeps/libm-i387/e_atan2l.S, sysdeps/libm-i387/e_expl.S, sysdeps/libm-i387/e_fmodl.S, sysdeps/libm-i387/e_log10l.S, sysdeps/libm-i387/e_logl.S, sysdeps/libm-i387/e_remainderl.S, sysdeps/libm-i387/e_scalbl.S, sysdeps/libm-i387/e_sqrtl.S, sysdeps/libm-i387/s_atanl.S, sysdeps/libm-i387/s_cosl.S, sysdeps/libm-i387/s_ilogbl.S, sysdeps/libm-i387/s_log1pl.S, sysdeps/libm-i387/s_logbl.S, sysdeps/libm-i387/s_scalbnl.S, sysdeps/libm-i387/s_sinl.S, sysdeps/libm-i387/s_tanl.S: New files. i387 assembler versions of `long double' math functions. * sysdeps/libm-ieee754/k_standard.c: Add handling for errors in long double functions. * sysdeps/libm-ieee754/s_ilogbl.c, sysdeps/libm-ieee754/s_logbl.c, sysdeps/libm-ieee754/s_modfl.c: New files. Generic versions of `long double' math functions. * sysdeps/libm-ieee754/s_isinf.c [NO_LONG_DOUBLE]: Add string alias for __isinfl. * sysdeps/libm-ieee754/w_acoshl.c, sysdeps/libm-ieee754/w_acosl.c, sysdeps/libm-ieee754/w_asinl.c, sysdeps/libm-ieee754/w_atan2l.c, sysdeps/libm-ieee754/w_atanhl.c, sysdeps/libm-ieee754/w_cabsl.c, sysdeps/libm-ieee754/w_coshl.c, sysdeps/libm-ieee754/w_dreml.c, sysdeps/libm-ieee754/w_expl.c, sysdeps/libm-ieee754/w_fmodl.c, sysdeps/libm-ieee754/w_gammal.c, sysdeps/libm-ieee754/w_gammal_r.c, sysdeps/libm-ieee754/w_hypotl.c, sysdeps/libm-ieee754/w_j0l.c, sysdeps/libm-ieee754/w_j1l.c, sysdeps/libm-ieee754/w_jnl.c, sysdeps/libm-ieee754/w_lgammal.c, sysdeps/libm-ieee754/w_lgammal_r.c, sysdeps/libm-ieee754/w_log10l.c, sysdeps/libm-ieee754/w_logl.c, sysdeps/libm-ieee754/w_powl.c, sysdeps/libm-ieee754/w_remainderl.c, sysdeps/libm-ieee754/w_scalbl.c, sysdeps/libm-ieee754/w_sinhl.c, sysdeps/libm-ieee754/w_sqrtl.c: New files. Wrapper functions around long double function implementations. * sysdeps/posix/ttyname_r.c (ttyname_r): Use _D_EXACT_NAMLEN to determine length of directory entry name. * posix/Makefile (routines): Add getlogin_r. * posix/unistd.h: Add prototype for getlogin_r. * sysdeps/stub/getlogin_r.c: New file. Reentrant version of getlogin function, specified in P1003.1c/D6. Stub version. * sysdeps/unix/getlogin.c (getlogin): Use ttyname_r instead of ttyname. This avoids saving and restoring the old content. Also use setutent_r, getutline_r and endutent_r instead of accing UTMP file directly. * sysdeps/unix/getlogin_r.c: New file. Reentrant version of getlogin function, specified in P1003.1c/D6. Tue Jun 4 20:10:09 1996 J.T. Conklin <jtc@cygnus.com> * sysdeps/libm-i387/s_finitef.S: Fix mask for exponent. * elf/dl-lookup.c (_dl_lookup_symbol): Grok magical undefined symbols _GNU_libc_dl_{open,close,symbol} and resolve them to dl functions. * elf/rtld.c (rtld_map): Renamed to _dl_rtld_map, made global. * elf/link.h: Declare _dl_rtld_map. * elf/dl-lookup.c (_dl_symbol_value): New function. * elf/link.h: Declare it. stdio-common/vfscanf.c: Prepare for reentrant libio. Used in reentrant libio.
1996-06-05 03:07:21 +02:00
/* Look up symbol NAME in MAP's scope and return its run-time address. */
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name);
Tue Jun 4 21:01:20 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/getlogin_r.c: New file. Wed Jun 5 02:11:30 1996 Ulrich Drepper <drepper@cygnus.com> * io/Makefile (routines): Add ttyname_r. * resolv/res_debug.c, resolv/resolv.h: Update from bind-4.3.4-T4A. * sysdeps/libm-i387/e_asinl.S, sysdeps/libm-i387/e_atan2l.S, sysdeps/libm-i387/e_expl.S, sysdeps/libm-i387/e_fmodl.S, sysdeps/libm-i387/e_log10l.S, sysdeps/libm-i387/e_logl.S, sysdeps/libm-i387/e_remainderl.S, sysdeps/libm-i387/e_scalbl.S, sysdeps/libm-i387/e_sqrtl.S, sysdeps/libm-i387/s_atanl.S, sysdeps/libm-i387/s_cosl.S, sysdeps/libm-i387/s_ilogbl.S, sysdeps/libm-i387/s_log1pl.S, sysdeps/libm-i387/s_logbl.S, sysdeps/libm-i387/s_scalbnl.S, sysdeps/libm-i387/s_sinl.S, sysdeps/libm-i387/s_tanl.S: New files. i387 assembler versions of `long double' math functions. * sysdeps/libm-ieee754/k_standard.c: Add handling for errors in long double functions. * sysdeps/libm-ieee754/s_ilogbl.c, sysdeps/libm-ieee754/s_logbl.c, sysdeps/libm-ieee754/s_modfl.c: New files. Generic versions of `long double' math functions. * sysdeps/libm-ieee754/s_isinf.c [NO_LONG_DOUBLE]: Add string alias for __isinfl. * sysdeps/libm-ieee754/w_acoshl.c, sysdeps/libm-ieee754/w_acosl.c, sysdeps/libm-ieee754/w_asinl.c, sysdeps/libm-ieee754/w_atan2l.c, sysdeps/libm-ieee754/w_atanhl.c, sysdeps/libm-ieee754/w_cabsl.c, sysdeps/libm-ieee754/w_coshl.c, sysdeps/libm-ieee754/w_dreml.c, sysdeps/libm-ieee754/w_expl.c, sysdeps/libm-ieee754/w_fmodl.c, sysdeps/libm-ieee754/w_gammal.c, sysdeps/libm-ieee754/w_gammal_r.c, sysdeps/libm-ieee754/w_hypotl.c, sysdeps/libm-ieee754/w_j0l.c, sysdeps/libm-ieee754/w_j1l.c, sysdeps/libm-ieee754/w_jnl.c, sysdeps/libm-ieee754/w_lgammal.c, sysdeps/libm-ieee754/w_lgammal_r.c, sysdeps/libm-ieee754/w_log10l.c, sysdeps/libm-ieee754/w_logl.c, sysdeps/libm-ieee754/w_powl.c, sysdeps/libm-ieee754/w_remainderl.c, sysdeps/libm-ieee754/w_scalbl.c, sysdeps/libm-ieee754/w_sinhl.c, sysdeps/libm-ieee754/w_sqrtl.c: New files. Wrapper functions around long double function implementations. * sysdeps/posix/ttyname_r.c (ttyname_r): Use _D_EXACT_NAMLEN to determine length of directory entry name. * posix/Makefile (routines): Add getlogin_r. * posix/unistd.h: Add prototype for getlogin_r. * sysdeps/stub/getlogin_r.c: New file. Reentrant version of getlogin function, specified in P1003.1c/D6. Stub version. * sysdeps/unix/getlogin.c (getlogin): Use ttyname_r instead of ttyname. This avoids saving and restoring the old content. Also use setutent_r, getutline_r and endutent_r instead of accing UTMP file directly. * sysdeps/unix/getlogin_r.c: New file. Reentrant version of getlogin function, specified in P1003.1c/D6. Tue Jun 4 20:10:09 1996 J.T. Conklin <jtc@cygnus.com> * sysdeps/libm-i387/s_finitef.S: Fix mask for exponent. * elf/dl-lookup.c (_dl_lookup_symbol): Grok magical undefined symbols _GNU_libc_dl_{open,close,symbol} and resolve them to dl functions. * elf/rtld.c (rtld_map): Renamed to _dl_rtld_map, made global. * elf/link.h: Declare _dl_rtld_map. * elf/dl-lookup.c (_dl_symbol_value): New function. * elf/link.h: Declare it. stdio-common/vfscanf.c: Prepare for reentrant libio. Used in reentrant libio.
1996-06-05 03:07:21 +02:00
/* Structure describing the dynamic linker itself. */
extern struct link_map _dl_rtld_map;
* Makerules ($(common-objpfx)libc.so): Depend on $(elfobjdir)/ld.so. * elf/dl-close.c: New file. * elf/link.h: Declare _dl_close. * elf/Makefile (routines): Add dl-close. * elf/dlclose.c (dlclose): Use _dl_close. * elf/Makefile ($(objpfx)librtld.so): Remove libelf from deps. * elf/dl-runtime.c (_dl_global_scope): New variable. (_dl_object_relocation_scope): New function. (fixup): Use it. * elf/rtld.c (dl_main): Use it. * elf/dl-open.c (_dl_open): Use it. If (MODE & RTLD_GLOBAL), set the l_global bit and append the new map to _dl_global_scope. * elf/link.h: Declare _dl_global_scope, _dl_global_scope_alloc, and _dl_object_relocation_scope. * elf/link.h (struct link_map): Add l_loader member. Remove _dl_map_object_from_fd decl. * elf/dl-load.c (_dl_map_object): Pass LOADER to ... (_dl_map_object_from_fd): Take new arg LOADER and set l_loader member. (_dl_map_object): Try DT_RPATH from all loaders up the chain. * elf/dl-object.c (_dl_loaded): Variable removed. (_dl_default_scope): New variable replaces it. * elf/link.h (_dl_loaded): Remove variable decl; instead define as macro for _dl_default_scope[2]. (_dl_default_scope): Declare it. * sysdeps/i386/dl-machine.h (RTLD_START): Use _dl_default_scope[2] instead of _dl_loaded. * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. * elf/rtld.c (dl_main): Use _dl_default_scope for symbol lookups. * elf/dl-reloc.c (_dl_relocate_object): Remove check for _dl_rtld_map. * elf/rtld.c (dl_main): Pass 0 for LAZY flag when re-relocating self. * elf/link.h (struct link_map.l_type): Remove lt_interpreter. (struct link_map): Add new flag member l_global. * elf/dl-reloc.c (_dl_relocate_object): Check for _dl_rtld_map directly instead of looking for lt_interpreter. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. * elf/rtld.c (_dl_start): Don't bother setting BOOTSTRAP_MAP.l_type. (dl_main): Set _dl_rtld_map.l_type to lt_library. * elf/dl-deps.c (_dl_map_object_deps): Propagate MAP->l_type to dependencies loaded, downgrading lt_executable -> lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Take new arg TYPE and set l_type from that, translating lt_library->lt_executable based on the file's ELF type. (_dl_map_object): Likewise. * elf/link.h: Update prototypes. * elf/dl-open.c: Pass type lt_loaded. * elf/rtld.c: Pass type lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Handle null return from _dl_new_object. (_dl_map_object_from_fd: lose): Unchain and free L if it's not null. Free REALNAME, and just use NAME in error message. * elf/dl-object.c (_dl_new_object): If malloc fails, return null instead of calling _dl_signal_error. * elf/dl-load.c (_dl_map_object_from_fd): Close FD before signalling error for _dl_zerofd setup failure. * elf/dl-object.c (_dl_startup_loaded): Variable removed. * elf/link.h: Remove its decl. * elf/dl-reloc.c (_dl_relocate_object): Take new SCOPE arg and pass it through to _dl_lookup_symbol. * elf/link.h (_dl_relocate_object): Update comment and prototype. * elf/rtld.c (dl_main): Pass scope vector to _dl_relocate_object. * elf/dl-lookup.c (_dl_lookup_symbol): Arg SYMBOL_SCOPE is now a null-terminated vector of pointers, no longer a vector of exactly two. * elf/link.h (_dl_lookup_symbol): Update comment and prototype. * elf/dl-runtime.c (fixup): Set up scope for symbol lookup properly as done in _dl_relocate_object. * elf/dlopen.c: Pass "" to _dl_open when FILE is null.
1996-06-10 22:19:39 +02:00
/* The list of objects currently loaded is the third element of the
`_dl_default_scope' array, and the fourth element is always null.
This leaves two slots before it that are used when resolving
DT_SYMBOLIC objects' references one after it for normal references
(see below). */
#define _dl_loaded (_dl_default_scope[2])
extern struct link_map *_dl_default_scope[5];
/* Null-terminated list of objects in the dynamic `global scope'. The
list starts at [2]; i.e. &_dl_global_scope[2] is the argument
passed to _dl_lookup_symbol to search the global scope. To search
a specific object and its dependencies in preference to the global
scope, fill in the [1] slot and pass its address; for two specific
object scopes, fill [0] and [1]. The list is double-terminated; to
search the global scope and then a specific object and its
dependencies, set *_dl_global_scope_end. This variable initially
points to _dl_default_scope, and _dl_loaded is always kept in [2]
of this list. A new list is malloc'd when new objects are loaded
with RTLD_GLOBAL. */
extern struct link_map **_dl_global_scope, **_dl_global_scope_end;
extern size_t _dl_global_scope_alloc; /* Number of slots malloc'd. */
/* Hack _dl_global_scope[0] and [1] as necessary, and return a pointer into
_dl_global_scope that should be passed to _dl_lookup_symbol for symbol
references made in the object MAP's relocations. */
extern struct link_map **_dl_object_relocation_scope (struct link_map *map);
/* Allocate a `struct link_map' for a new object being loaded,
and enter it into the _dl_loaded list. */
extern struct link_map *_dl_new_object (char *realname, const char *libname,
int type);
/* Relocate the given object (if it hasn't already been).
* Makerules ($(common-objpfx)libc.so): Depend on $(elfobjdir)/ld.so. * elf/dl-close.c: New file. * elf/link.h: Declare _dl_close. * elf/Makefile (routines): Add dl-close. * elf/dlclose.c (dlclose): Use _dl_close. * elf/Makefile ($(objpfx)librtld.so): Remove libelf from deps. * elf/dl-runtime.c (_dl_global_scope): New variable. (_dl_object_relocation_scope): New function. (fixup): Use it. * elf/rtld.c (dl_main): Use it. * elf/dl-open.c (_dl_open): Use it. If (MODE & RTLD_GLOBAL), set the l_global bit and append the new map to _dl_global_scope. * elf/link.h: Declare _dl_global_scope, _dl_global_scope_alloc, and _dl_object_relocation_scope. * elf/link.h (struct link_map): Add l_loader member. Remove _dl_map_object_from_fd decl. * elf/dl-load.c (_dl_map_object): Pass LOADER to ... (_dl_map_object_from_fd): Take new arg LOADER and set l_loader member. (_dl_map_object): Try DT_RPATH from all loaders up the chain. * elf/dl-object.c (_dl_loaded): Variable removed. (_dl_default_scope): New variable replaces it. * elf/link.h (_dl_loaded): Remove variable decl; instead define as macro for _dl_default_scope[2]. (_dl_default_scope): Declare it. * sysdeps/i386/dl-machine.h (RTLD_START): Use _dl_default_scope[2] instead of _dl_loaded. * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. * elf/rtld.c (dl_main): Use _dl_default_scope for symbol lookups. * elf/dl-reloc.c (_dl_relocate_object): Remove check for _dl_rtld_map. * elf/rtld.c (dl_main): Pass 0 for LAZY flag when re-relocating self. * elf/link.h (struct link_map.l_type): Remove lt_interpreter. (struct link_map): Add new flag member l_global. * elf/dl-reloc.c (_dl_relocate_object): Check for _dl_rtld_map directly instead of looking for lt_interpreter. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. * elf/rtld.c (_dl_start): Don't bother setting BOOTSTRAP_MAP.l_type. (dl_main): Set _dl_rtld_map.l_type to lt_library. * elf/dl-deps.c (_dl_map_object_deps): Propagate MAP->l_type to dependencies loaded, downgrading lt_executable -> lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Take new arg TYPE and set l_type from that, translating lt_library->lt_executable based on the file's ELF type. (_dl_map_object): Likewise. * elf/link.h: Update prototypes. * elf/dl-open.c: Pass type lt_loaded. * elf/rtld.c: Pass type lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Handle null return from _dl_new_object. (_dl_map_object_from_fd: lose): Unchain and free L if it's not null. Free REALNAME, and just use NAME in error message. * elf/dl-object.c (_dl_new_object): If malloc fails, return null instead of calling _dl_signal_error. * elf/dl-load.c (_dl_map_object_from_fd): Close FD before signalling error for _dl_zerofd setup failure. * elf/dl-object.c (_dl_startup_loaded): Variable removed. * elf/link.h: Remove its decl. * elf/dl-reloc.c (_dl_relocate_object): Take new SCOPE arg and pass it through to _dl_lookup_symbol. * elf/link.h (_dl_relocate_object): Update comment and prototype. * elf/rtld.c (dl_main): Pass scope vector to _dl_relocate_object. * elf/dl-lookup.c (_dl_lookup_symbol): Arg SYMBOL_SCOPE is now a null-terminated vector of pointers, no longer a vector of exactly two. * elf/link.h (_dl_lookup_symbol): Update comment and prototype. * elf/dl-runtime.c (fixup): Set up scope for symbol lookup properly as done in _dl_relocate_object. * elf/dlopen.c: Pass "" to _dl_open when FILE is null.
1996-06-10 22:19:39 +02:00
SCOPE is passed to _dl_lookup_symbol in symbol lookups.
If LAZY is nonzero, don't relocate its PLT. */
* Makerules ($(common-objpfx)libc.so): Depend on $(elfobjdir)/ld.so. * elf/dl-close.c: New file. * elf/link.h: Declare _dl_close. * elf/Makefile (routines): Add dl-close. * elf/dlclose.c (dlclose): Use _dl_close. * elf/Makefile ($(objpfx)librtld.so): Remove libelf from deps. * elf/dl-runtime.c (_dl_global_scope): New variable. (_dl_object_relocation_scope): New function. (fixup): Use it. * elf/rtld.c (dl_main): Use it. * elf/dl-open.c (_dl_open): Use it. If (MODE & RTLD_GLOBAL), set the l_global bit and append the new map to _dl_global_scope. * elf/link.h: Declare _dl_global_scope, _dl_global_scope_alloc, and _dl_object_relocation_scope. * elf/link.h (struct link_map): Add l_loader member. Remove _dl_map_object_from_fd decl. * elf/dl-load.c (_dl_map_object): Pass LOADER to ... (_dl_map_object_from_fd): Take new arg LOADER and set l_loader member. (_dl_map_object): Try DT_RPATH from all loaders up the chain. * elf/dl-object.c (_dl_loaded): Variable removed. (_dl_default_scope): New variable replaces it. * elf/link.h (_dl_loaded): Remove variable decl; instead define as macro for _dl_default_scope[2]. (_dl_default_scope): Declare it. * sysdeps/i386/dl-machine.h (RTLD_START): Use _dl_default_scope[2] instead of _dl_loaded. * sysdeps/m68k/dl-machine.h (RTLD_START): Likewise. * elf/rtld.c (dl_main): Use _dl_default_scope for symbol lookups. * elf/dl-reloc.c (_dl_relocate_object): Remove check for _dl_rtld_map. * elf/rtld.c (dl_main): Pass 0 for LAZY flag when re-relocating self. * elf/link.h (struct link_map.l_type): Remove lt_interpreter. (struct link_map): Add new flag member l_global. * elf/dl-reloc.c (_dl_relocate_object): Check for _dl_rtld_map directly instead of looking for lt_interpreter. * sysdeps/i386/dl-machine.h (elf_machine_rel): Likewise. * elf/rtld.c (_dl_start): Don't bother setting BOOTSTRAP_MAP.l_type. (dl_main): Set _dl_rtld_map.l_type to lt_library. * elf/dl-deps.c (_dl_map_object_deps): Propagate MAP->l_type to dependencies loaded, downgrading lt_executable -> lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Take new arg TYPE and set l_type from that, translating lt_library->lt_executable based on the file's ELF type. (_dl_map_object): Likewise. * elf/link.h: Update prototypes. * elf/dl-open.c: Pass type lt_loaded. * elf/rtld.c: Pass type lt_library. * elf/dl-load.c (_dl_map_object_from_fd): Handle null return from _dl_new_object. (_dl_map_object_from_fd: lose): Unchain and free L if it's not null. Free REALNAME, and just use NAME in error message. * elf/dl-object.c (_dl_new_object): If malloc fails, return null instead of calling _dl_signal_error. * elf/dl-load.c (_dl_map_object_from_fd): Close FD before signalling error for _dl_zerofd setup failure. * elf/dl-object.c (_dl_startup_loaded): Variable removed. * elf/link.h: Remove its decl. * elf/dl-reloc.c (_dl_relocate_object): Take new SCOPE arg and pass it through to _dl_lookup_symbol. * elf/link.h (_dl_relocate_object): Update comment and prototype. * elf/rtld.c (dl_main): Pass scope vector to _dl_relocate_object. * elf/dl-lookup.c (_dl_lookup_symbol): Arg SYMBOL_SCOPE is now a null-terminated vector of pointers, no longer a vector of exactly two. * elf/link.h (_dl_lookup_symbol): Update comment and prototype. * elf/dl-runtime.c (fixup): Set up scope for symbol lookup properly as done in _dl_relocate_object. * elf/dlopen.c: Pass "" to _dl_open when FILE is null.
1996-06-10 22:19:39 +02:00
extern void _dl_relocate_object (struct link_map *map,
struct link_map *scope[],
int lazy);
/* Return the address of the next initializer function for MAP or one of
its dependencies that has not yet been run. When there are no more
initializers to be run, this returns zero. The functions are returned
in the order they should be called. */
Mon Jun 10 06:14:03 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/mach/hurd/dl-sysdep.c (__open): Define this instead of open. (__close, __mmap): Likewise define with __ names now. Mon Jun 10 05:13:18 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-support.c: New file. * elf/Makefile (CFLAGS-dl-support.c): New variable. (routines, elide-routines.so): Add dl-support. * elf/dl-minimal.c (_dl_pagesize): Remove common defn. * elf/dl-load.c (_dl_pagesize): Define it here. (_dl_map_object_from_fd): Initialize it if zero. * elf/link.h (_dl_pagesize): Remove const. Sun Jun 9 04:04:26 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/Makefile (routines): Add dl-symbol. * elf/dl-lookup.c (_dl_symbol_value): Moved to ... * elf/dl-symbol.c: New file. * elf/elf.h (Elf32_Xword, Elf32_Sxword): New types. (Elf32_Section, Elf64_Section): New types, 16 bits. (Elf32_Sym, Elf64_Sym): Use it. * elf/dl-deps.c (_dl_open): Moved to ... * elf/dl-open.c: New file. * Makefile (routines): Add dl-open. * elf/Makefile (dl-routines): New variable. (routines): Add $(dl-routines). (elide-routines.so): New variable, set to $(dl-routines). (libdl-inhibit-o): Variable removed; build all flavors of -ldl. (rtld-routines): All but rtld, dl-sysdep, and dl-minimal moved to $(dl-routines). * elf/dl-lookup.c (_dl_lookup_symbol): Remove magic symbol grokage. * elf/dladdr.c: Use ELFW(ST_BIND) in place of ELF32_ST_BIND. * elf/dl-load.c (open_path): Use __ names for open and close. Avoid using strdup. (_dl_map_object): Likewise. (_dl_map_object_from_fd): Use __ names for mmap, munmap, and mprotect. * elf/dl-minimal.c (malloc): Likewise. * elf/dl-reloc.c (_dl_relocate_object): Likewise. * elf/dl-minimal.c (_dl_pagesize): New variable. (malloc): Use that instead of a static variable. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_pagesize instead of calling getpagesize. * elf/dl-load.c (_dl_map_object_from_fd): Likewise. * elf/link.h: Declare _dl_pagesize. * elf/rtld.c (dl_r_debug): Renamed to _dl_r_debug. * elf/link.h (struct link_map): Use Half for l_phnum instead of Word. * elf/rtld.c (dl_main): Use Half for phdr count arg. (_dl_sysdep_start): Update prototype of DL_MAIN function ptr arg. * elf/dl-load.c (_dl_map_object_from_fd): Use explicit Elf32_Word to extract 4-byte magic number, not ElfW(Word). Match EI_CLASS against native wordsize, either 32 or 64. * elf/elf.h (Elf64_Byte, Elf64_Section): Typedefs removed. In C a char is always a byte, no need for a typedef. Section indices are 16-bit quantities in elf64, which already have a typedef Elf64_Half. Remove partial -lelf implementation. There is now a separately-distributed `libelf' package that implements it. * elf/dl-lookup.c: Don't #include <libelf.h> any more. (_dl_elf_hash): New function, moved from libelf.h:elf_hash. (_dl_lookup_symbol): Use it instead of elf_hash. * elf/libelf.h: File removed. * elf/elf_hash.c: File removed. * elf/Makefile (headers): Remove libelf.h. (extra-libs): Remove libelf. (libelf-routines): Variable removed. * elf/Makefile (libdl.so): Remove commands from this target. The implicit rule commands are correct, this explicit rule just serves to add some dependencies. * elf/dl-lookup.c (_dl_lookup_symbol): Use ELFW(ST_TYPE) in place of ELF32_ST_TYPE. Likewise ST_BIND. * elf/do-rel.h (elf_dynamic_do_rel): Likewise R_SYM. * elf/link.h (ElfW): New macro for wordsize-independent ElfXX_* type naming. (ELFW): New macro, likewise for ELFXX_* macro naming. (_ElfW, _ElfW_1): New macros, subroutines of ElfW and ELF. Sat Jun 8 20:52:38 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h, elf/do-rel.h, elf/dynamic-link.h, elf/dl-deps.c, elf/dl-init.c, elf/dl-load.c, elf/dl-lookup.c, elf/dl-reloc.c, elf/dl-runtime.c, elf/dladdr.c, elf/dlclose.c, elf/dlsym.c, elf/linux-compat.c, elf/rtld.c: Change all uses of `Elf32_XXX' to `ElfW(XXX)' for wordsize-independence. Sat Jun 8 20:50:42 1996 Richard Henderson <rth@tamu.edu> * elf/elf.h: Move Elf64_* types in parity with Elf32 counterparts. (Elf64_auxv_t): New type. (EM_ALPHA, R_ALPHA_*): New macros for elf64-alpha format.
1996-06-10 12:18:47 +02:00
extern ElfW(Addr) _dl_init_next (struct link_map *map);
/* Call the finalizer functions of all shared objects whose
initializer functions have completed. */
extern void _dl_fini (void);
/* The dynamic linker calls this function before and having changing
any shared object mappings. The `r_state' member of `struct r_debug'
says what change is taking place. This function's address is
the value of the `r_brk' member. */
Thu Jun 13 00:02:25 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-lookup.c (_dl_lookup_symbol): If no value and *REF is null, consider it a strong reference and give the error. Wed Jun 12 15:52:46 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/dl-open.c (_dl_open): Correctly terminate relocating loop after relocating NEW when it's the only new object. * elf/dl-init.c (_dl_init_next): When out of initializers, set _r_debug.r_state to RT_CONSISTENT and call _dl_debug_state just before return. * elf/rtld.c (dl_main): Move _dl_debug_initialize call after relocation. Call it unconditionally and only fill in DT_DEBUG if it's present. Then call _dl_debug_state with r_state RT_ADD before running initializers. * elf/dl-open.c (_dl_open): Call _dl_debug_initialize and then call _dl_debug_state with r_state RT_ADD before running initializers * elf/dl-close.c (_dl_close): Call _dl_debug_state with r_state RT_DELETE before running finalizers and with RT_CONSISTENT just before return. * elf/Makefile (dl-routines): Add dl-debug. * elf/dl-debug.c: New file. * elf/rtld.c (_dl_r_debug): Rename to _r_debug and move to dl-debug.c. (_dl_r_debug_state): Rename to _dl_debug_state and likewise move. (dl_main): Use _dl_debug_initialize. * elf/link.h: Fix name to _dl_debug_state in decl. (_dl_debug_initialize): Declare new function from dl-debug.c. (_r_debug): Declare it. * Makerules (distinfo-vars): Add install-{lib,data,bin,sbin,others}. In distinfo set $(subdir)-VAR and then set VAR to $($(subdir)-VAR). * Makeconfig (rpath-link): New variable; add $(elfobjdir). (default-rpath): Use it. (built-program-cmd): Use it in LD_LIBRARY_PATH. * Makeconfig (sysdep-configures): Prepend $(sysdep_dir) to names tried. * sysdeps/unix/Dist: Add make-syscalls.sh. * misc/Makefile (headers): Add sys/swap.h. * posix/unistd.h: Remove decls for swapon, swapoff. * sysdeps/generic/sys/swap.h: New file. * sysdeps/unix/sysv/linux/sys/swap.h: New file. * sysdeps/unix/sysv/linux/gnu/types.h: Remove temporary hack #define of __kernel_fsid_t. It is correctly defines in <linux/types.h> now.
1996-06-13 06:06:45 +02:00
extern void _dl_debug_state (void);
/* Initialize `struct r_debug' if it has not already been done. The
argument is the run-time load address of the dynamic linker, to be put
in the `r_ldbase' member. Returns the address of the structure. */
extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase);
#endif /* link.h */