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>
|
2012-06-22 22:24:51 +04:00
|
|
|
#include <elf64.h>
|
2003-01-12 19:24:12 +03:00
|
|
|
#include <image.h>
|
2002-12-30 16:34:25 +03:00
|
|
|
|
|
|
|
|
2009-05-21 19:08:42 +04:00
|
|
|
struct elf_version_info;
|
|
|
|
|
|
|
|
|
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 {
|
2012-07-09 14:11:38 +04:00
|
|
|
struct elf_image_info* next; // next image in the hash
|
|
|
|
char* name;
|
|
|
|
image_id id;
|
|
|
|
int32 ref_count;
|
|
|
|
struct vnode* vnode;
|
|
|
|
elf_region text_region;
|
|
|
|
elf_region data_region;
|
|
|
|
addr_t dynamic_section; // pointer to the dynamic section
|
|
|
|
struct elf_linked_image* linked_images;
|
2002-12-30 16:34:25 +03:00
|
|
|
|
2012-07-09 14:11:38 +04:00
|
|
|
bool symbolic;
|
2010-11-26 16:32:24 +03:00
|
|
|
|
2012-07-09 14:11:38 +04:00
|
|
|
elf_ehdr* elf_header;
|
2002-12-30 16:34:25 +03:00
|
|
|
|
|
|
|
// pointer to symbol participation data structures
|
2012-07-09 14:11:38 +04:00
|
|
|
char* needed;
|
|
|
|
uint32* symhash;
|
|
|
|
elf_sym* syms;
|
|
|
|
char* strtab;
|
|
|
|
elf_rel* rel;
|
|
|
|
int rel_len;
|
|
|
|
elf_rela* rela;
|
|
|
|
int rela_len;
|
|
|
|
elf_rel* pltrel;
|
|
|
|
int pltrel_len;
|
|
|
|
int pltrel_type;
|
|
|
|
|
|
|
|
elf_sym* debug_symbols;
|
|
|
|
uint32 num_debug_symbols;
|
|
|
|
const char* debug_string_table;
|
2009-05-21 19:08:42 +04:00
|
|
|
|
|
|
|
// versioning related structures
|
2012-07-09 14:11:38 +04:00
|
|
|
uint32 num_version_definitions;
|
|
|
|
elf_verdef* version_definitions;
|
|
|
|
uint32 num_needed_versions;
|
|
|
|
elf_verneed* needed_versions;
|
|
|
|
elf_versym* symbol_versions;
|
|
|
|
struct elf_version_info* versions;
|
|
|
|
uint32 num_versions;
|
2002-12-30 16:34:25 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-07-09 14:11:38 +04:00
|
|
|
#define STRING(image, offset) ((char*)(&(image)->strtab[(offset)]))
|
2002-12-30 16:34:25 +03:00
|
|
|
#define SYMNAME(image, sym) STRING(image, (sym)->st_name)
|
2012-06-24 22:22:33 +04:00
|
|
|
#define SYMBOL(image, num) (&(image)->syms[num])
|
2002-12-30 16:34:25 +03:00
|
|
|
#define HASHTABSIZE(image) ((image)->symhash[0])
|
2012-07-09 14:11:38 +04:00
|
|
|
#define HASHBUCKETS(image) ((unsigned int*)&(image)->symhash[2])
|
|
|
|
#define HASHCHAINS(image) ((unsigned int*)&(image)->symhash[2+HASHTABSIZE(image)])
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern status_t elf_resolve_symbol(struct elf_image_info* image,
|
|
|
|
elf_sym* symbol, struct elf_image_info* sharedImage,
|
|
|
|
addr_t* _symbolAddress);
|
2002-12-30 16:34:25 +03:00
|
|
|
|
2004-04-27 15:52:37 +04:00
|
|
|
#ifdef __cplusplus
|
2012-07-09 14:11:38 +04:00
|
|
|
}
|
2004-04-27 15:52:37 +04:00
|
|
|
#endif
|
2012-07-09 14:11:38 +04:00
|
|
|
|
2002-12-30 16:34:25 +03:00
|
|
|
|
|
|
|
#endif /* _KERNEL_ELF_PRIV_H */
|