Changeset View
Changeset View
Standalone View
Standalone View
head/libexec/rtld-elf/rtld.c
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
#include "rtld_printf.h" | #include "rtld_printf.h" | ||||
#include "rtld_utrace.h" | #include "rtld_utrace.h" | ||||
#include "notes.h" | #include "notes.h" | ||||
/* Types. */ | /* Types. */ | ||||
typedef void (*func_ptr_type)(void); | typedef void (*func_ptr_type)(void); | ||||
typedef void * (*path_enum_proc) (const char *path, size_t len, void *arg); | typedef void * (*path_enum_proc) (const char *path, size_t len, void *arg); | ||||
/* Variables that cannot be static: */ | |||||
extern struct r_debug r_debug; /* For GDB */ | |||||
extern int _thread_autoinit_dummy_decl; | |||||
extern char* __progname; | |||||
extern void (*__cleanup)(void); | |||||
/* | /* | ||||
* Function declarations. | * Function declarations. | ||||
*/ | */ | ||||
static const char *basename(const char *); | static const char *basename(const char *); | ||||
static void digest_dynamic1(Obj_Entry *, int, const Elf_Dyn **, | static void digest_dynamic1(Obj_Entry *, int, const Elf_Dyn **, | ||||
const Elf_Dyn **, const Elf_Dyn **); | const Elf_Dyn **, const Elf_Dyn **); | ||||
static void digest_dynamic2(Obj_Entry *, const Elf_Dyn *, const Elf_Dyn *, | static void digest_dynamic2(Obj_Entry *, const Elf_Dyn *, const Elf_Dyn *, | ||||
const Elf_Dyn *); | const Elf_Dyn *); | ||||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | |||||
/* Only here to fix -Wmissing-prototypes warnings */ | /* Only here to fix -Wmissing-prototypes warnings */ | ||||
int __getosreldate(void); | int __getosreldate(void); | ||||
void __pthread_cxa_finalize(struct dl_phdr_info *a); | void __pthread_cxa_finalize(struct dl_phdr_info *a); | ||||
func_ptr_type _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp); | func_ptr_type _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp); | ||||
Elf_Addr _rtld_bind(Obj_Entry *obj, Elf_Size reloff); | Elf_Addr _rtld_bind(Obj_Entry *obj, Elf_Size reloff); | ||||
int npagesizes, osreldate; | int npagesizes; | ||||
static int osreldate; | |||||
size_t *pagesizes; | size_t *pagesizes; | ||||
static int stack_prot = PROT_READ | PROT_WRITE | RTLD_DEFAULT_STACK_EXEC; | static int stack_prot = PROT_READ | PROT_WRITE | RTLD_DEFAULT_STACK_EXEC; | ||||
static int max_stack_flags; | static int max_stack_flags; | ||||
/* | /* | ||||
* Global declarations normally provided by crt1. The dynamic linker is | * Global declarations normally provided by crt1. The dynamic linker is | ||||
* not built with crt1, so we have to provide them ourselves. | * not built with crt1, so we have to provide them ourselves. | ||||
*/ | */ | ||||
char *__progname; | char *__progname; | ||||
char **environ; | char **environ; | ||||
/* | /* | ||||
* Used to pass argc, argv to init functions. | * Used to pass argc, argv to init functions. | ||||
*/ | */ | ||||
int main_argc; | int main_argc; | ||||
char **main_argv; | char **main_argv; | ||||
/* | /* | ||||
* Globals to control TLS allocation. | * Globals to control TLS allocation. | ||||
*/ | */ | ||||
size_t tls_last_offset; /* Static TLS offset of last module */ | size_t tls_last_offset; /* Static TLS offset of last module */ | ||||
size_t tls_last_size; /* Static TLS size of last module */ | size_t tls_last_size; /* Static TLS size of last module */ | ||||
size_t tls_static_space; /* Static TLS space allocated */ | size_t tls_static_space; /* Static TLS space allocated */ | ||||
size_t tls_static_max_align; | static size_t tls_static_max_align; | ||||
Elf_Addr tls_dtv_generation = 1; /* Used to detect when dtv size changes */ | Elf_Addr tls_dtv_generation = 1; /* Used to detect when dtv size changes */ | ||||
int tls_max_index = 1; /* Largest module index allocated */ | int tls_max_index = 1; /* Largest module index allocated */ | ||||
bool ld_library_path_rpath = false; | static bool ld_library_path_rpath = false; | ||||
/* | /* | ||||
* Globals for path names, and such | * Globals for path names, and such | ||||
*/ | */ | ||||
const char *ld_elf_hints_default = _PATH_ELF_HINTS; | const char *ld_elf_hints_default = _PATH_ELF_HINTS; | ||||
const char *ld_path_libmap_conf = _PATH_LIBMAP_CONF; | const char *ld_path_libmap_conf = _PATH_LIBMAP_CONF; | ||||
const char *ld_path_rtld = _PATH_RTLD; | const char *ld_path_rtld = _PATH_RTLD; | ||||
const char *ld_standard_library_path = STANDARD_LIBRARY_PATH; | const char *ld_standard_library_path = STANDARD_LIBRARY_PATH; | ||||
▲ Show 20 Lines • Show All 5,313 Lines • Show Last 20 Lines |