diff options
author | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2003-06-04 18:31:57 +0000 |
---|---|---|
committer | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2003-06-04 18:31:57 +0000 |
commit | 09e967c2d732783b2579e4e120cd9b608404cb00 (patch) | |
tree | 8d2783a6a7e33608c6012efd6a88b8f5694df81d /mdk-stage1/insmod-modutils/include/obj.h | |
parent | 18fcff49d3c836697d3b75a3d01d31c700e69974 (diff) | |
download | drakx-backup-do-not-use-09e967c2d732783b2579e4e120cd9b608404cb00.tar drakx-backup-do-not-use-09e967c2d732783b2579e4e120cd9b608404cb00.tar.gz drakx-backup-do-not-use-09e967c2d732783b2579e4e120cd9b608404cb00.tar.bz2 drakx-backup-do-not-use-09e967c2d732783b2579e4e120cd9b608404cb00.tar.xz drakx-backup-do-not-use-09e967c2d732783b2579e4e120cd9b608404cb00.zip |
Merge from R9_0-AMD64, most notably:
- AMD64 support to insmod-busybox, minilibc, et al.
- Sync with insmod-modutils 2.4.19 something but everyone should use
dietlibc nowadays
- Factor out compilation and prefix with $(DIET) for dietlibc builds
- 64-bit & varargs fixes
Diffstat (limited to 'mdk-stage1/insmod-modutils/include/obj.h')
-rw-r--r-- | mdk-stage1/insmod-modutils/include/obj.h | 39 |
1 files changed, 31 insertions, 8 deletions
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 <stdio.h> +#include <sys/types.h> #include <elf.h> #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 */ |