OSDN Git Service

Joakim Tjernlund writes:
[uclinux-h8/uClibc.git] / ldso / include / dl-hash.h
1 #ifndef _LD_HASH_H_
2 #define _LD_HASH_H_
3
4 #ifndef RTLD_NEXT
5 #define RTLD_NEXT       ((void*)-1)
6 #endif
7
8 struct dyn_elf{
9   unsigned long flags;
10   struct elf_resolve * dyn;
11   struct dyn_elf * next_handle;  /* Used by dlopen et al. */
12   struct dyn_elf * next;
13   struct dyn_elf * prev;
14 };
15
16 struct elf_resolve{
17   /* These entries must be in this order to be compatible with the interface used
18      by gdb to obtain the list of symbols. */
19   ElfW(Addr) loadaddr;          /* Base address shared object is loaded at.  */
20   char *libname;                /* Absolute file name object was found in.  */
21   ElfW(Dyn) *dynamic_addr;      /* Dynamic section of the shared object.  */
22   struct elf_resolve * next;
23   struct elf_resolve * prev;
24   /* Nothing after this address is used by gdb. */
25   enum {elf_lib, elf_executable,program_interpreter, loaded_file} libtype;
26   struct dyn_elf * symbol_scope;
27   unsigned short usage_count;
28   unsigned short int init_flag;
29   unsigned int nbucket;
30   unsigned long * elf_buckets;
31   /*
32    * These are only used with ELF style shared libraries
33    */
34   unsigned long nchain;
35   unsigned long * chains;
36   unsigned long dynamic_info[24];
37
38   unsigned long dynamic_size;
39   unsigned long n_phent;
40   Elf32_Phdr * ppnt;
41
42 #if defined(__mips__)
43   /* Needed for MIPS relocation */
44   unsigned long mips_gotsym;
45   unsigned long mips_local_gotno;
46   unsigned long mips_symtabno;
47 #endif
48
49 #ifdef __powerpc__
50   /* this is used to store the address of relocation data words, so
51    * we don't have to calculate it every time, which requires a divide */
52   unsigned long data_words;
53 #endif
54 };
55
56 #define COPY_RELOCS_DONE    1
57 #define RELOCS_DONE         2
58 #define JMP_RELOCS_DONE     4
59 #define INIT_FUNCS_CALLED   8
60
61 extern struct dyn_elf     * _dl_symbol_tables;
62 extern struct elf_resolve * _dl_loaded_modules;
63 extern struct dyn_elf     * _dl_handles;
64
65 extern struct elf_resolve * _dl_check_hashed_files(const char * libname);
66 extern struct elf_resolve * _dl_add_elf_hash_table(const char * libname, 
67         char * loadaddr, unsigned long * dynamic_info, 
68         unsigned long dynamic_addr, unsigned long dynamic_size);
69
70 extern char * _dl_find_hash(const char * name, struct dyn_elf * rpnt1, 
71                             int type_class);
72
73 extern int _dl_linux_dynamic_link(void);
74
75 extern char * _dl_library_path;
76 extern char * _dl_not_lazy;
77 extern unsigned long _dl_elf_hash(const unsigned char *name);
78
79 static inline int _dl_symbol(char * name)
80 {
81   if(name[0] != '_' || name[1] != 'd' || name[2] != 'l' || name[3] != '_')
82     return 0;
83   return 1;
84 }
85
86
87 #define LD_ERROR_NOFILE 1
88 #define LD_ERROR_NOZERO 2
89 #define LD_ERROR_NOTELF 3
90 #define LD_ERROR_NOTMAGIC 4
91 #define LD_ERROR_NOTDYN 5
92 #define LD_ERROR_MMAP_FAILED 6
93 #define LD_ERROR_NODYNAMIC 7
94 #define LD_WRONG_RELOCS 8
95 #define LD_BAD_HANDLE 9
96 #define LD_NO_SYMBOL 10
97
98
99
100 #endif /* _LD_HASH_H_ */
101
102