Make our ELF64 type definitions match standards. In particular this

means:
o  Remove Elf64_Quarter,
o  Redefine Elf64_Half to be 16-bit,
o  Redefine Elf64_Word to be 32-bit,
o  Add Elf64_Xword and Elf64_Sxword for 64-bit entities,
o  Use Elf_Size in MI code to abstract the difference between
   Elf32_Word and Elf64_Word.
o  Add Elf_Ssize as the signed counterpart of Elf_Size.

MFC after: 2 weeks
This commit is contained in:
Marcel Moolenaar 2005-12-18 04:52:37 +00:00
parent 55dfaa9163
commit 757686b115
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=153504
29 changed files with 183 additions and 173 deletions

View File

@ -243,8 +243,8 @@ __elf_fdnlist(fd, list)
{ {
struct nlist *p; struct nlist *p;
Elf_Off symoff = 0, symstroff = 0; Elf_Off symoff = 0, symstroff = 0;
Elf_Word symsize = 0, symstrsize = 0; Elf_Size symsize = 0, symstrsize = 0;
Elf_Sword cc, i; Elf_Ssize cc, i;
int nent = -1; int nent = -1;
int errsave; int errsave;
Elf_Sym sbuf[1024]; Elf_Sym sbuf[1024];
@ -252,7 +252,7 @@ __elf_fdnlist(fd, list)
Elf_Ehdr ehdr; Elf_Ehdr ehdr;
char *strtab = NULL; char *strtab = NULL;
Elf_Shdr *shdr = NULL; Elf_Shdr *shdr = NULL;
Elf_Word shdr_size; Elf_Size shdr_size;
void *base; void *base;
struct stat st; struct stat st;

View File

@ -449,7 +449,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
} }
Elf_Addr Elf_Addr
_rtld_bind(Obj_Entry *obj, Elf_Word reloff) _rtld_bind(Obj_Entry *obj, Elf_Size reloff)
{ {
const Elf_Rel *rel; const Elf_Rel *rel;
const Elf_Sym *def; const Elf_Sym *def;

View File

@ -122,8 +122,8 @@ typedef struct Struct_Obj_Entry {
* These two items have to be set right for compatibility with the * These two items have to be set right for compatibility with the
* original ElfKit crt1.o. * original ElfKit crt1.o.
*/ */
Elf_Word magic; /* Magic number (sanity check) */ Elf_Size magic; /* Magic number (sanity check) */
Elf_Word version; /* Version number of struct format */ Elf_Size version; /* Version number of struct format */
struct Struct_Obj_Entry *next; struct Struct_Obj_Entry *next;
char *path; /* Pathname of underlying file (%) */ char *path; /* Pathname of underlying file (%) */

View File

@ -193,7 +193,7 @@ static long reloc_target_bitmask[] = {
static int reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *rela, static int reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *rela,
SymCache *cache); SymCache *cache);
static void install_plt(Elf_Half *pltgot, Elf_Addr proc); static void install_plt(Elf_Word *pltgot, Elf_Addr proc);
extern char _rtld_bind_start_0[]; extern char _rtld_bind_start_0[];
extern char _rtld_bind_start_1[]; extern char _rtld_bind_start_1[];
@ -280,13 +280,13 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *rela, SymCache *cache)
const Obj_Entry *defobj; const Obj_Entry *defobj;
const Elf_Sym *def; const Elf_Sym *def;
Elf_Addr *where; Elf_Addr *where;
Elf_Half *where32; Elf_Word *where32;
Elf_Word type; Elf_Word type;
Elf_Addr value; Elf_Addr value;
Elf_Addr mask; Elf_Addr mask;
where = (Elf_Addr *)(obj->relocbase + rela->r_offset); where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
where32 = (Elf_Half *)where; where32 = (Elf_Word *)where;
defobj = NULL; defobj = NULL;
def = NULL; def = NULL;
@ -468,7 +468,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj,
{ {
const Elf_Rela *rela = (const Elf_Rela *)rel; const Elf_Rela *rela = (const Elf_Rela *)rel;
Elf_Addr offset; Elf_Addr offset;
Elf_Half *where; Elf_Word *where;
if (rela - refobj->pltrela < 32764) { if (rela - refobj->pltrela < 32764) {
/* /*
@ -496,7 +496,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj,
* have a choice of several different relocation techniques * have a choice of several different relocation techniques
* which are increasingly expensive. * which are increasingly expensive.
*/ */
where = (Elf_Half *)wherep; where = (Elf_Word *)wherep;
offset = ((Elf_Addr)where) - target; offset = ((Elf_Addr)where) - target;
if (offset <= (1L<<20) && offset >= -(1L<<20)) { if (offset <= (1L<<20) && offset >= -(1L<<20)) {
/* /*
@ -687,10 +687,10 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj,
void void
init_pltgot(Obj_Entry *obj) init_pltgot(Obj_Entry *obj)
{ {
Elf_Half *entry; Elf_Word *entry;
if (obj->pltgot != NULL) { if (obj->pltgot != NULL) {
entry = (Elf_Half *)obj->pltgot; entry = (Elf_Word *)obj->pltgot;
install_plt(&entry[0], (Elf_Addr)_rtld_bind_start_0); install_plt(&entry[0], (Elf_Addr)_rtld_bind_start_0);
install_plt(&entry[8], (Elf_Addr)_rtld_bind_start_1); install_plt(&entry[8], (Elf_Addr)_rtld_bind_start_1);
obj->pltgot[8] = (Elf_Addr)obj; obj->pltgot[8] = (Elf_Addr)obj;
@ -698,7 +698,7 @@ init_pltgot(Obj_Entry *obj)
} }
static void static void
install_plt(Elf_Half *pltgot, Elf_Addr proc) install_plt(Elf_Word *pltgot, Elf_Addr proc)
{ {
pltgot[0] = SAVE; pltgot[0] = SAVE;
flush(pltgot, 0); flush(pltgot, 0);

View File

@ -88,23 +88,22 @@ symbol tables.
.Pp .Pp
The following types are being used for 32-bit architectures: The following types are being used for 32-bit architectures:
.Bd -literal -offset indent .Bd -literal -offset indent
Elf32_Addr Unsigned program address Elf32_Addr Unsigned 32-bit program address
Elf32_Half Unsigned halfword field Elf32_Half Unsigned 16-bit field
Elf32_Off Unsigned file offset Elf32_Off Unsigned 32-bit file offset
Elf32_Sword Signed large integer Elf32_Sword Signed 32-bit field or integer
Elf32_Word Field or unsigned large integer Elf32_Word Unsigned 32-bit field or integer
Elf32_Size Unsigned object size
.Ed .Ed
.Pp .Pp
For 64-bit architectures we have the following types: For 64-bit architectures we have the following types:
.Bd -literal -offset indent .Bd -literal -offset indent
Elf64_Addr Unsigned program address Elf64_Addr Unsigned 64-bit program address
Elf64_Half Unsigned halfword field Elf64_Half Unsigned 16-bit field
Elf64_Off Unsigned file offset Elf64_Off Unsigned 64-bit file offset
Elf64_Sword Signed large integer Elf64_Sword Signed 32-bit field
Elf64_Word Field or unsigned large integer Elf64_Word Unsigned 32-bit field
Elf64_Size Unsigned object size Elf64_Sxword Signed 64-bit field or integer
Elf64_Quarter Unsigned quarterword field Elf64_Xword Unsigned 64-bit field or integer
.Ed .Ed
.Pp .Pp
All data structures that the file format defines follow the All data structures that the file format defines follow the
@ -137,19 +136,19 @@ typedef struct {
.Bd -literal -offset indent .Bd -literal -offset indent
typedef struct { typedef struct {
unsigned char e_ident[EI_NIDENT]; unsigned char e_ident[EI_NIDENT];
Elf64_Quarter e_type; Elf64_Half e_type;
Elf64_Quarter e_machine; Elf64_Half e_machine;
Elf64_Half e_version; Elf64_Word e_version;
Elf64_Addr e_entry; Elf64_Addr e_entry;
Elf64_Off e_phoff; Elf64_Off e_phoff;
Elf64_Off e_shoff; Elf64_Off e_shoff;
Elf64_Half e_flags; Elf64_Word e_flags;
Elf64_Quarter e_ehsize; Elf64_Half e_ehsize;
Elf64_Quarter e_phentsize; Elf64_Half e_phentsize;
Elf64_Quarter e_phnum; Elf64_Half e_phnum;
Elf64_Quarter e_shentsize; Elf64_Half e_shentsize;
Elf64_Quarter e_shnum; Elf64_Half e_shnum;
Elf64_Quarter e_shstrndx; Elf64_Half e_shstrndx;
} Elf64_Ehdr; } Elf64_Ehdr;
.Ed .Ed
.Pp .Pp
@ -416,23 +415,23 @@ typedef struct {
Elf32_Off p_offset; Elf32_Off p_offset;
Elf32_Addr p_vaddr; Elf32_Addr p_vaddr;
Elf32_Addr p_paddr; Elf32_Addr p_paddr;
Elf32_Size p_filesz; Elf32_Word p_filesz;
Elf32_Size p_memsz; Elf32_Word p_memsz;
Elf32_Word p_flags; Elf32_Word p_flags;
Elf32_Size p_align; Elf32_Word p_align;
} Elf32_Phdr; } Elf32_Phdr;
.Ed .Ed
.Pp .Pp
.Bd -literal -offset indent .Bd -literal -offset indent
typedef struct { typedef struct {
Elf64_Half p_type; Elf64_Word p_type;
Elf64_Half p_flags; Elf64_Word p_flags;
Elf64_Off p_offset; Elf64_Off p_offset;
Elf64_Addr p_vaddr; Elf64_Addr p_vaddr;
Elf64_Addr p_paddr; Elf64_Addr p_paddr;
Elf64_Size p_filesz; Elf64_Xword p_filesz;
Elf64_Size p_memsz; Elf64_Xword p_memsz;
Elf64_Size p_align; Elf64_Xword p_align;
} Elf64_Phdr; } Elf64_Phdr;
.Ed .Ed
.Pp .Pp
@ -631,26 +630,26 @@ typedef struct {
Elf32_Word sh_flags; Elf32_Word sh_flags;
Elf32_Addr sh_addr; Elf32_Addr sh_addr;
Elf32_Off sh_offset; Elf32_Off sh_offset;
Elf32_Size sh_size; Elf32_Word sh_size;
Elf32_Word sh_link; Elf32_Word sh_link;
Elf32_Word sh_info; Elf32_Word sh_info;
Elf32_Size sh_addralign; Elf32_Word sh_addralign;
Elf32_Size sh_entsize; Elf32_Word sh_entsize;
} Elf32_Shdr; } Elf32_Shdr;
.Ed .Ed
.Pp .Pp
.Bd -literal -offset indent .Bd -literal -offset indent
typedef struct { typedef struct {
Elf64_Half sh_name; Elf64_Word sh_name;
Elf64_Half sh_type; Elf64_Word sh_type;
Elf64_Size sh_flags; Elf64_Xword sh_flags;
Elf64_Addr sh_addr; Elf64_Addr sh_addr;
Elf64_Off sh_offset; Elf64_Off sh_offset;
Elf64_Size sh_size; Elf64_Xword sh_size;
Elf64_Half sh_link; Elf64_Word sh_link;
Elf64_Half sh_info; Elf64_Word sh_info;
Elf64_Size sh_addralign; Elf64_Xword sh_addralign;
Elf64_Size sh_entsize; Elf64_Xword sh_entsize;
} Elf64_Shdr; } Elf64_Shdr;
.Ed .Ed
.Pp .Pp
@ -1073,7 +1072,7 @@ index is a subscript into this array.
typedef struct { typedef struct {
Elf32_Word st_name; Elf32_Word st_name;
Elf32_Addr st_value; Elf32_Addr st_value;
Elf32_Size st_size; Elf32_Word st_size;
unsigned char st_info; unsigned char st_info;
unsigned char st_other; unsigned char st_other;
Elf32_Half st_shndx; Elf32_Half st_shndx;
@ -1082,12 +1081,12 @@ typedef struct {
.Pp .Pp
.Bd -literal -offset indent .Bd -literal -offset indent
typedef struct { typedef struct {
Elf64_Half st_name; Elf64_Word st_name;
unsigned char st_info; unsigned char st_info;
unsigned char st_other; unsigned char st_other;
Elf64_Quarter st_shndx; Elf64_Half st_shndx;
Elf64_Addr st_value; Elf64_Addr st_value;
Elf64_Size st_size; Elf64_Xword st_size;
} Elf64_Sym; } Elf64_Sym;
.Ed .Ed
.Pp .Pp
@ -1217,7 +1216,7 @@ typedef struct {
.Bd -literal -offset indent .Bd -literal -offset indent
typedef struct { typedef struct {
Elf64_Addr r_offset; Elf64_Addr r_offset;
Elf64_Size r_info; Elf64_Xword r_info;
} Elf64_Rel; } Elf64_Rel;
.Ed .Ed
.Pp .Pp
@ -1233,8 +1232,8 @@ typedef struct {
.Bd -literal -offset indent .Bd -literal -offset indent
typedef struct { typedef struct {
Elf64_Addr r_offset; Elf64_Addr r_offset;
Elf64_Size r_info; Elf64_Xword r_info;
Elf64_Off r_addend; Elf64_Sxword r_addend;
} Elf64_Rela; } Elf64_Rela;
.Ed .Ed
.Pp .Pp

View File

@ -121,7 +121,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
Elf_Addr *where; Elf_Addr *where;
Elf_Addr addr; Elf_Addr addr;
Elf_Addr addend; Elf_Addr addend;
Elf_Word rtype, symidx; Elf_Size rtype, symidx;
const Elf_Rel *rel; const Elf_Rel *rel;
const Elf_Rela *rela; const Elf_Rela *rela;

View File

@ -119,7 +119,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
Elf32_Addr *where32, val32; Elf32_Addr *where32, val32;
Elf_Addr addr; Elf_Addr addr;
Elf_Addr addend; Elf_Addr addend;
Elf_Word rtype, symidx; Elf_Size rtype, symidx;
const Elf_Rel *rel; const Elf_Rel *rel;
const Elf_Rela *rela; const Elf_Rela *rela;

View File

@ -240,7 +240,7 @@ int file_addmodule(struct preloaded_file *fp, char *modname, int version,
#define ELF_RELOC_RELA 2 #define ELF_RELOC_RELA 2
struct elf_file; struct elf_file;
typedef Elf_Addr (symaddr_fn)(struct elf_file *ef, Elf_Word symidx); typedef Elf_Addr (symaddr_fn)(struct elf_file *ef, Elf_Size symidx);
int __elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file **result); int __elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file **result);
int __elfN(obj_loadfile)(char *filename, u_int64_t dest, int __elfN(obj_loadfile)(char *filename, u_int64_t dest,

View File

@ -744,7 +744,7 @@ __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef,
} }
static Elf_Addr static Elf_Addr
__elfN(symaddr)(struct elf_file *ef, Elf_Word symidx) __elfN(symaddr)(struct elf_file *ef, Elf_Size symidx)
{ {
/* Symbol lookup by index not required here. */ /* Symbol lookup by index not required here. */

View File

@ -70,7 +70,7 @@ static int __elfN(obj_reloc_ptr)(struct preloaded_file *mp, elf_file_t ef,
Elf_Addr p, void *val, size_t len); Elf_Addr p, void *val, size_t len);
static int __elfN(obj_parse_modmetadata)(struct preloaded_file *mp, static int __elfN(obj_parse_modmetadata)(struct preloaded_file *mp,
elf_file_t ef); elf_file_t ef);
static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Word symidx); static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size symidx);
const char *__elfN(obj_kerneltype) = "elf kernel"; const char *__elfN(obj_kerneltype) = "elf kernel";
const char *__elfN(obj_moduletype) = "elf obj module"; const char *__elfN(obj_moduletype) = "elf obj module";
@ -495,7 +495,7 @@ __elfN(obj_reloc_ptr)(struct preloaded_file *mp, elf_file_t ef, Elf_Addr p,
/* Look up the address of a specified symbol. */ /* Look up the address of a specified symbol. */
static Elf_Addr static Elf_Addr
__elfN(obj_symaddr)(struct elf_file *ef, Elf_Word symidx) __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size symidx)
{ {
Elf_Sym sym; Elf_Sym sym;
Elf_Addr base; Elf_Addr base;

View File

@ -54,7 +54,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata,
int reltype, Elf_Addr relbase, Elf_Addr dataaddr, void *data, size_t len) int reltype, Elf_Addr relbase, Elf_Addr dataaddr, void *data, size_t len)
{ {
#ifdef __sparc__ #ifdef __sparc__
Elf_Word w; Elf_Size w;
const Elf_Rela *a; const Elf_Rela *a;
switch (reltype) { switch (reltype) {
@ -81,7 +81,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata,
#elif defined(__i386__) && __ELF_WORD_SIZE == 64 #elif defined(__i386__) && __ELF_WORD_SIZE == 64
Elf64_Addr *where, val; Elf64_Addr *where, val;
Elf_Addr addend, addr; Elf_Addr addend, addr;
Elf_Word rtype, symidx; Elf_Size rtype, symidx;
const Elf_Rel *rel; const Elf_Rel *rel;
const Elf_Rela *rela; const Elf_Rela *rela;
@ -138,7 +138,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata,
return (0); return (0);
#elif defined(__i386__) && __ELF_WORD_SIZE == 32 #elif defined(__i386__) && __ELF_WORD_SIZE == 32
Elf_Addr addend, addr, *where, val; Elf_Addr addend, addr, *where, val;
Elf_Word rtype, symidx; Elf_Size rtype, symidx;
const Elf_Rel *rel; const Elf_Rel *rel;
const Elf_Rela *rela; const Elf_Rela *rela;

View File

@ -118,7 +118,7 @@ elf64_dump_thread(struct thread *td, void *dst, size_t *off __unused)
static Elf_Addr static Elf_Addr
lookup_fdesc(linker_file_t lf, Elf_Word symidx, elf_lookup_fn lookup) lookup_fdesc(linker_file_t lf, Elf_Size symidx, elf_lookup_fn lookup)
{ {
linker_file_t top; linker_file_t top;
Elf_Addr addr; Elf_Addr addr;
@ -171,7 +171,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data,
{ {
Elf_Addr *where; Elf_Addr *where;
Elf_Addr addend, addr; Elf_Addr addend, addr;
Elf_Word rtype, symidx; Elf_Size rtype, symidx;
const Elf_Rel *rel; const Elf_Rel *rel;
const Elf_Rela *rela; const Elf_Rela *rela;

View File

@ -120,7 +120,7 @@ static int link_elf_each_function_name(linker_file_t,
int (*)(const char *, void *), int (*)(const char *, void *),
void *); void *);
static void link_elf_reloc_local(linker_file_t); static void link_elf_reloc_local(linker_file_t);
static Elf_Addr elf_lookup(linker_file_t lf, Elf_Word symidx, int deps); static Elf_Addr elf_lookup(linker_file_t lf, Elf_Size symidx, int deps);
static kobj_method_t link_elf_methods[] = { static kobj_method_t link_elf_methods[] = {
KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol), KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol),
@ -909,7 +909,7 @@ link_elf_unload_preload(linker_file_t file)
} }
static const char * static const char *
symbol_name(elf_file_t ef, Elf_Word r_info) symbol_name(elf_file_t ef, Elf_Size r_info)
{ {
const Elf_Sym *ref; const Elf_Sym *ref;
@ -1232,7 +1232,7 @@ link_elf_get_gp(linker_file_t lf)
#endif #endif
const Elf_Sym * const Elf_Sym *
elf_get_sym(linker_file_t lf, Elf_Word symidx) elf_get_sym(linker_file_t lf, Elf_Size symidx)
{ {
elf_file_t ef = (elf_file_t)lf; elf_file_t ef = (elf_file_t)lf;
@ -1242,7 +1242,7 @@ elf_get_sym(linker_file_t lf, Elf_Word symidx)
} }
const char * const char *
elf_get_symname(linker_file_t lf, Elf_Word symidx) elf_get_symname(linker_file_t lf, Elf_Size symidx)
{ {
elf_file_t ef = (elf_file_t)lf; elf_file_t ef = (elf_file_t)lf;
const Elf_Sym *sym; const Elf_Sym *sym;
@ -1261,7 +1261,7 @@ elf_get_symname(linker_file_t lf, Elf_Word symidx)
* the case that the symbol can be found through the hash table. * the case that the symbol can be found through the hash table.
*/ */
static Elf_Addr static Elf_Addr
elf_lookup(linker_file_t lf, Elf_Word symidx, int deps) elf_lookup(linker_file_t lf, Elf_Size symidx, int deps)
{ {
elf_file_t ef = (elf_file_t)lf; elf_file_t ef = (elf_file_t)lf;
const Elf_Sym *sym; const Elf_Sym *sym;

View File

@ -124,7 +124,7 @@ static int link_elf_each_function_name(linker_file_t,
int (*)(const char *, void *), void *); int (*)(const char *, void *), void *);
static void link_elf_reloc_local(linker_file_t); static void link_elf_reloc_local(linker_file_t);
static Elf_Addr elf_obj_lookup(linker_file_t lf, Elf_Word symidx, int deps); static Elf_Addr elf_obj_lookup(linker_file_t lf, Elf_Size symidx, int deps);
static kobj_method_t link_elf_methods[] = { static kobj_method_t link_elf_methods[] = {
KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol), KOBJMETHOD(linker_lookup_symbol, link_elf_lookup_symbol),
@ -843,7 +843,7 @@ link_elf_unload_file(linker_file_t file)
} }
static const char * static const char *
symbol_name(elf_file_t ef, Elf_Word r_info) symbol_name(elf_file_t ef, Elf_Size r_info)
{ {
const Elf_Sym *ref; const Elf_Sym *ref;
@ -879,7 +879,7 @@ relocate_file(elf_file_t ef)
const char *symname; const char *symname;
const Elf_Sym *sym; const Elf_Sym *sym;
int i; int i;
Elf_Word symidx; Elf_Size symidx;
Elf_Addr base; Elf_Addr base;
@ -1069,7 +1069,7 @@ link_elf_each_function_name(linker_file_t file,
* the case that the symbol can be found through the hash table. * the case that the symbol can be found through the hash table.
*/ */
static Elf_Addr static Elf_Addr
elf_obj_lookup(linker_file_t lf, Elf_Word symidx, int deps) elf_obj_lookup(linker_file_t lf, Elf_Size symidx, int deps)
{ {
elf_file_t ef = (elf_file_t)lf; elf_file_t ef = (elf_file_t)lf;
const Elf_Sym *sym; const Elf_Sym *sym;
@ -1122,7 +1122,7 @@ link_elf_reloc_local(linker_file_t lf)
const Elf_Sym *sym; const Elf_Sym *sym;
Elf_Addr base; Elf_Addr base;
int i; int i;
Elf_Word symidx; Elf_Size symidx;
/* Perform relocations without addend if there are any: */ /* Perform relocations without addend if there are any: */
for (i = 0; i < ef->nrel; i++) { for (i = 0; i < ef->nrel; i++) {

View File

@ -288,9 +288,9 @@ elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
elf_lookup_fn lookup) elf_lookup_fn lookup)
{ {
const Elf_Rela *rela; const Elf_Rela *rela;
Elf_Half *where32; Elf_Word *where32;
Elf_Addr *where; Elf_Addr *where;
Elf_Word rtype, symidx; Elf_Size rtype, symidx;
Elf_Addr value; Elf_Addr value;
Elf_Addr mask; Elf_Addr mask;
Elf_Addr addr; Elf_Addr addr;
@ -300,7 +300,7 @@ elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type,
rela = (const Elf_Rela *)data; rela = (const Elf_Rela *)data;
where = (Elf_Addr *)(relocbase + rela->r_offset); where = (Elf_Addr *)(relocbase + rela->r_offset);
where32 = (Elf_Half *)where; where32 = (Elf_Word *)where;
rtype = ELF_R_TYPE(rela->r_info); rtype = ELF_R_TYPE(rela->r_info);
symidx = ELF_R_SYM(rela->r_info); symidx = ELF_R_SYM(rela->r_info);

View File

@ -35,13 +35,17 @@
* ELF definitions common to all 32-bit architectures. * ELF definitions common to all 32-bit architectures.
*/ */
typedef u_int32_t Elf32_Addr; typedef uint32_t Elf32_Addr;
typedef u_int16_t Elf32_Half; typedef uint16_t Elf32_Half;
typedef u_int32_t Elf32_Off; typedef uint32_t Elf32_Off;
typedef int32_t Elf32_Sword; typedef int32_t Elf32_Sword;
typedef u_int32_t Elf32_Word; typedef uint32_t Elf32_Word;
typedef u_int32_t Elf32_Size;
typedef Elf32_Off Elf32_Hashelt; typedef Elf32_Word Elf32_Hashelt;
/* Non-standard class-dependent datatype used for abstraction. */
typedef Elf32_Word Elf32_Size;
typedef Elf32_Sword Elf32_Ssize;
/* /*
* ELF header. * ELF header.
@ -75,11 +79,11 @@ typedef struct {
Elf32_Word sh_flags; /* Section flags. */ Elf32_Word sh_flags; /* Section flags. */
Elf32_Addr sh_addr; /* Address in memory image. */ Elf32_Addr sh_addr; /* Address in memory image. */
Elf32_Off sh_offset; /* Offset in file. */ Elf32_Off sh_offset; /* Offset in file. */
Elf32_Size sh_size; /* Size in bytes. */ Elf32_Word sh_size; /* Size in bytes. */
Elf32_Word sh_link; /* Index of a related section. */ Elf32_Word sh_link; /* Index of a related section. */
Elf32_Word sh_info; /* Depends on section type. */ Elf32_Word sh_info; /* Depends on section type. */
Elf32_Size sh_addralign; /* Alignment in bytes. */ Elf32_Word sh_addralign; /* Alignment in bytes. */
Elf32_Size sh_entsize; /* Size of each entry in section. */ Elf32_Word sh_entsize; /* Size of each entry in section. */
} Elf32_Shdr; } Elf32_Shdr;
/* /*
@ -91,10 +95,10 @@ typedef struct {
Elf32_Off p_offset; /* File offset of contents. */ Elf32_Off p_offset; /* File offset of contents. */
Elf32_Addr p_vaddr; /* Virtual address in memory image. */ Elf32_Addr p_vaddr; /* Virtual address in memory image. */
Elf32_Addr p_paddr; /* Physical address (not used). */ Elf32_Addr p_paddr; /* Physical address (not used). */
Elf32_Size p_filesz; /* Size of contents in file. */ Elf32_Word p_filesz; /* Size of contents in file. */
Elf32_Size p_memsz; /* Size of contents in memory. */ Elf32_Word p_memsz; /* Size of contents in memory. */
Elf32_Word p_flags; /* Access permission flags. */ Elf32_Word p_flags; /* Access permission flags. */
Elf32_Size p_align; /* Alignment in memory and file. */ Elf32_Word p_align; /* Alignment in memory and file. */
} Elf32_Phdr; } Elf32_Phdr;
/* /*
@ -104,7 +108,7 @@ typedef struct {
typedef struct { typedef struct {
Elf32_Sword d_tag; /* Entry type. */ Elf32_Sword d_tag; /* Entry type. */
union { union {
Elf32_Size d_val; /* Integer value. */ Elf32_Word d_val; /* Integer value. */
Elf32_Addr d_ptr; /* Address value. */ Elf32_Addr d_ptr; /* Address value. */
} d_un; } d_un;
} Elf32_Dyn; } Elf32_Dyn;
@ -140,7 +144,7 @@ typedef struct {
typedef struct { typedef struct {
Elf32_Word st_name; /* String table index of name. */ Elf32_Word st_name; /* String table index of name. */
Elf32_Addr st_value; /* Symbol value. */ Elf32_Addr st_value; /* Symbol value. */
Elf32_Size st_size; /* Size of associated object. */ Elf32_Word st_size; /* Size of associated object. */
unsigned char st_info; /* Type and binding information. */ unsigned char st_info; /* Type and binding information. */
unsigned char st_other; /* Reserved (not used). */ unsigned char st_other; /* Reserved (not used). */
Elf32_Half st_shndx; /* Section index of symbol. */ Elf32_Half st_shndx; /* Section index of symbol. */

View File

@ -35,13 +35,13 @@
* ELF definitions common to all 64-bit architectures. * ELF definitions common to all 64-bit architectures.
*/ */
typedef u_int64_t Elf64_Addr; typedef uint64_t Elf64_Addr;
typedef u_int32_t Elf64_Half; typedef uint16_t Elf64_Half;
typedef u_int64_t Elf64_Off; typedef uint64_t Elf64_Off;
typedef int64_t Elf64_Sword; typedef int32_t Elf64_Sword;
typedef u_int64_t Elf64_Word; typedef int64_t Elf64_Sxword;
typedef u_int64_t Elf64_Size; typedef uint32_t Elf64_Word;
typedef u_int16_t Elf64_Quarter; typedef uint64_t Elf64_Xword;
/* /*
* Types of dynamic symbol hash table bucket and chain elements. * Types of dynamic symbol hash table bucket and chain elements.
@ -53,28 +53,32 @@ typedef u_int16_t Elf64_Quarter;
#ifdef __alpha__ #ifdef __alpha__
typedef Elf64_Off Elf64_Hashelt; typedef Elf64_Off Elf64_Hashelt;
#else #else
typedef Elf64_Half Elf64_Hashelt; typedef Elf64_Word Elf64_Hashelt;
#endif #endif
/* Non-standard class-dependent datatype used for abstraction. */
typedef Elf64_Xword Elf64_Size;
typedef Elf64_Sxword Elf64_Ssize;
/* /*
* ELF header. * ELF header.
*/ */
typedef struct { typedef struct {
unsigned char e_ident[EI_NIDENT]; /* File identification. */ unsigned char e_ident[EI_NIDENT]; /* File identification. */
Elf64_Quarter e_type; /* File type. */ Elf64_Half e_type; /* File type. */
Elf64_Quarter e_machine; /* Machine architecture. */ Elf64_Half e_machine; /* Machine architecture. */
Elf64_Half e_version; /* ELF format version. */ Elf64_Word e_version; /* ELF format version. */
Elf64_Addr e_entry; /* Entry point. */ Elf64_Addr e_entry; /* Entry point. */
Elf64_Off e_phoff; /* Program header file offset. */ Elf64_Off e_phoff; /* Program header file offset. */
Elf64_Off e_shoff; /* Section header file offset. */ Elf64_Off e_shoff; /* Section header file offset. */
Elf64_Half e_flags; /* Architecture-specific flags. */ Elf64_Word e_flags; /* Architecture-specific flags. */
Elf64_Quarter e_ehsize; /* Size of ELF header in bytes. */ Elf64_Half e_ehsize; /* Size of ELF header in bytes. */
Elf64_Quarter e_phentsize; /* Size of program header entry. */ Elf64_Half e_phentsize; /* Size of program header entry. */
Elf64_Quarter e_phnum; /* Number of program header entries. */ Elf64_Half e_phnum; /* Number of program header entries. */
Elf64_Quarter e_shentsize; /* Size of section header entry. */ Elf64_Half e_shentsize; /* Size of section header entry. */
Elf64_Quarter e_shnum; /* Number of section header entries. */ Elf64_Half e_shnum; /* Number of section header entries. */
Elf64_Quarter e_shstrndx; /* Section name strings section. */ Elf64_Half e_shstrndx; /* Section name strings section. */
} Elf64_Ehdr; } Elf64_Ehdr;
/* /*
@ -82,17 +86,17 @@ typedef struct {
*/ */
typedef struct { typedef struct {
Elf64_Half sh_name; /* Section name (index into the Elf64_Word sh_name; /* Section name (index into the
section header string table). */ section header string table). */
Elf64_Half sh_type; /* Section type. */ Elf64_Word sh_type; /* Section type. */
Elf64_Size sh_flags; /* Section flags. */ Elf64_Xword sh_flags; /* Section flags. */
Elf64_Addr sh_addr; /* Address in memory image. */ Elf64_Addr sh_addr; /* Address in memory image. */
Elf64_Off sh_offset; /* Offset in file. */ Elf64_Off sh_offset; /* Offset in file. */
Elf64_Size sh_size; /* Size in bytes. */ Elf64_Xword sh_size; /* Size in bytes. */
Elf64_Half sh_link; /* Index of a related section. */ Elf64_Word sh_link; /* Index of a related section. */
Elf64_Half sh_info; /* Depends on section type. */ Elf64_Word sh_info; /* Depends on section type. */
Elf64_Size sh_addralign; /* Alignment in bytes. */ Elf64_Xword sh_addralign; /* Alignment in bytes. */
Elf64_Size sh_entsize; /* Size of each entry in section. */ Elf64_Xword sh_entsize; /* Size of each entry in section. */
} Elf64_Shdr; } Elf64_Shdr;
/* /*
@ -100,14 +104,14 @@ typedef struct {
*/ */
typedef struct { typedef struct {
Elf64_Half p_type; /* Entry type. */ Elf64_Word p_type; /* Entry type. */
Elf64_Half p_flags; /* Access permission flags. */ Elf64_Word p_flags; /* Access permission flags. */
Elf64_Off p_offset; /* File offset of contents. */ Elf64_Off p_offset; /* File offset of contents. */
Elf64_Addr p_vaddr; /* Virtual address in memory image. */ Elf64_Addr p_vaddr; /* Virtual address in memory image. */
Elf64_Addr p_paddr; /* Physical address (not used). */ Elf64_Addr p_paddr; /* Physical address (not used). */
Elf64_Size p_filesz; /* Size of contents in file. */ Elf64_Xword p_filesz; /* Size of contents in file. */
Elf64_Size p_memsz; /* Size of contents in memory. */ Elf64_Xword p_memsz; /* Size of contents in memory. */
Elf64_Size p_align; /* Alignment in memory and file. */ Elf64_Xword p_align; /* Alignment in memory and file. */
} Elf64_Phdr; } Elf64_Phdr;
/* /*
@ -115,9 +119,9 @@ typedef struct {
*/ */
typedef struct { typedef struct {
Elf64_Size d_tag; /* Entry type. */ Elf64_Sxword d_tag; /* Entry type. */
union { union {
Elf64_Size d_val; /* Integer value. */ Elf64_Xword d_val; /* Integer value. */
Elf64_Addr d_ptr; /* Address value. */ Elf64_Addr d_ptr; /* Address value. */
} d_un; } d_un;
} Elf64_Dyn; } Elf64_Dyn;
@ -129,14 +133,14 @@ typedef struct {
/* Relocations that don't need an addend field. */ /* Relocations that don't need an addend field. */
typedef struct { typedef struct {
Elf64_Addr r_offset; /* Location to be relocated. */ Elf64_Addr r_offset; /* Location to be relocated. */
Elf64_Size r_info; /* Relocation type and symbol index. */ Elf64_Xword r_info; /* Relocation type and symbol index. */
} Elf64_Rel; } Elf64_Rel;
/* Relocations that need an addend field. */ /* Relocations that need an addend field. */
typedef struct { typedef struct {
Elf64_Addr r_offset; /* Location to be relocated. */ Elf64_Addr r_offset; /* Location to be relocated. */
Elf64_Size r_info; /* Relocation type and symbol index. */ Elf64_Xword r_info; /* Relocation type and symbol index. */
Elf64_Off r_addend; /* Addend. */ Elf64_Sxword r_addend; /* Addend. */
} Elf64_Rela; } Elf64_Rela;
/* Macros for accessing the fields of r_info. */ /* Macros for accessing the fields of r_info. */
@ -151,12 +155,12 @@ typedef struct {
*/ */
typedef struct { typedef struct {
Elf64_Half st_name; /* String table index of name. */ Elf64_Word st_name; /* String table index of name. */
unsigned char st_info; /* Type and binding information. */ unsigned char st_info; /* Type and binding information. */
unsigned char st_other; /* Reserved (not used). */ unsigned char st_other; /* Reserved (not used). */
Elf64_Quarter st_shndx; /* Section index of symbol. */ Elf64_Half st_shndx; /* Section index of symbol. */
Elf64_Addr st_value; /* Symbol value. */ Elf64_Addr st_value; /* Symbol value. */
Elf64_Size st_size; /* Size of associated object. */ Elf64_Xword st_size; /* Size of associated object. */
} Elf64_Sym; } Elf64_Sym;
/* Macros for accessing the fields of st_info. */ /* Macros for accessing the fields of st_info. */

View File

@ -60,8 +60,6 @@ __ElfType(Half);
__ElfType(Off); __ElfType(Off);
__ElfType(Sword); __ElfType(Sword);
__ElfType(Word); __ElfType(Word);
__ElfType(Size);
__ElfType(Hashelt);
__ElfType(Ehdr); __ElfType(Ehdr);
__ElfType(Shdr); __ElfType(Shdr);
__ElfType(Phdr); __ElfType(Phdr);
@ -70,6 +68,11 @@ __ElfType(Rel);
__ElfType(Rela); __ElfType(Rela);
__ElfType(Sym); __ElfType(Sym);
/* Non-standard ELF types. */
__ElfType(Hashelt);
__ElfType(Size);
__ElfType(Ssize);
#define ELF_R_SYM __ELFN(R_SYM) #define ELF_R_SYM __ELFN(R_SYM)
#define ELF_R_TYPE __ELFN(R_TYPE) #define ELF_R_TYPE __ELFN(R_TYPE)
#define ELF_R_INFO __ELFN(R_INFO) #define ELF_R_INFO __ELFN(R_INFO)

View File

@ -44,15 +44,15 @@ struct thread;
* stack fixup routine. * stack fixup routine.
*/ */
typedef struct { typedef struct {
Elf_Sword execfd; Elf_Ssize execfd;
Elf_Word phdr; Elf_Size phdr;
Elf_Word phent; Elf_Size phent;
Elf_Word phnum; Elf_Size phnum;
Elf_Word pagesz; Elf_Size pagesz;
Elf_Word base; Elf_Size base;
Elf_Word flags; Elf_Size flags;
Elf_Word entry; Elf_Size entry;
Elf_Word trace; Elf_Size trace;
} __ElfN(Auxargs); } __ElfN(Auxargs);
typedef struct { typedef struct {

View File

@ -242,13 +242,13 @@ extern int kld_debug;
#endif #endif
typedef Elf_Addr elf_lookup_fn(linker_file_t, Elf_Word, int); typedef Elf_Addr elf_lookup_fn(linker_file_t, Elf_Size, int);
/* Support functions */ /* Support functions */
int elf_reloc(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu); int elf_reloc(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu);
int elf_reloc_local(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu); int elf_reloc_local(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu);
const Elf_Sym *elf_get_sym(linker_file_t _lf, Elf_Word _symidx); const Elf_Sym *elf_get_sym(linker_file_t _lf, Elf_Size _symidx);
const char *elf_get_symname(linker_file_t _lf, Elf_Word _symidx); const char *elf_get_symname(linker_file_t _lf, Elf_Size _symidx);
int elf_cpu_load_file(linker_file_t); int elf_cpu_load_file(linker_file_t);
int elf_cpu_unload_file(linker_file_t); int elf_cpu_unload_file(linker_file_t);

View File

@ -66,15 +66,15 @@ static void usage(void);
int int
main(int ac, char **av) main(int ac, char **av)
{ {
Elf64_Quarter phentsize; Elf64_Half phentsize;
Elf64_Quarter machine; Elf64_Half machine;
Elf64_Quarter phnum; Elf64_Half phnum;
Elf64_Size filesz; Elf64_Xword filesz;
Elf64_Size memsz; Elf64_Xword memsz;
Elf64_Addr entry; Elf64_Addr entry;
Elf64_Off offset; Elf64_Off offset;
Elf64_Off phoff; Elf64_Off phoff;
Elf64_Half type; Elf64_Word type;
unsigned char data; unsigned char data;
struct stat sb; struct stat sb;
struct exec a; struct exec a;

View File

@ -192,7 +192,7 @@ ELFNAMEEND(hide)(int fd, const char *fn)
Elf_Shdr *shdrp = NULL, *symtabshdr, *strtabshdr; Elf_Shdr *shdrp = NULL, *symtabshdr, *strtabshdr;
Elf_Sym *symtabp = NULL; Elf_Sym *symtabp = NULL;
char *strtabp = NULL; char *strtabp = NULL;
Elf_Word *symfwmap = NULL, *symrvmap = NULL, nsyms, nlocalsyms, ewi; Elf_Size *symfwmap = NULL, *symrvmap = NULL, nsyms, nlocalsyms, ewi;
struct listelem *relalist = NULL, *rellist = NULL, *tmpl; struct listelem *relalist = NULL, *rellist = NULL, *tmpl;
ssize_t shdrsize; ssize_t shdrsize;
int rv, i, weird; int rv, i, weird;
@ -295,10 +295,10 @@ ELFNAMEEND(hide)(int fd, const char *fn)
/* Prepare data structures for symbol movement. */ /* Prepare data structures for symbol movement. */
nsyms = xewtoh(symtabshdr->sh_size) / xewtoh(symtabshdr->sh_entsize); nsyms = xewtoh(symtabshdr->sh_size) / xewtoh(symtabshdr->sh_entsize);
nlocalsyms = xe32toh(symtabshdr->sh_info); nlocalsyms = xe32toh(symtabshdr->sh_info);
if ((symfwmap = xmalloc(nsyms * sizeof (Elf_Word), fn, if ((symfwmap = xmalloc(nsyms * sizeof (Elf_Size), fn,
"symbol forward mapping table")) == NULL) "symbol forward mapping table")) == NULL)
goto bad; goto bad;
if ((symrvmap = xmalloc(nsyms * sizeof (Elf_Word), fn, if ((symrvmap = xmalloc(nsyms * sizeof (Elf_Size), fn,
"symbol reverse mapping table")) == NULL) "symbol reverse mapping table")) == NULL)
goto bad; goto bad;
@ -309,7 +309,7 @@ ELFNAMEEND(hide)(int fd, const char *fn)
/* move symbols, making them local */ /* move symbols, making them local */
for (ewi = nlocalsyms; ewi < nsyms; ewi++) { for (ewi = nlocalsyms; ewi < nsyms; ewi++) {
Elf_Sym *sp, symswap; Elf_Sym *sp, symswap;
Elf_Word mapswap; Elf_Size mapswap;
sp = &symtabp[ewi]; sp = &symtabp[ewi];

View File

@ -92,7 +92,7 @@ static int ef_seg_read_entry(elf_file_t ef, Elf_Off offset, size_t len,
void **ptr); void **ptr);
static int ef_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len, static int ef_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len,
void **ptr); void **ptr);
static Elf_Addr ef_symaddr(elf_file_t ef, Elf_Word symidx); static Elf_Addr ef_symaddr(elf_file_t ef, Elf_Size symidx);
static int ef_lookup_set(elf_file_t ef, const char *name, long *startp, static int ef_lookup_set(elf_file_t ef, const char *name, long *startp,
long *stopp, long *countp); long *stopp, long *countp);
static int ef_lookup_symbol(elf_file_t ef, const char* name, Elf_Sym** sym); static int ef_lookup_symbol(elf_file_t ef, const char* name, Elf_Sym** sym);
@ -246,7 +246,7 @@ ef_lookup_set(elf_file_t ef, const char *name, long *startp, long *stopp,
} }
static Elf_Addr static Elf_Addr
ef_symaddr(elf_file_t ef, Elf_Word symidx) ef_symaddr(elf_file_t ef, Elf_Size symidx)
{ {
const Elf_Sym *sym; const Elf_Sym *sym;

View File

@ -48,7 +48,7 @@ struct elf_file_ops {
void**ptr); void**ptr);
int (*seg_read_entry_rel)(elf_file_t ef, Elf_Off offset, size_t len, int (*seg_read_entry_rel)(elf_file_t ef, Elf_Off offset, size_t len,
void**ptr); void**ptr);
Elf_Addr (*symaddr)(elf_file_t ef, Elf_Word symidx); Elf_Addr (*symaddr)(elf_file_t ef, Elf_Size symidx);
int (*lookup_set)(elf_file_t ef, const char *name, long *startp, int (*lookup_set)(elf_file_t ef, const char *name, long *startp,
long *stopp, long *countp); long *stopp, long *countp);
int (*lookup_symbol)(elf_file_t ef, const char* name, Elf_Sym** sym); int (*lookup_symbol)(elf_file_t ef, const char* name, Elf_Sym** sym);

View File

@ -48,7 +48,7 @@ ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase,
Elf64_Addr *where, val; Elf64_Addr *where, val;
Elf32_Addr *where32, val32; Elf32_Addr *where32, val32;
Elf_Addr addend, addr; Elf_Addr addend, addr;
Elf_Word rtype, symidx; Elf_Size rtype, symidx;
const Elf_Rel *rel; const Elf_Rel *rel;
const Elf_Rela *rela; const Elf_Rela *rela;

View File

@ -46,7 +46,7 @@ ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase,
Elf_Off dataoff, size_t len, void *dest) Elf_Off dataoff, size_t len, void *dest)
{ {
Elf_Addr *where, addr, addend; Elf_Addr *where, addr, addend;
Elf_Word rtype, symidx; Elf_Size rtype, symidx;
const Elf_Rel *rel; const Elf_Rel *rel;
const Elf_Rela *rela; const Elf_Rela *rela;

View File

@ -113,7 +113,7 @@ static int ef_obj_seg_read_entry(elf_file_t ef, Elf_Off offset, size_t len,
void **ptr); void **ptr);
static int ef_obj_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len, static int ef_obj_seg_read_entry_rel(elf_file_t ef, Elf_Off offset, size_t len,
void **ptr); void **ptr);
static Elf_Addr ef_obj_symaddr(elf_file_t ef, Elf_Word symidx); static Elf_Addr ef_obj_symaddr(elf_file_t ef, Elf_Size symidx);
static int ef_obj_lookup_set(elf_file_t ef, const char *name, long *startp, static int ef_obj_lookup_set(elf_file_t ef, const char *name, long *startp,
long *stopp, long *countp); long *stopp, long *countp);
static int ef_obj_lookup_symbol(elf_file_t ef, const char* name, Elf_Sym** sym); static int ef_obj_lookup_symbol(elf_file_t ef, const char* name, Elf_Sym** sym);
@ -176,7 +176,7 @@ ef_obj_lookup_set(elf_file_t ef, const char *name, long *startp, long *stopp,
} }
static Elf_Addr static Elf_Addr
ef_obj_symaddr(elf_file_t ef, Elf_Word symidx) ef_obj_symaddr(elf_file_t ef, Elf_Size symidx)
{ {
const Elf_Sym *sym; const Elf_Sym *sym;

View File

@ -48,7 +48,7 @@ ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase,
Elf_Off dataoff, size_t len, void *dest) Elf_Off dataoff, size_t len, void *dest)
{ {
Elf_Addr *where, addend; Elf_Addr *where, addend;
Elf_Word rtype, symidx; Elf_Size rtype, symidx;
const Elf_Rela *rela; const Elf_Rela *rela;
if (reltype != EF_RELOC_RELA) if (reltype != EF_RELOC_RELA)

View File

@ -44,7 +44,7 @@ ef_reloc(struct elf_file *ef, const void *reldata, int reltype, Elf_Off relbase,
Elf_Off dataoff, size_t len, void *dest) Elf_Off dataoff, size_t len, void *dest)
{ {
const Elf_Rela *a; const Elf_Rela *a;
Elf_Word w; Elf_Size w;
switch (reltype) { switch (reltype) {
case EF_RELOC_RELA: case EF_RELOC_RELA: