1 /* vi: set sw=4 ts=4: */
3 * Copyright (C) 2000-2006 by Erik Andersen <andersen@codepoet.org>
5 * GNU Lesser General Public License version 2.1 or later.
12 #define RTLD_NEXT ((void*)-1)
16 struct elf_resolve **init_fini;
17 unsigned long nlist; /* Number of entries in init_fini */
21 struct elf_resolve * dyn;
22 struct dyn_elf * next_handle; /* Used by dlopen et al. */
23 struct init_fini init_fini;
24 struct dyn_elf * next;
25 struct dyn_elf * prev;
29 /* These entries must be in this order to be compatible with the interface used
30 by gdb to obtain the list of symbols. */
31 DL_LOADADDR_TYPE loadaddr; /* Base address shared object is loaded at. */
32 char *libname; /* Absolute file name object was found in. */
33 ElfW(Dyn) *dynamic_addr; /* Dynamic section of the shared object. */
34 struct elf_resolve * next;
35 struct elf_resolve * prev;
36 /* Nothing after this address is used by gdb. */
37 enum {elf_lib, elf_executable,program_interpreter, loaded_file} libtype;
38 struct dyn_elf * symbol_scope;
39 unsigned short usage_count;
40 unsigned short int init_flag;
41 unsigned long rtld_flags; /* RTLD_GLOBAL, RTLD_NOW etc. */
43 Elf_Symndx *elf_buckets;
44 struct init_fini_list *init_fini;
45 struct init_fini_list *rtld_local; /* keep tack of RTLD_LOCAL libs in same group */
47 * These are only used with ELF style shared libraries
51 unsigned long dynamic_info[DYNAMIC_SIZE];
53 unsigned long n_phent;
56 ElfW(Addr) relro_addr;
59 dev_t st_dev; /* device */
60 ino_t st_ino; /* inode */
63 /* this is used to store the address of relocation data words, so
64 * we don't have to calculate it every time, which requires a divide */
65 unsigned long data_words;
69 #define RELOCS_DONE 0x000001
70 #define JMP_RELOCS_DONE 0x000002
71 #define INIT_FUNCS_CALLED 0x000004
72 #define FINI_FUNCS_CALLED 0x000008
73 #define DL_OPENED 0x000010
75 extern struct dyn_elf * _dl_symbol_tables;
76 extern struct elf_resolve * _dl_loaded_modules;
77 extern struct dyn_elf * _dl_handles;
79 extern struct elf_resolve * _dl_add_elf_hash_table(const char * libname,
80 DL_LOADADDR_TYPE loadaddr, unsigned long * dynamic_info,
81 unsigned long dynamic_addr, unsigned long dynamic_size);
83 extern char * _dl_find_hash(const char * name, struct dyn_elf * rpnt1,
84 struct elf_resolve *mytpnt, int type_class);
86 extern int _dl_linux_dynamic_link(void);
88 extern char * _dl_library_path;
89 extern char * _dl_not_lazy;
91 static inline int _dl_symbol(char * name)
93 if(name[0] != '_' || name[1] != 'd' || name[2] != 'l' || name[3] != '_')
98 #define LD_ERROR_NOFILE 1
99 #define LD_ERROR_NOZERO 2
100 #define LD_ERROR_NOTELF 3
101 #define LD_ERROR_NOTMAGIC 4
102 #define LD_ERROR_NOTDYN 5
103 #define LD_ERROR_MMAP_FAILED 6
104 #define LD_ERROR_NODYNAMIC 7
105 #define LD_WRONG_RELOCS 8
106 #define LD_BAD_HANDLE 9
107 #define LD_NO_SYMBOL 10
109 #endif /* _LD_HASH_H_ */