2000-06-10 05:48:35 +00:00
|
|
|
/* Data structure for communication from the run-time dynamic linker for
|
|
|
|
loaded ELF shared objects.
|
2003-07-24 20:07:00 +00:00
|
|
|
Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
|
2000-06-10 05:48:35 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2000-06-10 05:48:35 +00:00
|
|
|
|
|
|
|
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
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
2000-06-10 05:48:35 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA. */
|
2000-06-10 05:48:35 +00:00
|
|
|
|
|
|
|
#ifndef _LINK_H
|
|
|
|
#define _LINK_H 1
|
|
|
|
|
|
|
|
#include <elf.h>
|
|
|
|
#include <dlfcn.h>
|
2002-02-05 08:02:04 +00:00
|
|
|
#include <stddef.h>
|
2000-06-10 05:48:35 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
/* 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(e,w,t) _ElfW_1 (e, w, _##t)
|
|
|
|
#define _ElfW_1(e,w,t) e##w##t
|
|
|
|
|
|
|
|
#include <bits/elfclass.h> /* Defines __ELF_NATIVE_CLASS. */
|
2001-07-26 00:27:15 +00:00
|
|
|
#include <bits/link.h>
|
2001-08-26 10:50:26 +00:00
|
|
|
#include <dl-lookupcfg.h>
|
2002-06-04 18:35:03 +00:00
|
|
|
#include <tls.h> /* Defines USE_TLS. */
|
2000-06-10 05:48:35 +00:00
|
|
|
|
|
|
|
/* 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. */
|
|
|
|
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;
|
|
|
|
|
|
|
|
ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* 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; ++dyn)
|
|
|
|
if (dyn->d_tag == DT_DEBUG)
|
|
|
|
r_debug = (struct r_debug *) dyn->d_un.d_ptr;
|
|
|
|
*/
|
|
|
|
extern ElfW(Dyn) _DYNAMIC[];
|
|
|
|
|
|
|
|
|
|
|
|
/* Some internal data structures of the dynamic linker used in the
|
|
|
|
linker map. We only provide forward declarations. */
|
|
|
|
struct libname_list;
|
|
|
|
struct r_found_version;
|
|
|
|
struct r_search_path_elem;
|
|
|
|
|
|
|
|
/* Forward declaration. */
|
|
|
|
struct link_map;
|
|
|
|
|
|
|
|
/* Structure to describe a single list of scope elements. The lookup
|
|
|
|
functions get passed an array of pointers to such structures. */
|
|
|
|
struct r_scope_elem
|
|
|
|
{
|
|
|
|
/* Array of maps for the scope. */
|
|
|
|
struct link_map **r_list;
|
|
|
|
/* Number of entries in the scope. */
|
|
|
|
unsigned int r_nlist;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-08-31 02:27:07 +00:00
|
|
|
/* Structure to record search path and allocation mechanism. */
|
|
|
|
struct r_search_path_struct
|
|
|
|
{
|
|
|
|
struct r_search_path_elem **dirs;
|
|
|
|
int malloced;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-06-10 05:48:35 +00:00
|
|
|
/* 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.
|
|
|
|
|
|
|
|
This data structure might change in future, if necessary. User-level
|
|
|
|
programs must avoid defining objects of this type. */
|
|
|
|
|
|
|
|
struct link_map
|
|
|
|
{
|
|
|
|
/* These first few members are part of the protocol with the debugger.
|
|
|
|
This is the same format used in SVR4. */
|
|
|
|
|
|
|
|
ElfW(Addr) l_addr; /* Base address shared object is loaded at. */
|
|
|
|
char *l_name; /* Absolute file name object was found in. */
|
|
|
|
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. */
|
|
|
|
|
|
|
|
struct libname_list *l_libname;
|
|
|
|
/* Indexed pointers to dynamic section.
|
|
|
|
[0,DT_NUM) are indexed by the processor-independent tags.
|
|
|
|
[DT_NUM,DT_NUM+DT_THISPROCNUM) are indexed by the tag minus DT_LOPROC.
|
Update.
2001-12-11 Jakub Jelinek <jakub@redhat.com>
* elf/Makefile (dl-routines): Add conflict.
(rtld-ldscript-in, rtld-ldscript, rtld-parms): Remove.
(ld.so): Add _begin local symbol.
* elf/elf.h (DT_VALTAGIDX, DT_VALNUM, DT_ADDRTAGIDX, DT_ADDRNUM):
Define.
* elf/dl-deps.c (_dl_build_local_scope): New.
(_dl_map_object_deps): If LD_TRACE_PRELINKING, compute local scopes
of all libraries.
* elf/do-rel.h (VALIDX): Define.
(elf_dynamic_do_rel): If ELF_MACHINE_PLT_REL is defined, don't do
lazy binding for RELA. If DT_GNU_PRELINKED, DT_RELACOUNT relocations
can be skipped.
* elf/dl-conflict.c: New file.
* elf/dl-lookup.c (_dl_debug_bindings): New.
(_dl_lookup_symbol): Use _dl_debug_bindings. Reference_name is always
non-NULL.
(_dl_lookup_symbol_skip): Likewise.
(_dl_lookup_versioned_symbol): Likewise.
(_dl_lookup_versioned_symbol_skip): Likewise.
* elf/dl-runtime.c (PLTREL): If ELF_MACHINE_PLT_REL is defined,
define to ElfW(Rel).
* elf/dynamic-link.h (elf_get_dynamic_info): Record selected dynamic
tags in the DT_VALRNGLO..DT_VALRNGHI and DT_ADDRRNGLO..DT_ADDRRNGHI
ranges.
Don't adjust address dynamic tags if l_addr is 0.
* elf/rtld.c (_dl_trace_prelink, _dl_trace_prelink_map): New variables.
(_dl_start): Skip ELF_DYNAMIC_RELOCATE if ld.so is prelinked.
(VALIDX, ADDRIDX): Define.
(_dl_start_final): Initialize _dl_rtld_map's l_map_start and l_map_end.
(dl_main): Print library list for LD_TRACE_PRELINKING.
If prelinking information can be used, skip relocating libraries and
call _dl_resolve_conflicts instead.
(process_envvars): Handle LD_TRACE_PRELINKING envvar.
* elf/dl-load.c (_dl_map_object): Don't create fake libs
if LD_TRACE_PRELINKING.
* include/link.h (struct link_map) [l_info]: Add DT_VALNUM
+ DT_ADDRNUM.
* sysdeps/generic/ldsodefs.h (_dl_trace_prelink_map): New declaration.
(DL_DEBUG_PRELINK): Define.
(_dl_resolve_conflicts): Add prototype.
* sysdeps/alpha/dl-machine.h (elf_machine_runtime_setup): Reinitialize
.plt for prelinked libraries where prelinking info cannot be used.
(elf_machine_rela): If relocating R_ALPHA_JMP_SLOT in .gnu.conflict
section, use RESOLVE_CONFLICT_FIND_MAP to find out reloc's link_map.
* sysdeps/arm/bits/link.h: New file.
* sysdeps/arm/dl-machine.h (elf_machine_runtime_setup): Save original
content of .got[1].
(ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP.
(ELF_MACHINE_PLT_REL): Define.
(elf_machine_rela, elf_machine_rela_relative): New.
(elf_machine_lazy_rel): Reinitialize R_ARM_JUMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/i386/bits/link.h: New file.
* sysdeps/i386/dl-machine.h (elf_machine_runtime_setup): Save original
content of .got[1].
(ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP.
(ELF_MACHINE_PLT_REL): Define.
(elf_machine_rela, elf_machine_rela_relative): New.
(elf_machine_lazy_rel): Reinitialize R_386_JUMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/powerpc/dl-machine.h (elf_machine_rela): If relocating
conflicts, skip finaladdr computation. Use RESOLVE_CONFLICT_FIND_MAP
to find out map for R_PPC_JMP_SLOT relocs.
* sysdeps/sparc/sparc32/dl-machine.h (VALIDX): Define.
(OPCODE_BA): Define.
(elf_machine_runtime_setup): Reinitialize .plt for prelinked
libraries where prelinking info cannot be used.
(sparc_fixup_plt): Renamed from elf_machine_fixup_plt.
(elf_machine_fixup_plt): Call sparc_fixup_plt.
(elf_machine_rela): Set value to 0 if relocating conflicts.
Call sparc_fixup_plt for R_SPARC_JMP_SLOT.
* sysdeps/sparc/sparc64/dl-machine.h (VALIDX): Define.
(sparc64_fixup_plt): Fix a typo.
(elf_machine_rela): Set value to 0 if relocating conflicts.
Handle R_SPARC_JMP_SLOT relocs when relocating conflicts.
(elf_machine_runtime_setup): Reinitialize .plt for prelinked
libraries where prelinking info cannot be used.
* sysdeps/sh/bits/link.h: New file.
* sysdeps/sh/dl-machine.h (elf_machine_runtime_setup): Save original
content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_SH_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/s390/s390-32/bits/link.h: New file.
* sysdeps/s390/s390-32/dl-machine.h (elf_machine_runtime_setup):
Save original content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/s390/s390-64/bits/link.h: New file.
* sysdeps/s390/s390-64/dl-machine.h (elf_machine_runtime_setup):
Save original content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/x86_64/bits/link.h: New file.
* sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup):
Save original content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_X86_64_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
2001-12-12 00:21:26 +00:00
|
|
|
[DT_NUM+DT_THISPROCNUM,DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM) are
|
|
|
|
indexed by DT_VERSIONTAGIDX(tagvalue).
|
2000-06-10 05:48:35 +00:00
|
|
|
[DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM,
|
Update.
2001-12-11 Jakub Jelinek <jakub@redhat.com>
* elf/Makefile (dl-routines): Add conflict.
(rtld-ldscript-in, rtld-ldscript, rtld-parms): Remove.
(ld.so): Add _begin local symbol.
* elf/elf.h (DT_VALTAGIDX, DT_VALNUM, DT_ADDRTAGIDX, DT_ADDRNUM):
Define.
* elf/dl-deps.c (_dl_build_local_scope): New.
(_dl_map_object_deps): If LD_TRACE_PRELINKING, compute local scopes
of all libraries.
* elf/do-rel.h (VALIDX): Define.
(elf_dynamic_do_rel): If ELF_MACHINE_PLT_REL is defined, don't do
lazy binding for RELA. If DT_GNU_PRELINKED, DT_RELACOUNT relocations
can be skipped.
* elf/dl-conflict.c: New file.
* elf/dl-lookup.c (_dl_debug_bindings): New.
(_dl_lookup_symbol): Use _dl_debug_bindings. Reference_name is always
non-NULL.
(_dl_lookup_symbol_skip): Likewise.
(_dl_lookup_versioned_symbol): Likewise.
(_dl_lookup_versioned_symbol_skip): Likewise.
* elf/dl-runtime.c (PLTREL): If ELF_MACHINE_PLT_REL is defined,
define to ElfW(Rel).
* elf/dynamic-link.h (elf_get_dynamic_info): Record selected dynamic
tags in the DT_VALRNGLO..DT_VALRNGHI and DT_ADDRRNGLO..DT_ADDRRNGHI
ranges.
Don't adjust address dynamic tags if l_addr is 0.
* elf/rtld.c (_dl_trace_prelink, _dl_trace_prelink_map): New variables.
(_dl_start): Skip ELF_DYNAMIC_RELOCATE if ld.so is prelinked.
(VALIDX, ADDRIDX): Define.
(_dl_start_final): Initialize _dl_rtld_map's l_map_start and l_map_end.
(dl_main): Print library list for LD_TRACE_PRELINKING.
If prelinking information can be used, skip relocating libraries and
call _dl_resolve_conflicts instead.
(process_envvars): Handle LD_TRACE_PRELINKING envvar.
* elf/dl-load.c (_dl_map_object): Don't create fake libs
if LD_TRACE_PRELINKING.
* include/link.h (struct link_map) [l_info]: Add DT_VALNUM
+ DT_ADDRNUM.
* sysdeps/generic/ldsodefs.h (_dl_trace_prelink_map): New declaration.
(DL_DEBUG_PRELINK): Define.
(_dl_resolve_conflicts): Add prototype.
* sysdeps/alpha/dl-machine.h (elf_machine_runtime_setup): Reinitialize
.plt for prelinked libraries where prelinking info cannot be used.
(elf_machine_rela): If relocating R_ALPHA_JMP_SLOT in .gnu.conflict
section, use RESOLVE_CONFLICT_FIND_MAP to find out reloc's link_map.
* sysdeps/arm/bits/link.h: New file.
* sysdeps/arm/dl-machine.h (elf_machine_runtime_setup): Save original
content of .got[1].
(ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP.
(ELF_MACHINE_PLT_REL): Define.
(elf_machine_rela, elf_machine_rela_relative): New.
(elf_machine_lazy_rel): Reinitialize R_ARM_JUMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/i386/bits/link.h: New file.
* sysdeps/i386/dl-machine.h (elf_machine_runtime_setup): Save original
content of .got[1].
(ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP.
(ELF_MACHINE_PLT_REL): Define.
(elf_machine_rela, elf_machine_rela_relative): New.
(elf_machine_lazy_rel): Reinitialize R_386_JUMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/powerpc/dl-machine.h (elf_machine_rela): If relocating
conflicts, skip finaladdr computation. Use RESOLVE_CONFLICT_FIND_MAP
to find out map for R_PPC_JMP_SLOT relocs.
* sysdeps/sparc/sparc32/dl-machine.h (VALIDX): Define.
(OPCODE_BA): Define.
(elf_machine_runtime_setup): Reinitialize .plt for prelinked
libraries where prelinking info cannot be used.
(sparc_fixup_plt): Renamed from elf_machine_fixup_plt.
(elf_machine_fixup_plt): Call sparc_fixup_plt.
(elf_machine_rela): Set value to 0 if relocating conflicts.
Call sparc_fixup_plt for R_SPARC_JMP_SLOT.
* sysdeps/sparc/sparc64/dl-machine.h (VALIDX): Define.
(sparc64_fixup_plt): Fix a typo.
(elf_machine_rela): Set value to 0 if relocating conflicts.
Handle R_SPARC_JMP_SLOT relocs when relocating conflicts.
(elf_machine_runtime_setup): Reinitialize .plt for prelinked
libraries where prelinking info cannot be used.
* sysdeps/sh/bits/link.h: New file.
* sysdeps/sh/dl-machine.h (elf_machine_runtime_setup): Save original
content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_SH_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/s390/s390-32/bits/link.h: New file.
* sysdeps/s390/s390-32/dl-machine.h (elf_machine_runtime_setup):
Save original content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/s390/s390-64/bits/link.h: New file.
* sysdeps/s390/s390-64/dl-machine.h (elf_machine_runtime_setup):
Save original content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/x86_64/bits/link.h: New file.
* sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup):
Save original content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_X86_64_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
2001-12-12 00:21:26 +00:00
|
|
|
DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM) are indexed by
|
|
|
|
DT_EXTRATAGIDX(tagvalue).
|
|
|
|
[DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM,
|
|
|
|
DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM+DT_VALNUM) are
|
|
|
|
indexed by DT_VALTAGIDX(tagvalue) and
|
|
|
|
[DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM+DT_VALNUM,
|
|
|
|
DT_NUM+DT_THISPROCNUM+DT_VERSIONTAGNUM+DT_EXTRANUM+DT_VALNUM+DT_ADDRNUM)
|
|
|
|
are indexed by DT_ADDRTAGIDX(tagvalue), see <elf.h>. */
|
2000-06-10 05:48:35 +00:00
|
|
|
|
|
|
|
ElfW(Dyn) *l_info[DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM
|
Update.
2001-12-11 Jakub Jelinek <jakub@redhat.com>
* elf/Makefile (dl-routines): Add conflict.
(rtld-ldscript-in, rtld-ldscript, rtld-parms): Remove.
(ld.so): Add _begin local symbol.
* elf/elf.h (DT_VALTAGIDX, DT_VALNUM, DT_ADDRTAGIDX, DT_ADDRNUM):
Define.
* elf/dl-deps.c (_dl_build_local_scope): New.
(_dl_map_object_deps): If LD_TRACE_PRELINKING, compute local scopes
of all libraries.
* elf/do-rel.h (VALIDX): Define.
(elf_dynamic_do_rel): If ELF_MACHINE_PLT_REL is defined, don't do
lazy binding for RELA. If DT_GNU_PRELINKED, DT_RELACOUNT relocations
can be skipped.
* elf/dl-conflict.c: New file.
* elf/dl-lookup.c (_dl_debug_bindings): New.
(_dl_lookup_symbol): Use _dl_debug_bindings. Reference_name is always
non-NULL.
(_dl_lookup_symbol_skip): Likewise.
(_dl_lookup_versioned_symbol): Likewise.
(_dl_lookup_versioned_symbol_skip): Likewise.
* elf/dl-runtime.c (PLTREL): If ELF_MACHINE_PLT_REL is defined,
define to ElfW(Rel).
* elf/dynamic-link.h (elf_get_dynamic_info): Record selected dynamic
tags in the DT_VALRNGLO..DT_VALRNGHI and DT_ADDRRNGLO..DT_ADDRRNGHI
ranges.
Don't adjust address dynamic tags if l_addr is 0.
* elf/rtld.c (_dl_trace_prelink, _dl_trace_prelink_map): New variables.
(_dl_start): Skip ELF_DYNAMIC_RELOCATE if ld.so is prelinked.
(VALIDX, ADDRIDX): Define.
(_dl_start_final): Initialize _dl_rtld_map's l_map_start and l_map_end.
(dl_main): Print library list for LD_TRACE_PRELINKING.
If prelinking information can be used, skip relocating libraries and
call _dl_resolve_conflicts instead.
(process_envvars): Handle LD_TRACE_PRELINKING envvar.
* elf/dl-load.c (_dl_map_object): Don't create fake libs
if LD_TRACE_PRELINKING.
* include/link.h (struct link_map) [l_info]: Add DT_VALNUM
+ DT_ADDRNUM.
* sysdeps/generic/ldsodefs.h (_dl_trace_prelink_map): New declaration.
(DL_DEBUG_PRELINK): Define.
(_dl_resolve_conflicts): Add prototype.
* sysdeps/alpha/dl-machine.h (elf_machine_runtime_setup): Reinitialize
.plt for prelinked libraries where prelinking info cannot be used.
(elf_machine_rela): If relocating R_ALPHA_JMP_SLOT in .gnu.conflict
section, use RESOLVE_CONFLICT_FIND_MAP to find out reloc's link_map.
* sysdeps/arm/bits/link.h: New file.
* sysdeps/arm/dl-machine.h (elf_machine_runtime_setup): Save original
content of .got[1].
(ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP.
(ELF_MACHINE_PLT_REL): Define.
(elf_machine_rela, elf_machine_rela_relative): New.
(elf_machine_lazy_rel): Reinitialize R_ARM_JUMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/i386/bits/link.h: New file.
* sysdeps/i386/dl-machine.h (elf_machine_runtime_setup): Save original
content of .got[1].
(ELF_MACHINE_NO_RELA): Only define if RTLD_BOOTSTRAP.
(ELF_MACHINE_PLT_REL): Define.
(elf_machine_rela, elf_machine_rela_relative): New.
(elf_machine_lazy_rel): Reinitialize R_386_JUMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/powerpc/dl-machine.h (elf_machine_rela): If relocating
conflicts, skip finaladdr computation. Use RESOLVE_CONFLICT_FIND_MAP
to find out map for R_PPC_JMP_SLOT relocs.
* sysdeps/sparc/sparc32/dl-machine.h (VALIDX): Define.
(OPCODE_BA): Define.
(elf_machine_runtime_setup): Reinitialize .plt for prelinked
libraries where prelinking info cannot be used.
(sparc_fixup_plt): Renamed from elf_machine_fixup_plt.
(elf_machine_fixup_plt): Call sparc_fixup_plt.
(elf_machine_rela): Set value to 0 if relocating conflicts.
Call sparc_fixup_plt for R_SPARC_JMP_SLOT.
* sysdeps/sparc/sparc64/dl-machine.h (VALIDX): Define.
(sparc64_fixup_plt): Fix a typo.
(elf_machine_rela): Set value to 0 if relocating conflicts.
Handle R_SPARC_JMP_SLOT relocs when relocating conflicts.
(elf_machine_runtime_setup): Reinitialize .plt for prelinked
libraries where prelinking info cannot be used.
* sysdeps/sh/bits/link.h: New file.
* sysdeps/sh/dl-machine.h (elf_machine_runtime_setup): Save original
content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_SH_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/s390/s390-32/bits/link.h: New file.
* sysdeps/s390/s390-32/dl-machine.h (elf_machine_runtime_setup):
Save original content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/s390/s390-64/bits/link.h: New file.
* sysdeps/s390/s390-64/dl-machine.h (elf_machine_runtime_setup):
Save original content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_390_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
* sysdeps/x86_64/bits/link.h: New file.
* sysdeps/x86_64/dl-machine.h (elf_machine_runtime_setup):
Save original content of .got[1].
(elf_machine_lazy_rel): Reinitialize R_X86_64_JMP_SLOT address instead
of adjusting it if prelinked and prelinking cannot be used.
2001-12-12 00:21:26 +00:00
|
|
|
+ DT_EXTRANUM + DT_VALNUM + DT_ADDRNUM];
|
2000-06-10 05:48:35 +00:00
|
|
|
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. */
|
|
|
|
ElfW(Half) l_ldnum; /* Number of dynamic segment entries. */
|
|
|
|
|
|
|
|
/* Array of DT_NEEDED dependencies and their dependencies, in
|
|
|
|
dependency order for symbol lookup (with and without
|
|
|
|
duplicates). There is no entry before the dependencies have
|
|
|
|
been loaded. */
|
|
|
|
struct r_scope_elem l_searchlist;
|
|
|
|
|
|
|
|
/* We need a special searchlist to process objects marked with
|
|
|
|
DT_SYMBOLIC. */
|
|
|
|
struct r_scope_elem l_symbolic_searchlist;
|
|
|
|
|
|
|
|
/* Dependent object that first caused this object to be loaded. */
|
|
|
|
struct link_map *l_loader;
|
|
|
|
|
|
|
|
/* Symbol hash table. */
|
|
|
|
Elf_Symndx l_nbuckets;
|
|
|
|
const Elf_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_global:1; /* Nonzero if object in _dl_global_scope. */
|
|
|
|
unsigned int l_reserved:2; /* Reserved for internal use. */
|
|
|
|
unsigned int l_phdr_allocated:1; /* Nonzero if the data structure pointed
|
|
|
|
to by `l_phdr' is allocated. */
|
2000-10-21 06:32:16 +00:00
|
|
|
unsigned int l_soname_added:1; /* Nonzero if the SONAME is for sure in
|
|
|
|
the l_libname list. */
|
2000-10-24 01:02:15 +00:00
|
|
|
unsigned int l_faked:1; /* Nonzero if this is a faked descriptor
|
|
|
|
without associated file. */
|
2003-07-31 07:42:20 +00:00
|
|
|
unsigned int l_need_tls_init:1; /* Nonzero if GL(dl_init_static_tls)
|
|
|
|
should be called on this link map
|
|
|
|
when relocation finishes. */
|
2000-06-10 05:48:35 +00:00
|
|
|
/* Array with version names. */
|
|
|
|
unsigned int l_nversions;
|
|
|
|
struct r_found_version *l_versions;
|
|
|
|
|
|
|
|
/* Collected information about own RPATH directories. */
|
2000-08-31 02:27:07 +00:00
|
|
|
struct r_search_path_struct l_rpath_dirs;
|
2000-06-10 05:48:35 +00:00
|
|
|
|
|
|
|
/* Collected results of relocation while profiling. */
|
|
|
|
ElfW(Addr) *l_reloc_result;
|
|
|
|
|
|
|
|
/* Pointer to the version information if available. */
|
|
|
|
ElfW(Versym) *l_versyms;
|
|
|
|
|
|
|
|
/* String specifying the path where this object was found. */
|
|
|
|
const char *l_origin;
|
|
|
|
|
|
|
|
/* Start and finish of memory map for this object. l_map_start
|
|
|
|
need not be the same as l_addr. */
|
|
|
|
ElfW(Addr) l_map_start, l_map_end;
|
|
|
|
|
2001-09-07 07:50:47 +00:00
|
|
|
/* Default array for 'l_scope'. */
|
|
|
|
struct r_scope_elem *l_scope_mem[4];
|
|
|
|
/* Size of array allocated for 'l_scope'. */
|
|
|
|
size_t l_scope_max;
|
2000-06-10 05:48:35 +00:00
|
|
|
/* This is an array defining the lookup scope for this link map.
|
2000-10-24 01:02:15 +00:00
|
|
|
There are at most three different scope lists. */
|
2001-09-07 07:50:47 +00:00
|
|
|
struct r_scope_elem **l_scope;
|
2000-06-10 05:48:35 +00:00
|
|
|
|
|
|
|
/* A similar array, this time only with the local scope. This is
|
|
|
|
used occasionally. */
|
|
|
|
struct r_scope_elem *l_local_scope[2];
|
|
|
|
|
|
|
|
/* This information is kept to check for sure whether a shared
|
|
|
|
object is the same as one already loaded. */
|
|
|
|
dev_t l_dev;
|
2000-08-16 01:28:07 +00:00
|
|
|
ino64_t l_ino;
|
2000-06-10 05:48:35 +00:00
|
|
|
|
|
|
|
/* Collected information about own RUNPATH directories. */
|
2000-08-31 02:27:07 +00:00
|
|
|
struct r_search_path_struct l_runpath_dirs;
|
2000-06-10 05:48:35 +00:00
|
|
|
|
|
|
|
/* List of object in order of the init and fini calls. */
|
|
|
|
struct link_map **l_initfini;
|
|
|
|
|
|
|
|
/* List of the dependencies introduced through symbol binding. */
|
|
|
|
unsigned int l_reldepsmax;
|
|
|
|
unsigned int l_reldepsact;
|
|
|
|
struct link_map **l_reldeps;
|
2000-07-20 22:53:54 +00:00
|
|
|
|
|
|
|
/* Various flag words. */
|
|
|
|
ElfW(Word) l_feature_1;
|
|
|
|
ElfW(Word) l_flags_1;
|
2002-02-06 00:55:46 +00:00
|
|
|
ElfW(Word) l_flags;
|
2000-10-24 07:24:28 +00:00
|
|
|
|
|
|
|
/* Temporarily used in `dl_close'. */
|
|
|
|
unsigned int l_idx;
|
2001-07-26 00:27:15 +00:00
|
|
|
|
|
|
|
struct link_map_machine l_mach;
|
2001-08-26 10:50:26 +00:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
const ElfW(Sym) *sym;
|
2001-08-26 22:28:16 +00:00
|
|
|
int type_class;
|
2001-08-26 10:50:26 +00:00
|
|
|
#ifdef DL_LOOKUP_RETURNS_MAP
|
|
|
|
struct link_map *value;
|
|
|
|
#else
|
|
|
|
ElfW(Addr) value;
|
|
|
|
#endif
|
|
|
|
const ElfW(Sym) *ret;
|
|
|
|
} l_lookup_cache;
|
2002-02-05 08:02:04 +00:00
|
|
|
|
2002-02-07 04:08:19 +00:00
|
|
|
#ifdef USE_TLS
|
2002-02-05 08:02:04 +00:00
|
|
|
/* Thread-local storage related info. */
|
|
|
|
|
|
|
|
/* Start of the initialization image. */
|
|
|
|
void *l_tls_initimage;
|
|
|
|
/* Size of the initialization image. */
|
|
|
|
size_t l_tls_initimage_size;
|
|
|
|
/* Size of the TLS block. */
|
|
|
|
size_t l_tls_blocksize;
|
2002-12-01 22:13:42 +00:00
|
|
|
/* Alignment requirement of the TLS block. */
|
2002-02-07 04:08:19 +00:00
|
|
|
size_t l_tls_align;
|
2003-07-24 20:07:00 +00:00
|
|
|
/* Offset of first byte module alignment. */
|
|
|
|
size_t l_tls_firstbyte_offset;
|
2003-04-25 09:12:43 +00:00
|
|
|
# ifndef NO_TLS_OFFSET
|
|
|
|
# define NO_TLS_OFFSET 0
|
|
|
|
# endif
|
2002-02-05 08:02:04 +00:00
|
|
|
/* For objects present at startup time: offset in the static TLS block. */
|
|
|
|
ptrdiff_t l_tls_offset;
|
|
|
|
/* Index of the module in the dtv array. */
|
|
|
|
size_t l_tls_modid;
|
2002-02-07 04:08:19 +00:00
|
|
|
#endif
|
2000-06-10 05:48:35 +00:00
|
|
|
};
|
|
|
|
|
2001-07-25 20:47:02 +00:00
|
|
|
struct dl_phdr_info
|
|
|
|
{
|
|
|
|
ElfW(Addr) dlpi_addr;
|
|
|
|
const char *dlpi_name;
|
|
|
|
const ElfW(Phdr) *dlpi_phdr;
|
|
|
|
ElfW(Half) dlpi_phnum;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
|
|
|
|
size_t size, void *data),
|
|
|
|
void *data);
|
|
|
|
extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
|
|
|
|
size_t size, void *data),
|
|
|
|
void *data);
|
|
|
|
|
2000-06-10 05:48:35 +00:00
|
|
|
#endif /* link.h */
|