From de47eb59bb829423b1d0f47ba13099073999b3cb Mon Sep 17 00:00:00 2001 From: Nicolas Planel Date: Wed, 29 Oct 2003 16:07:11 +0000 Subject: Corporate Server 2.1.1 release --- mdk-stage1/insmod-modutils/include/obj.h | 39 +++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'mdk-stage1/insmod-modutils/include/obj.h') diff --git a/mdk-stage1/insmod-modutils/include/obj.h b/mdk-stage1/insmod-modutils/include/obj.h index b140c65c3..de346b16a 100644 --- a/mdk-stage1/insmod-modutils/include/obj.h +++ b/mdk-stage1/insmod-modutils/include/obj.h @@ -1,3 +1,6 @@ +#ifndef MODUTILS_OBJ_H +#define MODUTILS_OBJ_H 1 + /* Elf object file loading and relocation routines. Copyright 1996, 1997 Linux International. @@ -21,16 +24,13 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef MODUTILS_OBJ_H -#define MODUTILS_OBJ_H 1 - -#ident "$Id$" - /* The relocatable object is manipulated using elfin types. */ #include +#include #include #include ELF_MACHINE_H +#include "module.h" #ifndef ElfW # if ELFCLASSM == ELFCLASS32 @@ -77,7 +77,7 @@ struct obj_symbol { struct obj_symbol *next; /* hash table link */ const char *name; - unsigned long value; + tgt_long value; unsigned long size; int secidx; /* the defining section index/module */ int info; @@ -161,6 +161,8 @@ struct obj_symbol_patch_struct #define obj_create_image ObjW(create_image) #define obj_addr_to_native_ptr ObjW(addr_to_native_ptr) #define obj_native_ptr_to_addr ObjW(native_ptr_to_addr) +#define obj_kallsyms ObjW(kallsyms) +#define obj_gpl_license ObjW(gpl_license) #define arch_new_file ObjW(arch_new_file) #define arch_new_section ObjW(arch_new_section) #define arch_new_symbol ObjW(arch_new_symbol) @@ -198,7 +200,8 @@ void obj_insert_section_load_order (struct obj_file *f, struct obj_section *obj_create_alloced_section (struct obj_file *f, const char *name, unsigned long align, - unsigned long size); + unsigned long size, + unsigned long flags); struct obj_section *obj_create_alloced_section_first (struct obj_file *f, const char *name, @@ -264,7 +267,7 @@ union obj_ptr_4 { void *ptr; }; union obj_ptr_8 { - Elf64_Xword addr; + u_int64_t addr; /* Should be Elf64_Xword but not all users have this yet */ void *ptr; }; @@ -272,4 +275,24 @@ void *obj_addr_to_native_ptr(ElfW(Addr)); ElfW(Addr) obj_native_ptr_to_addr(void *); +/* Standard method of finding relocation symbols, sets isym */ +#define obj_find_relsym(isym, f, find, rel, symtab, strtab) \ + { \ + unsigned long symndx = ELFW(R_SYM)((rel)->r_info); \ + ElfW(Sym) *extsym = (symtab)+symndx; \ + if (ELFW(ST_BIND)(extsym->st_info) == STB_LOCAL) { \ + isym = (typeof(isym)) (f)->local_symtab[symndx]; \ + } \ + else { \ + const char *name; \ + if (extsym->st_name) \ + name = (strtab) + extsym->st_name; \ + else \ + name = (f)->sections[extsym->st_shndx]->name; \ + isym = (typeof(isym)) obj_find_symbol((find), name); \ + } \ + } + +int obj_gpl_license(struct obj_file *, const char **); + #endif /* obj.h */ -- cgit v1.2.1