2002-12-30 16:34:25 +03:00
|
|
|
/*
|
2007-10-06 19:33:12 +04:00
|
|
|
* Copyright 2002-2007, Haiku Inc. All Rights Reserved.
|
2006-03-26 19:58:43 +04:00
|
|
|
* Distributed under the terms of the MIT license.
|
|
|
|
*
|
|
|
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
|
|
|
* Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
2002-12-30 16:34:25 +03:00
|
|
|
#ifndef _KERNEL_ELF_PRIV_H
|
|
|
|
#define _KERNEL_ELF_PRIV_H
|
|
|
|
|
2003-10-16 21:52:35 +04:00
|
|
|
|
2002-12-30 16:34:25 +03:00
|
|
|
#include <elf32.h>
|
2003-01-12 19:24:12 +03:00
|
|
|
#include <image.h>
|
2002-12-30 16:34:25 +03:00
|
|
|
|
|
|
|
|
2004-04-27 15:52:37 +04:00
|
|
|
typedef struct elf_region {
|
2004-04-21 03:37:00 +04:00
|
|
|
area_id id;
|
|
|
|
addr_t start;
|
|
|
|
addr_t size;
|
|
|
|
long delta;
|
2004-04-27 15:52:37 +04:00
|
|
|
} elf_region;
|
2002-12-30 16:34:25 +03:00
|
|
|
|
|
|
|
struct elf_image_info {
|
2004-05-11 21:20:40 +04:00
|
|
|
struct elf_image_info *next; // next image in the hash
|
2004-04-21 03:37:00 +04:00
|
|
|
char *name;
|
|
|
|
image_id id;
|
|
|
|
int32 ref_count;
|
2007-10-06 19:33:12 +04:00
|
|
|
struct vnode *vnode;
|
2004-06-09 06:51:27 +04:00
|
|
|
elf_region text_region;
|
|
|
|
elf_region data_region;
|
2006-03-26 19:58:43 +04:00
|
|
|
addr_t dynamic_section; // pointer to the dynamic section
|
2002-12-30 16:34:25 +03:00
|
|
|
struct elf_linked_image *linked_images;
|
|
|
|
|
2006-03-26 19:58:43 +04:00
|
|
|
struct Elf32_Ehdr *elf_header;
|
2002-12-30 16:34:25 +03:00
|
|
|
|
|
|
|
// pointer to symbol participation data structures
|
2004-04-21 03:37:00 +04:00
|
|
|
char *needed;
|
|
|
|
uint32 *symhash;
|
2002-12-30 16:34:25 +03:00
|
|
|
struct Elf32_Sym *syms;
|
2004-04-21 03:37:00 +04:00
|
|
|
char *strtab;
|
2002-12-30 16:34:25 +03:00
|
|
|
struct Elf32_Rel *rel;
|
2004-04-21 03:37:00 +04:00
|
|
|
int rel_len;
|
2002-12-30 16:34:25 +03:00
|
|
|
struct Elf32_Rela *rela;
|
2004-04-21 03:37:00 +04:00
|
|
|
int rela_len;
|
2002-12-30 16:34:25 +03:00
|
|
|
struct Elf32_Rel *pltrel;
|
2004-04-21 03:37:00 +04:00
|
|
|
int pltrel_len;
|
|
|
|
int pltrel_type;
|
2004-06-01 01:33:13 +04:00
|
|
|
|
|
|
|
struct Elf32_Sym *debug_symbols;
|
|
|
|
uint32 num_debug_symbols;
|
|
|
|
const char *debug_string_table;
|
2002-12-30 16:34:25 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define STRING(image, offset) ((char *)(&(image)->strtab[(offset)]))
|
|
|
|
#define SYMNAME(image, sym) STRING(image, (sym)->st_name)
|
|
|
|
#define SYMBOL(image, num) ((struct Elf32_Sym *)&(image)->syms[num])
|
|
|
|
#define HASHTABSIZE(image) ((image)->symhash[0])
|
|
|
|
#define HASHBUCKETS(image) ((unsigned int *)&(image)->symhash[2])
|
|
|
|
#define HASHCHAINS(image) ((unsigned int *)&(image)->symhash[2+HASHTABSIZE(image)])
|
|
|
|
|
2004-04-27 15:52:37 +04:00
|
|
|
extern
|
|
|
|
#ifdef __cplusplus
|
|
|
|
"C"
|
|
|
|
#endif
|
|
|
|
status_t elf_resolve_symbol(struct elf_image_info *image, struct Elf32_Sym *sym,
|
|
|
|
struct elf_image_info *shared_image, const char *sym_prepend, addr_t *sym_addr);
|
2002-12-30 16:34:25 +03:00
|
|
|
|
|
|
|
#endif /* _KERNEL_ELF_PRIV_H */
|