1 /* 2 ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 3 ** Distributed under the terms of the NewOS License. 4 */ 5 #ifndef _KERNEL_ELF_PRIV_H 6 #define _KERNEL_ELF_PRIV_H 7 8 9 #include <elf32.h> 10 #include <image.h> 11 12 13 typedef struct elf_region { 14 area_id id; 15 addr_t start; 16 addr_t size; 17 long delta; 18 } elf_region; 19 20 struct elf_image_info { 21 struct elf_image_info *next; // next image in the hash 22 char *name; 23 image_id id; 24 int32 ref_count; 25 void *vnode; 26 elf_region regions[2]; // describes the text and data regions 27 addr_t dynamic_ptr; // pointer to the dynamic section 28 struct elf_linked_image *linked_images; 29 30 struct Elf32_Ehdr *eheader; 31 32 // pointer to symbol participation data structures 33 char *needed; 34 uint32 *symhash; 35 struct Elf32_Sym *syms; 36 char *strtab; 37 struct Elf32_Rel *rel; 38 int rel_len; 39 struct Elf32_Rela *rela; 40 int rela_len; 41 struct Elf32_Rel *pltrel; 42 int pltrel_len; 43 int pltrel_type; 44 }; 45 46 47 #define STRING(image, offset) ((char *)(&(image)->strtab[(offset)])) 48 #define SYMNAME(image, sym) STRING(image, (sym)->st_name) 49 #define SYMBOL(image, num) ((struct Elf32_Sym *)&(image)->syms[num]) 50 #define HASHTABSIZE(image) ((image)->symhash[0]) 51 #define HASHBUCKETS(image) ((unsigned int *)&(image)->symhash[2]) 52 #define HASHCHAINS(image) ((unsigned int *)&(image)->symhash[2+HASHTABSIZE(image)]) 53 54 extern 55 #ifdef __cplusplus 56 "C" 57 #endif 58 status_t elf_resolve_symbol(struct elf_image_info *image, struct Elf32_Sym *sym, 59 struct elf_image_info *shared_image, const char *sym_prepend, addr_t *sym_addr); 60 61 #endif /* _KERNEL_ELF_PRIV_H */ 62