rtld.h (230784) | rtld.h (232831) |
---|---|
1/*- 2 * Copyright 1996, 1997, 1998, 1999, 2000 John D. Polstra. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * | 1/*- 2 * Copyright 1996, 1997, 1998, 1999, 2000 John D. Polstra. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 8 unchanged lines hidden (view full) --- 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * |
25 * $FreeBSD: head/libexec/rtld-elf/rtld.h 230784 2012-01-30 19:52:17Z kib $ | 25 * $FreeBSD: head/libexec/rtld-elf/rtld.h 232831 2012-03-11 20:03:09Z kib $ |
26 */ 27 28#ifndef RTLD_H /* { */ 29#define RTLD_H 1 30 31#include <machine/elf.h> 32#include <sys/types.h> 33#include <sys/queue.h> --- 32 unchanged lines hidden (view full) --- 66#define true 1 67 68extern size_t tls_last_offset; 69extern size_t tls_last_size; 70extern size_t tls_static_space; 71extern int tls_dtv_generation; 72extern int tls_max_index; 73 | 26 */ 27 28#ifndef RTLD_H /* { */ 29#define RTLD_H 1 30 31#include <machine/elf.h> 32#include <sys/types.h> 33#include <sys/queue.h> --- 32 unchanged lines hidden (view full) --- 66#define true 1 67 68extern size_t tls_last_offset; 69extern size_t tls_last_size; 70extern size_t tls_static_space; 71extern int tls_dtv_generation; 72extern int tls_max_index; 73 |
74extern int main_argc; 75extern char **main_argv; 76extern char **environ; 77 |
|
74struct stat; 75struct Struct_Obj_Entry; 76 77/* Lists of shared objects */ 78typedef struct Struct_Objlist_Entry { 79 STAILQ_ENTRY(Struct_Objlist_Entry) link; 80 struct Struct_Obj_Entry *obj; 81} Objlist_Entry; 82 83typedef STAILQ_HEAD(Struct_Objlist, Struct_Objlist_Entry) Objlist; 84 85/* Types of init and fini functions */ 86typedef void (*InitFunc)(void); | 78struct stat; 79struct Struct_Obj_Entry; 80 81/* Lists of shared objects */ 82typedef struct Struct_Objlist_Entry { 83 STAILQ_ENTRY(Struct_Objlist_Entry) link; 84 struct Struct_Obj_Entry *obj; 85} Objlist_Entry; 86 87typedef STAILQ_HEAD(Struct_Objlist, Struct_Objlist_Entry) Objlist; 88 89/* Types of init and fini functions */ 90typedef void (*InitFunc)(void); |
91typedef void (*InitArrFunc)(int, char **, char **); |
|
87 88/* Lists of shared object dependencies */ 89typedef struct Struct_Needed_Entry { 90 struct Struct_Needed_Entry *next; 91 struct Struct_Obj_Entry *obj; 92 unsigned long name; /* Offset of name in string table */ 93} Needed_Entry; 94 --- 113 unchanged lines hidden (view full) --- 208 209 STAILQ_HEAD(, Struct_Name_Entry) names; /* List of names for this object we 210 know about. */ 211 Ver_Entry *vertab; /* Versions required /defined by this object */ 212 int vernum; /* Number of entries in vertab */ 213 214 Elf_Addr init; /* Initialization function to call */ 215 Elf_Addr fini; /* Termination function to call */ | 92 93/* Lists of shared object dependencies */ 94typedef struct Struct_Needed_Entry { 95 struct Struct_Needed_Entry *next; 96 struct Struct_Obj_Entry *obj; 97 unsigned long name; /* Offset of name in string table */ 98} Needed_Entry; 99 --- 113 unchanged lines hidden (view full) --- 213 214 STAILQ_HEAD(, Struct_Name_Entry) names; /* List of names for this object we 215 know about. */ 216 Ver_Entry *vertab; /* Versions required /defined by this object */ 217 int vernum; /* Number of entries in vertab */ 218 219 Elf_Addr init; /* Initialization function to call */ 220 Elf_Addr fini; /* Termination function to call */ |
221 Elf_Addr preinit_array; /* Pre-initialization array of functions */ 222 Elf_Addr init_array; /* Initialization array of functions */ 223 Elf_Addr fini_array; /* Termination array of functions */ 224 int preinit_array_num; /* Number of entries in preinit_array */ 225 int init_array_num; /* Number of entries in init_array */ 226 int fini_array_num; /* Number of entries in fini_array */ |
|
216 | 227 |
228 int32_t osrel; /* OSREL note value */ 229 |
|
217 bool mainprog : 1; /* True if this is the main program */ 218 bool rtld : 1; /* True if this is the dynamic linker */ 219 bool textrel : 1; /* True if there are relocations to text seg */ 220 bool symbolic : 1; /* True if generated with "-Bsymbolic" */ 221 bool bind_now : 1; /* True if all relocations should be made first */ 222 bool traced : 1; /* Already printed in ldd trace output */ 223 bool jmpslots_done : 1; /* Already have relocated the jump slots */ 224 bool init_done : 1; /* Already have added object to init list */ --- 5 unchanged lines hidden (view full) --- 230 bool z_loadfltr : 1; /* Immediately load filtees */ 231 bool ref_nodel : 1; /* Refcount increased to prevent dlclose */ 232 bool init_scanned: 1; /* Object is already on init list. */ 233 bool on_fini_list: 1; /* Object is already on fini list. */ 234 bool dag_inited : 1; /* Object has its DAG initialized. */ 235 bool filtees_loaded : 1; /* Filtees loaded */ 236 bool irelative : 1; /* Object has R_MACHDEP_IRELATIVE relocs */ 237 bool gnu_ifunc : 1; /* Object has references to STT_GNU_IFUNC */ | 230 bool mainprog : 1; /* True if this is the main program */ 231 bool rtld : 1; /* True if this is the dynamic linker */ 232 bool textrel : 1; /* True if there are relocations to text seg */ 233 bool symbolic : 1; /* True if generated with "-Bsymbolic" */ 234 bool bind_now : 1; /* True if all relocations should be made first */ 235 bool traced : 1; /* Already printed in ldd trace output */ 236 bool jmpslots_done : 1; /* Already have relocated the jump slots */ 237 bool init_done : 1; /* Already have added object to init list */ --- 5 unchanged lines hidden (view full) --- 243 bool z_loadfltr : 1; /* Immediately load filtees */ 244 bool ref_nodel : 1; /* Refcount increased to prevent dlclose */ 245 bool init_scanned: 1; /* Object is already on init list. */ 246 bool on_fini_list: 1; /* Object is already on fini list. */ 247 bool dag_inited : 1; /* Object has its DAG initialized. */ 248 bool filtees_loaded : 1; /* Filtees loaded */ 249 bool irelative : 1; /* Object has R_MACHDEP_IRELATIVE relocs */ 250 bool gnu_ifunc : 1; /* Object has references to STT_GNU_IFUNC */ |
251 bool crt_no_init : 1; /* Object' crt does not call _init/_fini */ |
|
238 239 struct link_map linkmap; /* For GDB and dlinfo() */ 240 Objlist dldags; /* Object belongs to these dlopened DAGs (%) */ 241 Objlist dagmembers; /* DAG has these members (%) */ 242 dev_t dev; /* Object's filesystem's device */ 243 ino_t ino; /* Object's inode number */ 244 void *priv; /* Platform-dependent */ 245} Obj_Entry; --- 68 unchanged lines hidden (view full) --- 314/* 315 * Function declarations. 316 */ 317unsigned long elf_hash(const char *); 318const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *, 319 const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *); 320void init_pltgot(Obj_Entry *); 321void lockdflt_init(void); | 252 253 struct link_map linkmap; /* For GDB and dlinfo() */ 254 Objlist dldags; /* Object belongs to these dlopened DAGs (%) */ 255 Objlist dagmembers; /* DAG has these members (%) */ 256 dev_t dev; /* Object's filesystem's device */ 257 ino_t ino; /* Object's inode number */ 258 void *priv; /* Platform-dependent */ 259} Obj_Entry; --- 68 unchanged lines hidden (view full) --- 328/* 329 * Function declarations. 330 */ 331unsigned long elf_hash(const char *); 332const Elf_Sym *find_symdef(unsigned long, const Obj_Entry *, 333 const Obj_Entry **, int, SymCache *, struct Struct_RtldLockState *); 334void init_pltgot(Obj_Entry *); 335void lockdflt_init(void); |
336void digest_notes(Obj_Entry *, Elf_Addr, Elf_Addr); |
|
322void obj_free(Obj_Entry *); 323Obj_Entry *obj_new(void); 324void _rtld_bind_start(void); 325void *rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def); 326void symlook_init(SymLook *, const char *); 327int symlook_obj(SymLook *, const Obj_Entry *); 328void *tls_get_addr_common(Elf_Addr** dtvp, int index, size_t offset); 329void *allocate_tls(Obj_Entry *, void *, size_t, size_t); --- 18 unchanged lines hidden --- | 337void obj_free(Obj_Entry *); 338Obj_Entry *obj_new(void); 339void _rtld_bind_start(void); 340void *rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def); 341void symlook_init(SymLook *, const char *); 342int symlook_obj(SymLook *, const Obj_Entry *); 343void *tls_get_addr_common(Elf_Addr** dtvp, int index, size_t offset); 344void *allocate_tls(Obj_Entry *, void *, size_t, size_t); --- 18 unchanged lines hidden --- |