/contrib/media/updf/include/libelf/byteswap.h |
---|
0,0 → 1,75 |
/* |
byteswap.h - C preprocessor macros for byte swapping. |
Copyright (C) 1995, 1996 Michael Riepe <michael@stud.uni-hannover.de> |
This library is free software; you can redistribute it and/or |
modify it under the terms of the GNU Library General Public |
License as published by the Free Software Foundation; either |
version 2 of the License, or (at your option) any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
Library General Public License for more details. |
You should have received a copy of the GNU Library General Public |
License along with this library; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
*/ |
/* @(#) $Id: byteswap.h,v 1.2 1996/10/22 16:45:54 michael Exp $ */ |
#ifndef _BYTESWAP_H |
#define _BYTESWAP_H |
#define lu(from,i,s) (((long)((unsigned char*)(from))[i])<<(s)) |
#define li(from,i,s) (((long)((signed char*)(from))[i])<<(s)) |
#define __load_u16L(from) ((unsigned long)(lu(from,1,8)|lu(from,0,0))) |
#define __load_u16M(from) ((unsigned long)(lu(from,0,8)|lu(from,1,0))) |
#define __load_i16L(from) ((long)(li(from,1,8)|lu(from,0,0))) |
#define __load_i16M(from) ((long)(li(from,0,8)|lu(from,1,0))) |
#define __load_u32L(from) ((unsigned long)(lu(from,3,24)| \ |
lu(from,2,16)| \ |
lu(from,1,8)| \ |
lu(from,0,0))) |
#define __load_u32M(from) ((unsigned long)(lu(from,0,24)| \ |
lu(from,1,16)| \ |
lu(from,2,8)| \ |
lu(from,3,0))) |
#define __load_i32L(from) ((long)(li(from,3,24)| \ |
lu(from,2,16)| \ |
lu(from,1,8)| \ |
lu(from,0,0))) |
#define __load_i32M(from) ((long)(li(from,0,24)| \ |
lu(from,1,16)| \ |
lu(from,2,8)| \ |
lu(from,3,0))) |
#define su(to,i,v,s) (((char*)(to))[i]=((unsigned long)(v)>>(s))) |
#define si(to,i,v,s) (((char*)(to))[i]=((long)(v)>>(s))) |
#define __store_u16L(to,v) (su(to,1,v,8),su(to,0,v,0)) |
#define __store_u16M(to,v) (su(to,0,v,8),su(to,1,v,0)) |
#define __store_i16L(to,v) (si(to,1,v,8),si(to,0,v,0)) |
#define __store_i16M(to,v) (si(to,0,v,8),si(to,1,v,0)) |
#define __store_u32L(to,v) (su(to,3,v,24), \ |
su(to,2,v,16), \ |
su(to,1,v,8), \ |
su(to,0,v,0)) |
#define __store_u32M(to,v) (su(to,0,v,24), \ |
su(to,1,v,16), \ |
su(to,2,v,8), \ |
su(to,3,v,0)) |
#define __store_i32L(to,v) (si(to,3,v,24), \ |
si(to,2,v,16), \ |
si(to,1,v,8), \ |
si(to,0,v,0)) |
#define __store_i32M(to,v) (si(to,0,v,24), \ |
si(to,1,v,16), \ |
si(to,2,v,8), \ |
si(to,3,v,0)) |
#endif /* _BYTESWAP_H */ |
/contrib/media/updf/include/libelf/config.h |
---|
0,0 → 1,107 |
/* config.h. Generated automatically by configure. */ |
/* config.h.in. Generated automatically from configure.in by autoheader. */ |
/* Define to empty if the keyword does not work. */ |
/* #undef const */ |
/* Define if you have a working `mmap' system call. */ |
/* #define HAVE_MMAP 1 */ |
/* Define to `long' if <sys/types.h> doesn't define. */ |
/* #undef off_t */ |
/* Define to `unsigned' if <sys/types.h> doesn't define. */ |
/* #undef size_t */ |
/* Define if you have the ANSI C header files. */ |
#define STDC_HEADERS 1 |
/* Define if you want to include extra debugging code */ |
/* #undef ENABLE_DEBUG */ |
/* Define if memmove() does not copy overlapping arrays correctly */ |
/* #undef HAVE_BROKEN_MEMMOVE */ |
/* Define if you have the catgets function. */ |
/* #undef HAVE_CATGETS */ |
/* Define if you have the gettext function. */ |
/* #define HAVE_GETTEXT 1 */ |
/* Define if you have the memset function. */ |
#define HAVE_MEMSET 1 |
/* Define if struct nlist is declared in <elf.h> or <sys/elf.h> */ |
/* #undef HAVE_STRUCT_NLIST_DECLARATION */ |
/* Define if Elf32_Dyn is declared in <link.h> */ |
/* #undef NEED_LINK_H */ |
/* Define to `<elf.h>' or `<sys/elf.h>' if one of them is present */ |
#define __LIBELF_HEADER_ELF_H <elf.h> |
/* Define if you want 64-bit support (and your system supports it) */ |
#define __LIBELF64 1 |
/* Define if you want 64-bit support, and are running IRIX */ |
/* #undef __LIBELF64_IRIX */ |
/* Define if you want 64-bit support, and are running Linux */ |
/* #undef __LIBELF64_LINUX */ |
/* Define to a 64-bit signed integer type if one exists */ |
#define __libelf_i64_t long long |
/* Define to a 64-bit unsigned integer type if one exists */ |
#define __libelf_u64_t unsigned long long |
/* Define to a 32-bit signed integer type if one exists */ |
#define __libelf_i32_t long |
/* Define to a 32-bit unsigned integer type if one exists */ |
#define __libelf_u32_t unsigned long |
/* Define to a 16-bit signed integer type if one exists */ |
#define __libelf_i16_t short |
/* Define to a 16-bit unsigned integer type if one exists */ |
#define __libelf_u16_t unsigned short |
/* The number of bytes in a int. */ |
#define SIZEOF_INT 4 |
/* The number of bytes in a long. */ |
#define SIZEOF_LONG 4 |
/* The number of bytes in a long long. */ |
#define SIZEOF_LONG_LONG 8 |
/* The number of bytes in a short. */ |
#define SIZEOF_SHORT 2 |
/* Define if you have the ftruncate function. */ |
/* #define HAVE_FTRUNCATE 1 */ |
/* Define if you have the getpagesize function. */ |
#define HAVE_GETPAGESIZE 1 |
/* Define if you have the memcmp function. */ |
#define HAVE_MEMCMP 1 |
/* Define if you have the memcpy function. */ |
#define HAVE_MEMCPY 1 |
/* Define if you have the memmove function. */ |
#define HAVE_MEMMOVE 1 |
/* Define if you have the memset function. */ |
#define HAVE_MEMSET 1 |
/* Define if you have the <elf.h> header file. */ |
#define HAVE_ELF_H 1 |
/* Define if you have the <sys/elf.h> header file. */ |
#define HAVE_SYS_ELF_H 1 |
/* Define if you have the <unistd.h> header file. */ |
#define HAVE_UNISTD_H 1 |
/contrib/media/updf/include/libelf/elf_repl.h |
---|
0,0 → 1,460 |
/* |
elf_repl.h - public header file for systems that lack it. |
Copyright (C) 1995 - 1998 Michael Riepe <michael@stud.uni-hannover.de> |
This library is free software; you can redistribute it and/or |
modify it under the terms of the GNU Library General Public |
License as published by the Free Software Foundation; either |
version 2 of the License, or (at your option) any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
Library General Public License for more details. |
You should have received a copy of the GNU Library General Public |
License along with this library; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
*/ |
/* @(#) $Id: elf_repl.h,v 1.4 1998/06/04 17:14:01 michael Exp $ */ |
/* |
* NEVER INCLUDE THIS FILE DIRECTLY - USE <libelf.h> INSTEAD! |
*/ |
#ifndef _ELF_REPL_H |
#define _ELF_REPL_H |
#ifdef __cplusplus |
extern "C" { |
#endif /* __cplusplus */ |
/* |
* Scalar data types |
*/ |
typedef __libelf_u32_t Elf32_Addr; |
typedef __libelf_u16_t Elf32_Half; |
typedef __libelf_u32_t Elf32_Off; |
typedef __libelf_i32_t Elf32_Sword; |
typedef __libelf_u32_t Elf32_Word; |
#define ELF32_FSZ_ADDR 4 |
#define ELF32_FSZ_HALF 2 |
#define ELF32_FSZ_OFF 4 |
#define ELF32_FSZ_SWORD 4 |
#define ELF32_FSZ_WORD 4 |
#if __LIBELF64 |
typedef __libelf_u64_t Elf64_Addr; |
typedef __libelf_u16_t Elf64_Half; |
typedef __libelf_u64_t Elf64_Off; |
typedef __libelf_i32_t Elf64_Sword; |
typedef __libelf_i64_t Elf64_Sxword; |
typedef __libelf_u32_t Elf64_Word; |
typedef __libelf_u64_t Elf64_Xword; |
#define ELF64_FSZ_ADDR 8 |
#define ELF64_FSZ_HALF 2 |
#define ELF64_FSZ_OFF 8 |
#define ELF64_FSZ_SWORD 4 |
#define ELF64_FSZ_SXWORD 8 |
#define ELF64_FSZ_WORD 4 |
#define ELF64_FSZ_XWORD 8 |
#endif /* __LIBELF64 */ |
/* |
* ELF header |
*/ |
#define EI_NIDENT 16 |
typedef struct { |
unsigned char e_ident[EI_NIDENT]; |
Elf32_Half e_type; |
Elf32_Half e_machine; |
Elf32_Word e_version; |
Elf32_Addr e_entry; |
Elf32_Off e_phoff; |
Elf32_Off e_shoff; |
Elf32_Word e_flags; |
Elf32_Half e_ehsize; |
Elf32_Half e_phentsize; |
Elf32_Half e_phnum; |
Elf32_Half e_shentsize; |
Elf32_Half e_shnum; |
Elf32_Half e_shstrndx; |
} Elf32_Ehdr; |
#if __LIBELF64 |
typedef struct { |
unsigned char e_ident[EI_NIDENT]; |
Elf64_Half e_type; |
Elf64_Half e_machine; |
Elf64_Word e_version; |
Elf64_Addr e_entry; |
Elf64_Off e_phoff; |
Elf64_Off e_shoff; |
Elf64_Word e_flags; |
Elf64_Half e_ehsize; |
Elf64_Half e_phentsize; |
Elf64_Half e_phnum; |
Elf64_Half e_shentsize; |
Elf64_Half e_shnum; |
Elf64_Half e_shstrndx; |
} Elf64_Ehdr; |
#endif /* __LIBELF64 */ |
/* |
* e-ident |
*/ |
#define EI_MAG0 0 |
#define EI_MAG1 1 |
#define EI_MAG2 2 |
#define EI_MAG3 3 |
#define EI_CLASS 4 |
#define EI_DATA 5 |
#define EI_VERSION 6 |
#define EI_PAD 7 |
#define ELFMAG0 0x7f |
#define ELFMAG1 'E' |
#define ELFMAG2 'L' |
#define ELFMAG3 'F' |
#define ELFMAG "\177ELF" |
#define SELFMAG 4 |
#define ELFCLASSNONE 0 |
#define ELFCLASS32 1 |
#define ELFCLASS64 2 |
#define ELFCLASSNUM 3 |
#define ELFDATANONE 0 |
#define ELFDATA2LSB 1 |
#define ELFDATA2MSB 2 |
#define ELFDATANUM 3 |
/* |
* e_type |
*/ |
#define ET_NONE 0 |
#define ET_REL 1 |
#define ET_EXEC 2 |
#define ET_DYN 3 |
#define ET_CORE 4 |
#define ET_NUM 5 |
#define ET_LOPROC 0xff00 |
#define ET_HIPROC 0xffff |
/* |
* e_machine |
*/ |
#define EM_NONE 0 |
#define EM_M32 1 /* AT&T WE 32100 */ |
#define EM_SPARC 2 /* SPARC */ |
#define EM_386 3 /* Intel i386 */ |
#define EM_68K 4 /* Motorola 68000 */ |
#define EM_88K 5 /* Motorola 88000 */ |
#define EM_486 6 /* Intel i486 (do not use this one) */ |
#define EM_860 7 /* Intel i860 */ |
#define EM_MIPS 8 /* MIPS R3000 */ |
#define EM_NUM 9 |
/* |
* e_ident[EI_VERSION], e_version |
*/ |
#define EV_NONE 0 |
#define EV_CURRENT 1 |
#define EV_NUM 2 |
/* |
* Section header |
*/ |
typedef struct { |
Elf32_Word sh_name; |
Elf32_Word sh_type; |
Elf32_Word sh_flags; |
Elf32_Addr sh_addr; |
Elf32_Off sh_offset; |
Elf32_Word sh_size; |
Elf32_Word sh_link; |
Elf32_Word sh_info; |
Elf32_Word sh_addralign; |
Elf32_Word sh_entsize; |
} Elf32_Shdr; |
#if __LIBELF64 |
typedef struct { |
Elf64_Word sh_name; |
Elf64_Word sh_type; |
Elf64_Xword sh_flags; |
Elf64_Addr sh_addr; |
Elf64_Off sh_offset; |
Elf64_Xword sh_size; |
Elf64_Word sh_link; |
Elf64_Word sh_info; |
Elf64_Xword sh_addralign; |
Elf64_Xword sh_entsize; |
} Elf64_Shdr; |
#endif /* __LIBELF64 */ |
/* |
* Special section indices |
*/ |
#define SHN_UNDEF 0 |
#define SHN_LORESERVE 0xff00 |
#define SHN_LOPROC 0xff00 |
#define SHN_HIPROC 0xff1f |
#define SHN_ABS 0xfff1 |
#define SHN_COMMON 0xfff2 |
#define SHN_HIRESERVE 0xffff |
/* |
* sh_type |
*/ |
#define SHT_NULL 0 |
#define SHT_PROGBITS 1 |
#define SHT_SYMTAB 2 |
#define SHT_STRTAB 3 |
#define SHT_RELA 4 |
#define SHT_HASH 5 |
#define SHT_DYNAMIC 6 |
#define SHT_NOTE 7 |
#define SHT_NOBITS 8 |
#define SHT_REL 9 |
#define SHT_SHLIB 10 |
#define SHT_DYNSYM 11 |
#define SHT_NUM 12 |
#define SHT_LOPROC 0x70000000 |
#define SHT_HIPROC 0x7fffffff |
#define SHT_LOUSER 0x80000000 |
#define SHT_HIUSER 0xffffffff |
/* |
* sh_flags |
*/ |
#define SHF_WRITE 0x1 |
#define SHF_ALLOC 0x2 |
#define SHF_EXECINSTR 0x4 |
#define SHF_MASKPROC 0xf0000000 |
/* |
* Symbol table |
*/ |
typedef struct { |
Elf32_Word st_name; |
Elf32_Addr st_value; |
Elf32_Word st_size; |
unsigned char st_info; |
unsigned char st_other; |
Elf32_Half st_shndx; |
} Elf32_Sym; |
#if __LIBELF64 |
typedef struct { |
Elf64_Word st_name; |
unsigned char st_info; |
unsigned char st_other; |
Elf64_Half st_shndx; |
Elf64_Addr st_value; |
Elf64_Xword st_size; |
} Elf64_Sym; |
#endif /* __LIBELF64 */ |
/* |
* Special symbol indices |
*/ |
#define STN_UNDEF 0 |
/* |
* Macros for manipulating st_info |
*/ |
#define ELF32_ST_BIND(i) ((i)>>4) |
#define ELF32_ST_TYPE(i) ((i)&0xf) |
#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf)) |
/* |
* Symbol binding |
*/ |
#define STB_LOCAL 0 |
#define STB_GLOBAL 1 |
#define STB_WEAK 2 |
#define STB_NUM 3 |
#define STB_LOPROC 13 |
#define STB_HIPROC 15 |
/* |
* Symbol types |
*/ |
#define STT_NOTYPE 0 |
#define STT_OBJECT 1 |
#define STT_FUNC 2 |
#define STT_SECTION 3 |
#define STT_FILE 4 |
#define STT_NUM 5 |
#define STT_LOPROC 13 |
#define STT_HIPROC 15 |
/* |
* Relocation |
*/ |
typedef struct { |
Elf32_Addr r_offset; |
Elf32_Word r_info; |
} Elf32_Rel; |
typedef struct { |
Elf32_Addr r_offset; |
Elf32_Word r_info; |
Elf32_Sword r_addend; |
} Elf32_Rela; |
#if __LIBELF64 |
typedef struct { |
Elf64_Addr r_offset; |
Elf64_Xword r_info; |
} Elf64_Rel; |
typedef struct { |
Elf64_Addr r_offset; |
Elf64_Xword r_info; |
Elf64_Sxword r_addend; |
} Elf64_Rela; |
#endif /* __LIBELF64 */ |
/* |
* Macros for manipulating r_info |
*/ |
#define ELF32_R_SYM(i) ((i)>>8) |
#define ELF32_R_TYPE(i) ((unsigned char)(i)) |
#define ELF32_R_INFO(s,t) (((s)<<8)+(unsigned char)(t)) |
/* |
* Note entry header |
*/ |
typedef struct { |
Elf32_Word n_namesz; /* name size */ |
Elf32_Word n_descsz; /* descriptor size */ |
Elf32_Word n_type; /* descriptor type */ |
} Elf32_Nhdr; |
#if __LIBELF64 && 0 /* I don't know if this is correct */ |
typedef struct { |
Elf64_Word n_namesz; /* name size */ |
Elf64_Word n_descsz; /* descriptor size */ |
Elf64_Word n_type; /* descriptor type */ |
} Elf64_Nhdr; |
#endif /* __LIBELF64 */ |
/* |
* Well-known descriptor types for ET_CORE files |
*/ |
#define NT_PRSTATUS 1 |
#define NT_PRFPREG 2 |
#define NT_PRPSINFO 3 |
/* |
* Program header |
*/ |
typedef struct { |
Elf32_Word p_type; |
Elf32_Off p_offset; |
Elf32_Addr p_vaddr; |
Elf32_Addr p_paddr; |
Elf32_Word p_filesz; |
Elf32_Word p_memsz; |
Elf32_Word p_flags; |
Elf32_Word p_align; |
} Elf32_Phdr; |
#if __LIBELF64 |
typedef struct { |
Elf64_Word p_type; |
Elf64_Word p_flags; |
Elf64_Off p_offset; |
Elf64_Addr p_vaddr; |
Elf64_Addr p_paddr; |
Elf64_Xword p_filesz; |
Elf64_Xword p_memsz; |
Elf64_Xword p_align; |
} Elf64_Phdr; |
#endif /* __LIBELF64 */ |
/* |
* p_type |
*/ |
#define PT_NULL 0 |
#define PT_LOAD 1 |
#define PT_DYNAMIC 2 |
#define PT_INTERP 3 |
#define PT_NOTE 4 |
#define PT_SHLIB 5 |
#define PT_PHDR 6 |
#define PT_NUM 7 |
#define PT_LOPROC 0x70000000 |
#define PT_HIPROC 0x7fffffff |
/* |
* p_flags |
*/ |
#define PF_R 0x4 |
#define PF_W 0x2 |
#define PF_X 0x1 |
#define PF_MASKPROC 0xf0000000 |
/* |
* Dynamic structure |
*/ |
typedef struct { |
Elf32_Sword d_tag; |
union { |
Elf32_Word d_val; |
Elf32_Addr d_ptr; |
} d_un; |
} Elf32_Dyn; |
#if __LIBELF64 |
typedef struct { |
Elf64_Sxword d_tag; |
union { |
Elf64_Xword d_val; |
Elf64_Addr d_ptr; |
} d_un; |
} Elf64_Dyn; |
#endif /* __LIBELF64 */ |
/* |
* Dynamic array tags |
*/ |
#define DT_NULL 0 |
#define DT_NEEDED 1 |
#define DT_PLTRELSZ 2 |
#define DT_PLTGOT 3 |
#define DT_HASH 4 |
#define DT_STRTAB 5 |
#define DT_SYMTAB 6 |
#define DT_RELA 7 |
#define DT_RELASZ 8 |
#define DT_RELAENT 9 |
#define DT_STRSZ 10 |
#define DT_SYMENT 11 |
#define DT_INIT 12 |
#define DT_FINI 13 |
#define DT_SONAME 14 |
#define DT_RPATH 15 |
#define DT_SYMBOLIC 16 |
#define DT_REL 17 |
#define DT_RELSZ 18 |
#define DT_RELENT 19 |
#define DT_PLTREL 20 |
#define DT_DEBUG 21 |
#define DT_TEXTREL 22 |
#define DT_JMPREL 23 |
#define DT_NUM 24 |
#define DT_LOPROC 0x70000000 |
#define DT_HIPROC 0x7fffffff |
#ifdef __cplusplus |
} |
#endif /* __cplusplus */ |
#endif /* _ELF_REPL_H */ |
/contrib/media/updf/include/libelf/errors.h |
---|
0,0 → 1,83 |
/* |
errors.h - exhaustive list of all error codes and messages for libelf. |
Copyright (C) 1995 - 1998 Michael Riepe <michael@stud.uni-hannover.de> |
This library is free software; you can redistribute it and/or |
modify it under the terms of the GNU Library General Public |
License as published by the Free Software Foundation; either |
version 2 of the License, or (at your option) any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
Library General Public License for more details. |
You should have received a copy of the GNU Library General Public |
License along with this library; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
*/ |
/* @(#) $Id: errors.h,v 1.4 1998/06/08 14:50:30 michael Exp $ */ |
/* dummy for xgettext */ |
#define _(str) str |
__err__(ERROR_OK, _("no error")) |
__err__(ERROR_UNKNOWN, _("unknown error")) |
__err__(ERROR_INTERNAL, _("Internal error: unknown reason")) |
__err__(ERROR_UNIMPLEMENTED, _("Internal error: not implemented")) |
__err__(ERROR_WRONLY, _("Request error: cntl(ELF_C_FDREAD) on write-only file")) |
__err__(ERROR_INVALID_CMD, _("Request error: invalid ELF_C_* argument")) |
__err__(ERROR_FDDISABLED, _("Request error: file descriptor disabled")) |
__err__(ERROR_NOTARCHIVE, _("Request error: not an archive")) |
__err__(ERROR_BADOFF, _("Request error: offset out of range")) |
__err__(ERROR_UNKNOWN_VERSION, _("Request error: unknown ELF version")) |
__err__(ERROR_CMDMISMATCH, _("Request error: ELF_C_* argument does not match")) |
__err__(ERROR_MEMBERWRITE, _("Request error: archive member begin() for writing")) |
__err__(ERROR_FDMISMATCH, _("Request error: archive/member file descriptor mismatch")) |
__err__(ERROR_NOTELF, _("Request error: not an ELF file")) |
__err__(ERROR_CLASSMISMATCH, _("Request error: class file/memory mismatch")) |
__err__(ERROR_UNKNOWN_TYPE, _("Request error: invalid ELF_T_* argument")) |
__err__(ERROR_UNKNOWN_ENCODING, _("Request error: unknown data encoding")) |
__err__(ERROR_DST2SMALL, _("Request error: destination buffer too small")) |
__err__(ERROR_NULLBUF, _("Request error: d_buf is NULL")) |
__err__(ERROR_UNKNOWN_CLASS, _("Request error: unknown ELF class")) |
__err__(ERROR_ELFSCNMISMATCH, _("Request error: section does not belong to file")) |
__err__(ERROR_NOSUCHSCN, _("Request error: no section at index")) |
__err__(ERROR_NULLSCN, _("Request error: can't manipulate null section")) |
__err__(ERROR_SCNDATAMISMATCH, _("Request error: data does not belong to section")) |
__err__(ERROR_NOSTRTAB, _("Request error: no string table")) |
__err__(ERROR_BADSTROFF, _("Request error: string table offset out of range")) |
__err__(ERROR_RDONLY, _("Request error: update(ELF_C_WRITE) on read-only file")) |
__err__(ERROR_IO_SEEK, _("I/O error: seek")) |
__err__(ERROR_IO_2BIG, _("I/O error: file too big for memory")) |
__err__(ERROR_IO_READ, _("I/O error: raw read")) |
__err__(ERROR_IO_GETSIZE, _("I/O error: get file size")) |
__err__(ERROR_IO_WRITE, _("I/O error: output write")) |
__err__(ERROR_IO_TRUNC, _("I/O error: can't truncate output file")) |
__err__(ERROR_VERSION_UNSET, _("Sequence error: must set ELF version first")) |
__err__(ERROR_NOEHDR, _("Sequence error: must create ELF header first")) |
__err__(ERROR_OUTSIDE, _("Format error: reference outside file")) |
__err__(ERROR_TRUNC_ARHDR, _("Format error: archive header truncated")) |
__err__(ERROR_ARFMAG, _("Format error: archive fmag")) |
__err__(ERROR_ARHDR, _("Format error: archive header")) |
__err__(ERROR_TRUNC_MEMBER, _("Format error: archive member truncated")) |
__err__(ERROR_SIZE_ARSYMTAB, _("Format error: archive symbol table size")) |
__err__(ERROR_ARSTRTAB, _("Format error: archive string table")) |
__err__(ERROR_ARSPECIAL, _("Format error: archive special name unknown")) |
__err__(ERROR_TRUNC_EHDR, _("Format error: ELF header truncated")) |
__err__(ERROR_TRUNC_PHDR, _("Format error: program header table truncated")) |
__err__(ERROR_TRUNC_SHDR, _("Format error: section header table truncated")) |
__err__(ERROR_TRUNC_SCN, _("Format error: data region truncated")) |
__err__(ERROR_SCN2SMALL, _("Format error: section size too small for data")) |
__err__(ERROR_ALIGN_PHDR, _("Format error: program header table alignment")) |
__err__(ERROR_ALIGN_SHDR, _("Format error: section header table alignment")) |
__err__(ERROR_MEM_ELF, _("Memory error: elf descriptor")) |
__err__(ERROR_MEM_ARSYMTAB, _("Memory error: archive symbol table")) |
__err__(ERROR_MEM_ARHDR, _("Memory error: archive member header")) |
__err__(ERROR_MEM_EHDR, _("Memory error: ELF header")) |
__err__(ERROR_MEM_PHDR, _("Memory error: program header table")) |
__err__(ERROR_MEM_SHDR, _("Memory error: section header table")) |
__err__(ERROR_MEM_SCN, _("Memory error: section descriptor")) |
__err__(ERROR_MEM_SCNDATA, _("Memory error: section data")) |
__err__(ERROR_MEM_OUTBUF, _("Memory error: output file space")) |
/contrib/media/updf/include/libelf/ext_types.h |
---|
0,0 → 1,236 |
/* |
ext_types.h - external representation of ELF data types. |
Copyright (C) 1995 - 1998 Michael Riepe <michael@stud.uni-hannover.de> |
This library is free software; you can redistribute it and/or |
modify it under the terms of the GNU Library General Public |
License as published by the Free Software Foundation; either |
version 2 of the License, or (at your option) any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
Library General Public License for more details. |
You should have received a copy of the GNU Library General Public |
License along with this library; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
*/ |
/* @(#) $Id: ext_types.h,v 1.3 1998/06/01 19:47:15 michael Exp $ */ |
#ifndef _EXT_TYPES_H |
#define _EXT_TYPES_H |
#ifdef __cplusplus |
extern "C" { |
#endif /* __cplusplus */ |
/* |
* Scalar data types |
*/ |
typedef unsigned char __ext_Elf32_Addr [ELF32_FSZ_ADDR]; |
typedef unsigned char __ext_Elf32_Half [ELF32_FSZ_HALF]; |
typedef unsigned char __ext_Elf32_Off [ELF32_FSZ_OFF]; |
typedef unsigned char __ext_Elf32_Sword [ELF32_FSZ_SWORD]; |
typedef unsigned char __ext_Elf32_Word [ELF32_FSZ_WORD]; |
#if __LIBELF64 |
typedef unsigned char __ext_Elf64_Addr [ELF64_FSZ_ADDR]; |
typedef unsigned char __ext_Elf64_Half [ELF64_FSZ_HALF]; |
typedef unsigned char __ext_Elf64_Off [ELF64_FSZ_OFF]; |
typedef unsigned char __ext_Elf64_Sword [ELF64_FSZ_SWORD]; |
typedef unsigned char __ext_Elf64_Sxword[ELF64_FSZ_SXWORD]; |
typedef unsigned char __ext_Elf64_Word [ELF64_FSZ_WORD]; |
typedef unsigned char __ext_Elf64_Xword [ELF64_FSZ_XWORD]; |
#endif /* __LIBELF64 */ |
/* |
* ELF header |
*/ |
typedef struct { |
unsigned char e_ident[EI_NIDENT]; |
__ext_Elf32_Half e_type; |
__ext_Elf32_Half e_machine; |
__ext_Elf32_Word e_version; |
__ext_Elf32_Addr e_entry; |
__ext_Elf32_Off e_phoff; |
__ext_Elf32_Off e_shoff; |
__ext_Elf32_Word e_flags; |
__ext_Elf32_Half e_ehsize; |
__ext_Elf32_Half e_phentsize; |
__ext_Elf32_Half e_phnum; |
__ext_Elf32_Half e_shentsize; |
__ext_Elf32_Half e_shnum; |
__ext_Elf32_Half e_shstrndx; |
} __ext_Elf32_Ehdr; |
#if __LIBELF64 |
typedef struct { |
unsigned char e_ident[EI_NIDENT]; |
__ext_Elf64_Half e_type; |
__ext_Elf64_Half e_machine; |
__ext_Elf64_Word e_version; |
__ext_Elf64_Addr e_entry; |
__ext_Elf64_Off e_phoff; |
__ext_Elf64_Off e_shoff; |
__ext_Elf64_Word e_flags; |
__ext_Elf64_Half e_ehsize; |
__ext_Elf64_Half e_phentsize; |
__ext_Elf64_Half e_phnum; |
__ext_Elf64_Half e_shentsize; |
__ext_Elf64_Half e_shnum; |
__ext_Elf64_Half e_shstrndx; |
} __ext_Elf64_Ehdr; |
#endif /* __LIBELF64 */ |
/* |
* Section header |
*/ |
typedef struct { |
__ext_Elf32_Word sh_name; |
__ext_Elf32_Word sh_type; |
__ext_Elf32_Word sh_flags; |
__ext_Elf32_Addr sh_addr; |
__ext_Elf32_Off sh_offset; |
__ext_Elf32_Word sh_size; |
__ext_Elf32_Word sh_link; |
__ext_Elf32_Word sh_info; |
__ext_Elf32_Word sh_addralign; |
__ext_Elf32_Word sh_entsize; |
} __ext_Elf32_Shdr; |
#if __LIBELF64 |
typedef struct { |
__ext_Elf64_Word sh_name; |
__ext_Elf64_Word sh_type; |
__ext_Elf64_Xword sh_flags; |
__ext_Elf64_Addr sh_addr; |
__ext_Elf64_Off sh_offset; |
__ext_Elf64_Xword sh_size; |
__ext_Elf64_Word sh_link; |
__ext_Elf64_Word sh_info; |
__ext_Elf64_Xword sh_addralign; |
__ext_Elf64_Xword sh_entsize; |
} __ext_Elf64_Shdr; |
#endif /* __LIBELF64 */ |
/* |
* Symbol table |
*/ |
typedef struct { |
__ext_Elf32_Word st_name; |
__ext_Elf32_Addr st_value; |
__ext_Elf32_Word st_size; |
unsigned char st_info; |
unsigned char st_other; |
__ext_Elf32_Half st_shndx; |
} __ext_Elf32_Sym; |
#if __LIBELF64 |
typedef struct { |
__ext_Elf64_Word st_name; |
unsigned char st_info; |
unsigned char st_other; |
__ext_Elf64_Half st_shndx; |
__ext_Elf64_Addr st_value; |
__ext_Elf64_Xword st_size; |
} __ext_Elf64_Sym; |
#endif /* __LIBELF64 */ |
/* |
* Relocation |
*/ |
typedef struct { |
__ext_Elf32_Addr r_offset; |
__ext_Elf32_Word r_info; |
} __ext_Elf32_Rel; |
typedef struct { |
__ext_Elf32_Addr r_offset; |
__ext_Elf32_Word r_info; |
__ext_Elf32_Sword r_addend; |
} __ext_Elf32_Rela; |
#if __LIBELF64 |
typedef struct { |
__ext_Elf64_Addr r_offset; |
#if __LIBELF64_IRIX |
__ext_Elf64_Word r_sym; |
unsigned char r_ssym; |
unsigned char r_type3; |
unsigned char r_type2; |
unsigned char r_type; |
#else /* __LIBELF64_IRIX */ |
__ext_Elf64_Xword r_info; |
#endif /* __LIBELF64_IRIX */ |
} __ext_Elf64_Rel; |
typedef struct { |
__ext_Elf64_Addr r_offset; |
#if __LIBELF64_IRIX |
__ext_Elf64_Word r_sym; |
unsigned char r_ssym; |
unsigned char r_type3; |
unsigned char r_type2; |
unsigned char r_type; |
#else /* __LIBELF64_IRIX */ |
__ext_Elf64_Xword r_info; |
#endif /* __LIBELF64_IRIX */ |
__ext_Elf64_Sxword r_addend; |
} __ext_Elf64_Rela; |
#endif /* __LIBELF64 */ |
/* |
* Program header |
*/ |
typedef struct { |
__ext_Elf32_Word p_type; |
__ext_Elf32_Off p_offset; |
__ext_Elf32_Addr p_vaddr; |
__ext_Elf32_Addr p_paddr; |
__ext_Elf32_Word p_filesz; |
__ext_Elf32_Word p_memsz; |
__ext_Elf32_Word p_flags; |
__ext_Elf32_Word p_align; |
} __ext_Elf32_Phdr; |
#if __LIBELF64 |
typedef struct { |
__ext_Elf64_Word p_type; |
__ext_Elf64_Word p_flags; |
__ext_Elf64_Off p_offset; |
__ext_Elf64_Addr p_vaddr; |
__ext_Elf64_Addr p_paddr; |
__ext_Elf64_Xword p_filesz; |
__ext_Elf64_Xword p_memsz; |
__ext_Elf64_Xword p_align; |
} __ext_Elf64_Phdr; |
#endif /* __LIBELF64 */ |
/* |
* Dynamic structure |
*/ |
typedef struct { |
__ext_Elf32_Sword d_tag; |
union { |
__ext_Elf32_Word d_val; |
__ext_Elf32_Addr d_ptr; |
} d_un; |
} __ext_Elf32_Dyn; |
#if __LIBELF64 |
typedef struct { |
__ext_Elf64_Sxword d_tag; |
union { |
__ext_Elf64_Xword d_val; |
__ext_Elf64_Addr d_ptr; |
} d_un; |
} __ext_Elf64_Dyn; |
#endif /* __LIBELF64 */ |
#ifdef __cplusplus |
} |
#endif /* __cplusplus */ |
#endif /* _EXT_TYPES_H */ |
/contrib/media/updf/include/libelf/libelf.h |
---|
0,0 → 1,232 |
/* |
libelf.h - public header file for libelf. |
Copyright (C) 1995 - 1998 Michael Riepe <michael@stud.uni-hannover.de> |
This library is free software; you can redistribute it and/or |
modify it under the terms of the GNU Library General Public |
License as published by the Free Software Foundation; either |
version 2 of the License, or (at your option) any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
Library General Public License for more details. |
You should have received a copy of the GNU Library General Public |
License along with this library; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
*/ |
/* @(#) $Id: libelf.h,v 1.5 1998/06/01 19:47:18 michael Exp $ */ |
#ifndef _LIBELF_H |
#define _LIBELF_H |
#include <sys/types.h> |
#if __LIBELF_INTERNAL__ |
#include <sys_elf.h> |
#else /* __LIBELF_INTERNAL__ */ |
#include <libelf/sys_elf.h> |
#endif /* __LIBELF_INTERNAL__ */ |
#ifdef __cplusplus |
extern "C" { |
#endif /* __cplusplus */ |
#ifndef __P |
# if __STDC__ || defined(__cplusplus) |
# define __P(args) args |
# else /* __STDC__ || defined(__cplusplus) */ |
# define __P(args) () |
# endif /* __STDC__ || defined(__cplusplus) */ |
#endif /* __P */ |
/* |
* Commands |
*/ |
typedef enum { |
ELF_C_NULL = 0, /* must be first, 0 */ |
ELF_C_READ, |
ELF_C_WRITE, |
ELF_C_CLR, |
ELF_C_SET, |
ELF_C_FDDONE, |
ELF_C_FDREAD, |
ELF_C_RDWR, |
ELF_C_NUM /* must be last */ |
} Elf_Cmd; |
/* |
* Flags |
*/ |
#define ELF_F_DIRTY 0x1 |
#define ELF_F_LAYOUT 0x4 |
/* |
* File types |
*/ |
typedef enum { |
ELF_K_NONE = 0, /* must be first, 0 */ |
ELF_K_AR, |
ELF_K_COFF, |
ELF_K_ELF, |
ELF_K_NUM /* must be last */ |
} Elf_Kind; |
/* |
* Data types |
*/ |
typedef enum { |
ELF_T_BYTE = 0, /* must be first, 0 */ |
ELF_T_ADDR, |
ELF_T_DYN, |
ELF_T_EHDR, |
ELF_T_HALF, |
ELF_T_OFF, |
ELF_T_PHDR, |
ELF_T_RELA, |
ELF_T_REL, |
ELF_T_SHDR, |
ELF_T_SWORD, |
ELF_T_SYM, |
ELF_T_WORD, |
/* |
* New stuff for 64-bit. |
* |
* Most implementations add ELF_T_SXWORD after ELF_T_SWORD |
* which breaks binary compatibility with earlier versions. |
* If this causes problems for you, contact me. |
*/ |
ELF_T_SXWORD, |
ELF_T_XWORD, |
ELF_T_NUM /* must be last */ |
} Elf_Type; |
/* |
* Elf descriptor |
*/ |
typedef struct Elf Elf; |
/* |
* Section descriptor |
*/ |
typedef struct Elf_Scn Elf_Scn; |
/* |
* Archive member header |
*/ |
typedef struct { |
char* ar_name; |
time_t ar_date; |
long ar_uid; |
long ar_gid; |
unsigned long ar_mode; |
off_t ar_size; |
char* ar_rawname; |
} Elf_Arhdr; |
/* |
* Archive symbol table |
*/ |
typedef struct { |
char* as_name; |
size_t as_off; |
unsigned long as_hash; |
} Elf_Arsym; |
/* |
* Data descriptor |
*/ |
typedef struct { |
void* d_buf; |
Elf_Type d_type; |
size_t d_size; |
off_t d_off; |
size_t d_align; |
unsigned d_version; |
} Elf_Data; |
/* |
* Function declarations |
*/ |
extern Elf *elf_begin __P((int __fd, Elf_Cmd __cmd, Elf *__ref)); |
extern Elf *elf_memory __P((char *__image, size_t __size)); |
extern int elf_cntl __P((Elf *__elf, Elf_Cmd __cmd)); |
extern int elf_end __P((Elf *__elf)); |
extern const char *elf_errmsg __P((int __err)); |
extern int elf_errno __P((void)); |
extern void elf_fill __P((int __fill)); |
extern unsigned elf_flagdata __P((Elf_Data *__data, Elf_Cmd __cmd, |
unsigned __flags)); |
extern unsigned elf_flagehdr __P((Elf *__elf, Elf_Cmd __cmd, |
unsigned __flags)); |
extern unsigned elf_flagelf __P((Elf *__elf, Elf_Cmd __cmd, |
unsigned __flags)); |
extern unsigned elf_flagphdr __P((Elf *__elf, Elf_Cmd __cmd, |
unsigned __flags)); |
extern unsigned elf_flagscn __P((Elf_Scn *__scn, Elf_Cmd __cmd, |
unsigned __flags)); |
extern unsigned elf_flagshdr __P((Elf_Scn *__scn, Elf_Cmd __cmd, |
unsigned __flags)); |
extern size_t elf32_fsize __P((Elf_Type __type, size_t __count, |
unsigned __ver)); |
extern Elf_Arhdr *elf_getarhdr __P((Elf *__elf)); |
extern Elf_Arsym *elf_getarsym __P((Elf *__elf, size_t *__ptr)); |
extern off_t elf_getbase __P((Elf *__elf)); |
extern Elf_Data *elf_getdata __P((Elf_Scn *__scn, Elf_Data *__data)); |
extern Elf32_Ehdr *elf32_getehdr __P((Elf *__elf)); |
extern char *elf_getident __P((Elf *__elf, size_t *__ptr)); |
extern Elf32_Phdr *elf32_getphdr __P((Elf *__elf)); |
extern Elf_Scn *elf_getscn __P((Elf *__elf, size_t __index)); |
extern Elf32_Shdr *elf32_getshdr __P((Elf_Scn *__scn)); |
extern unsigned long elf_hash __P((const char *__name)); |
extern Elf_Kind elf_kind __P((Elf *__elf)); |
extern size_t elf_ndxscn __P((Elf_Scn *__scn)); |
extern Elf_Data *elf_newdata __P((Elf_Scn *__scn)); |
extern Elf32_Ehdr *elf32_newehdr __P((Elf *__elf)); |
extern Elf32_Phdr *elf32_newphdr __P((Elf *__elf, size_t __count)); |
extern Elf_Scn *elf_newscn __P((Elf *__elf)); |
extern Elf_Cmd elf_next __P((Elf *__elf)); |
extern Elf_Scn *elf_nextscn __P((Elf *__elf, Elf_Scn *__scn)); |
extern size_t elf_rand __P((Elf *__elf, size_t __offset)); |
extern Elf_Data *elf_rawdata __P((Elf_Scn *__scn, Elf_Data *__data)); |
extern char *elf_rawfile __P((Elf *__elf, size_t *__ptr)); |
extern char *elf_strptr __P((Elf *__elf, size_t __section, size_t __offset)); |
extern off_t elf_update __P((Elf *__elf, Elf_Cmd __cmd)); |
extern unsigned elf_version __P((unsigned __ver)); |
extern Elf_Data *elf32_xlatetof __P((Elf_Data *__dst, const Elf_Data *__src, |
unsigned __encode)); |
extern Elf_Data *elf32_xlatetom __P((Elf_Data *__dst, const Elf_Data *__src, |
unsigned __encode)); |
#if __LIBELF64 |
/* |
* 64-bit ELF functions |
* Not available on all platforms |
*/ |
extern Elf64_Ehdr *elf64_getehdr __P((Elf *__elf)); |
extern Elf64_Ehdr *elf64_newehdr __P((Elf *__elf)); |
extern Elf64_Phdr *elf64_getphdr __P((Elf *__elf)); |
extern Elf64_Phdr *elf64_newphdr __P((Elf *__elf, size_t __count)); |
extern Elf64_Shdr *elf64_getshdr __P((Elf_Scn *__scn)); |
extern size_t elf64_fsize __P((Elf_Type __type, size_t __count, |
unsigned __ver)); |
extern Elf_Data *elf64_xlatetof __P((Elf_Data *__dst, const Elf_Data *__src, |
unsigned __encode)); |
extern Elf_Data *elf64_xlatetom __P((Elf_Data *__dst, const Elf_Data *__src, |
unsigned __encode)); |
#endif /* __LIBELF64 */ |
/* |
* More function declarations |
* These functions are NOT available |
* in the SYSV version of libelf! |
*/ |
extern size_t elf_delscn __P((Elf *__elf, Elf_Scn *__scn)); |
#ifdef __cplusplus |
} |
#endif /* __cplusplus */ |
#endif /* _LIBELF_H */ |
/contrib/media/updf/include/libelf/nlist.h |
---|
0,0 → 1,48 |
/* |
nlist.h - public header file for nlist(3). |
Copyright (C) 1995 - 1998 Michael Riepe <michael@stud.uni-hannover.de> |
This library is free software; you can redistribute it and/or |
modify it under the terms of the GNU Library General Public |
License as published by the Free Software Foundation; either |
version 2 of the License, or (at your option) any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
Library General Public License for more details. |
You should have received a copy of the GNU Library General Public |
License along with this library; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
*/ |
/* @(#) $Id: nlist.h,v 1.3 1998/06/01 19:47:24 michael Exp $ */ |
#ifndef _NLIST_H |
#define _NLIST_H |
#ifdef __cplusplus |
extern "C" { |
#endif /* __cplusplus */ |
struct nlist { |
char* n_name; |
long n_value; |
short n_scnum; |
unsigned short n_type; |
char n_sclass; |
char n_numaux; |
}; |
#if __STDC__ || defined(__cplusplus) |
extern int nlist(const char *__filename, struct nlist *__nl); |
#else /* __STDC__ || defined(__cplusplus) */ |
extern int nlist(); |
#endif /* __STDC__ || defined(__cplusplus) */ |
#ifdef __cplusplus |
} |
#endif /* __cplusplus */ |
#endif /* _NLIST_H */ |
/contrib/media/updf/include/libelf/private.h |
---|
0,0 → 1,360 |
/* |
private.h - private definitions for libelf. |
Copyright (C) 1995 - 1998 Michael Riepe <michael@stud.uni-hannover.de> |
This library is free software; you can redistribute it and/or |
modify it under the terms of the GNU Library General Public |
License as published by the Free Software Foundation; either |
version 2 of the License, or (at your option) any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
Library General Public License for more details. |
You should have received a copy of the GNU Library General Public |
License along with this library; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
*/ |
/* @(#) $Id: private.h,v 1.10 1998/11/27 21:25:19 michael Exp $ */ |
#ifndef _PRIVATE_H |
#define _PRIVATE_H |
#define __LIBELF_INTERNAL__ 1 |
#if HAVE_CONFIG_H |
# include <config.h> |
#endif /* HAVE_CONFIG_H */ |
#include <sys/types.h> |
#if STDC_HEADERS |
# include <stdlib.h> |
# include <string.h> |
#else /* STDC_HEADERS */ |
extern char *malloc(), *realloc(); |
extern void free(), bcopy(); |
extern int strcmp(), strncmp(), memcmp(); |
extern void *memcpy(), *memmove(), *memset(); |
#endif /* STDC_HEADERS */ |
#if HAVE_UNISTD_H |
# include <unistd.h> |
#else /* HAVE_UNISTD_H */ |
extern int read(), write(); |
extern off_t lseek(); |
#endif /* HAVE_UNISTD_H */ |
#if !HAVE_MEMCMP |
# define memcmp strncmp |
#endif /* !HAVE_MEMCMP */ |
#if !HAVE_MEMCPY |
# define memcpy(d,s,n) bcopy(s,d,n) |
#endif /* !HAVE_MEMCPY */ |
#if !HAVE_MEMMOVE |
# define memmove(d,s,n) bcopy(s,d,n) |
#endif /* !HAVE_MEMMOVE */ |
#if !HAVE_MEMSET |
# define memset _elf_memset |
extern void *_elf_memset(); |
#endif /* !HAVE_MEMSET */ |
#if HAVE_STRUCT_NLIST_DECLARATION |
# define nlist __override_nlist_declaration |
#endif /* HAVE_STRUCT_NLIST_DECLARATION */ |
#if NEED_LINK_H |
# include <link.h> |
#endif /* NEED_LINK_H */ |
#include <libelf.h> |
#if HAVE_STRUCT_NLIST_DECLARATION |
# undef nlist |
#endif /* HAVE_STRUCT_NLIST_DECLARATION */ |
typedef struct Scn_Data Scn_Data; |
/* |
* ELF descriptor |
*/ |
struct Elf { |
/* common */ |
size_t e_size; /* file/member size */ |
size_t e_dsize; /* size of memory image */ |
Elf_Kind e_kind; /* kind of file */ |
char* e_data; /* file/member data */ |
char* e_rawdata; /* file/member raw data */ |
size_t e_idlen; /* identifier size */ |
int e_fd; /* file descriptor */ |
unsigned e_count; /* activation count */ |
/* archive members (still common) */ |
Elf* e_parent; /* NULL if not an archive member */ |
size_t e_next; /* 0 if not an archive member */ |
size_t e_base; /* 0 if not an archive member */ |
Elf* e_link; /* next archive member or NULL */ |
Elf_Arhdr* e_arhdr; /* archive member header or NULL */ |
/* archives */ |
size_t e_off; /* current member offset (for elf_begin) */ |
Elf* e_members; /* linked list of active archive members */ |
char* e_symtab; /* archive symbol table */ |
size_t e_symlen; /* length of archive symbol table */ |
char* e_strtab; /* archive string table */ |
size_t e_strlen; /* length of archive string table */ |
/* ELF files */ |
unsigned e_class; /* ELF class */ |
unsigned e_encoding; /* ELF data encoding */ |
unsigned e_version; /* ELF version */ |
char* e_ehdr; /* ELF header */ |
char* e_phdr; /* ELF program header table */ |
size_t e_phnum; /* size of program header table */ |
Elf_Scn* e_scn_1; /* first section */ |
Elf_Scn* e_scn_n; /* last section */ |
unsigned e_elf_flags; /* elf flags (ELF_F_*) */ |
unsigned e_ehdr_flags; /* ehdr flags (ELF_F_*) */ |
unsigned e_phdr_flags; /* phdr flags (ELF_F_*) */ |
/* misc flags */ |
unsigned e_readable : 1; /* file is readable */ |
unsigned e_writable : 1; /* file is writable */ |
unsigned e_disabled : 1; /* e_fd has been disabled */ |
unsigned e_cooked : 1; /* e_data was modified */ |
unsigned e_free_syms : 1; /* e_symtab is malloc'ed */ |
unsigned e_free_ehdr : 1; /* e_ehdr is malloc'ed */ |
unsigned e_free_phdr : 1; /* e_phdr is malloc'ed */ |
unsigned e_unmap_data : 1; /* e_data is mmap'ed */ |
unsigned e_memory : 1; /* created by elf_memory() */ |
/* magic number for debugging */ |
long e_magic; |
}; |
#define ELF_MAGIC 0x012b649e |
#define INIT_ELF {\ |
/* e_size */ 0,\ |
/* e_dsize */ 0,\ |
/* e_kind */ ELF_K_NONE,\ |
/* e_data */ NULL,\ |
/* e_rawdata */ NULL,\ |
/* e_idlen */ 0,\ |
/* e_fd */ -1,\ |
/* e_count */ 1,\ |
/* e_parent */ NULL,\ |
/* e_next */ 0,\ |
/* e_base */ 0,\ |
/* e_link */ NULL,\ |
/* e_arhdr */ NULL,\ |
/* e_off */ 0,\ |
/* e_members */ NULL,\ |
/* e_symtab */ NULL,\ |
/* e_symlen */ 0,\ |
/* e_strtab */ NULL,\ |
/* e_strlen */ 0,\ |
/* e_class */ ELFCLASSNONE,\ |
/* e_encoding */ ELFDATANONE,\ |
/* e_version */ EV_NONE,\ |
/* e_ehdr */ NULL,\ |
/* e_phdr */ NULL,\ |
/* e_phnum */ 0,\ |
/* e_scn_1 */ NULL,\ |
/* e_scn_n */ NULL,\ |
/* e_elf_flags */ 0,\ |
/* e_ehdr_flags */ 0,\ |
/* e_phdr_flags */ 0,\ |
/* e_readable */ 0,\ |
/* e_writable */ 0,\ |
/* e_disabled */ 0,\ |
/* e_cooked */ 0,\ |
/* e_free_syms */ 0,\ |
/* e_free_ehdr */ 0,\ |
/* e_free_phdr */ 0,\ |
/* e_unmap_data */ 0,\ |
/* e_memory */ 0,\ |
/* e_magic */ ELF_MAGIC\ |
} |
/* |
* Section descriptor |
*/ |
struct Elf_Scn { |
Elf_Scn* s_link; /* pointer to next Elf_Scn */ |
Elf* s_elf; /* pointer to elf descriptor */ |
size_t s_index; /* number of this section */ |
unsigned s_scn_flags; /* section flags (ELF_F_*) */ |
unsigned s_shdr_flags; /* shdr flags (ELF_F_*) */ |
Scn_Data* s_data_1; /* first data buffer */ |
Scn_Data* s_data_n; /* last data buffer */ |
Scn_Data* s_rawdata; /* raw data buffer */ |
/* data copied from shdr */ |
unsigned s_type; /* section type */ |
size_t s_offset; /* section offset */ |
size_t s_size; /* section size */ |
/* misc flags */ |
unsigned s_freeme : 1; /* this Elf_Scn was malloc'ed */ |
/* section header */ |
union { |
#if __LIBELF64 |
Elf64_Shdr u_shdr64; |
#endif /* __LIBELF64 */ |
Elf32_Shdr u_shdr32; |
} s_uhdr; |
/* magic number for debugging */ |
long s_magic; |
}; |
#define s_shdr32 s_uhdr.u_shdr32 |
#define s_shdr64 s_uhdr.u_shdr64 |
#define SCN_MAGIC 0x012c747d |
#define INIT_SCN {\ |
/* s_link */ NULL,\ |
/* s_elf */ NULL,\ |
/* s_index */ 0,\ |
/* s_scn_flags */ 0,\ |
/* s_shdr_flags */ 0,\ |
/* s_data_1 */ NULL,\ |
/* s_data_n */ NULL,\ |
/* s_rawdata */ NULL,\ |
/* s_type */ SHT_NULL,\ |
/* s_offset */ 0,\ |
/* s_size */ 0,\ |
/* s_freeme */ 0,\ |
/* s_uhdr */ {{0,}},\ |
/* s_magic */ SCN_MAGIC\ |
} |
/* |
* Data descriptor |
*/ |
struct Scn_Data { |
Elf_Data sd_data; /* must be first! */ |
Scn_Data* sd_link; /* pointer to next Scn_Data */ |
char* sd_memdata; /* memory image of section */ |
unsigned sd_data_flags; /* data flags (ELF_F_*) */ |
/* misc flags */ |
unsigned sd_freeme : 1; /* this Scn_Data was malloc'ed */ |
unsigned sd_free_data : 1; /* sd_memdata is malloc'ed */ |
/* magic number for debugging */ |
long sd_magic; |
}; |
#define DATA_MAGIC 0x01072639 |
#define INIT_DATA {\ |
{\ |
/* d_buf */ NULL,\ |
/* d_type */ ELF_T_BYTE,\ |
/* d_size */ 0,\ |
/* d_off */ 0,\ |
/* d_align */ 0,\ |
/* d_version */ EV_NONE\ |
},\ |
/* sd_link */ NULL,\ |
/* sd_memdata */ NULL,\ |
/* sd_data_flags */ 0,\ |
/* sd_freeme */ 0,\ |
/* sd_free_data */ 0,\ |
/* sd_magic */ DATA_MAGIC\ |
} |
/* |
* Private status variables |
*/ |
extern unsigned _elf_version; |
extern int _elf_errno; |
extern int _elf_fill; |
/* |
* Private functions |
*/ |
extern void *_elf_read __P((Elf*, void*, size_t, size_t)); |
extern void *_elf_mmap __P((Elf*)); |
extern int _elf_cook __P((Elf*)); |
extern char *_elf_getehdr __P((Elf*, unsigned)); |
extern Elf_Data *_elf_xlatetom(const Elf*, Elf_Data*, const Elf_Data*); |
/* |
* Private data |
*/ |
extern const Elf_Scn _elf_scn_init; |
extern const Scn_Data _elf_data_init; |
extern const Elf_Type _elf_scn_types[SHT_NUM]; |
extern const size_t _elf_fmsize[2][EV_CURRENT - EV_NONE][ELF_T_NUM][2]; |
/* |
* Access macros for _elf_fmsize[] |
*/ |
#define _fmsize(c,v,t,w) \ |
(_elf_fmsize[(c)-ELFCLASS32][(v)-EV_NONE-1][(t)-ELF_T_BYTE][(w)]) |
#define _fsize(c,v,t) _fmsize((c),(v),(t),1) |
#define _msize(c,v,t) _fmsize((c),(v),(t),0) |
/* |
* Various checks |
*/ |
#define valid_class(c) ((c) >= ELFCLASS32 && (c) <= ELFCLASS64) |
#define valid_encoding(e) ((e) >= ELFDATA2LSB && (e) <= ELFDATA2MSB) |
#define valid_version(v) ((v) > EV_NONE && (v) <= EV_CURRENT) |
#define valid_type(t) ((t) >= ELF_T_BYTE && (t) < ELF_T_NUM) |
#define valid_scntype(s) ((s) >= SHT_NULL && (s) < SHT_NUM) |
/* |
* Error codes |
*/ |
enum { |
#define __err__(a,b) a, |
#include <errors.h> /* include constants from errors.h */ |
#undef __err__ |
ERROR_NUM |
}; |
#define seterr(err) (_elf_errno = (err)) |
/* |
* Sizes of data types (external representation) |
* These definitions should be in <elf.h>, but... |
*/ |
#ifndef ELF32_FSZ_ADDR |
# define ELF32_FSZ_ADDR 4 |
# define ELF32_FSZ_HALF 2 |
# define ELF32_FSZ_OFF 4 |
# define ELF32_FSZ_SWORD 4 |
# define ELF32_FSZ_WORD 4 |
#endif /* ELF32_FSZ_ADDR */ |
#ifndef ELF64_FSZ_ADDR |
# define ELF64_FSZ_ADDR 8 |
# define ELF64_FSZ_HALF 2 |
# define ELF64_FSZ_OFF 8 |
# define ELF64_FSZ_SWORD 4 |
# define ELF64_FSZ_SXWORD 8 |
# define ELF64_FSZ_WORD 4 |
# define ELF64_FSZ_XWORD 8 |
#endif /* ELF64_FSZ_ADDR */ |
/* |
* Alignment |
*/ |
#define _ELF32_ALIGN_PHDR 4 |
#define _ELF32_ALIGN_SHDR 4 |
#define _ELF64_ALIGN_PHDR 8 |
#define _ELF64_ALIGN_SHDR 8 |
/* |
* Debugging |
*/ |
#if ENABLE_DEBUG |
# include <stdio.h> |
# if __STDC__ |
# define elf_assert(x) ((void)((x)||__elf_assert(__FILE__,__LINE__,#x))) |
# else /* __STDC__ */ |
# define elf_assert(x) ((void)((x)||__elf_assert(__FILE__,__LINE__,"x"))) |
# endif /* __STDC__ */ |
# define __elf_assert(f,l,x) (fprintf(stderr,\ |
"%s:%u: libelf assertion failure: %s\n",(f),(l),(x)),abort(),0) |
#else /* ENABLE_DEBUG */ |
# define elf_assert(x) ((void)0) |
#endif /* ENABLE_DEBUG */ |
#endif /* _PRIVATE_H */ |
/contrib/media/updf/include/libelf/sys_elf.h |
---|
0,0 → 1,81 |
/* lib/sys_elf.h. Generated automatically by configure. */ |
/* |
sys_elf.h.in - configure template for private "switch" file. |
Copyright (C) 1998 Michael Riepe <michael@stud.uni-hannover.de> |
This library is free software; you can redistribute it and/or |
modify it under the terms of the GNU Library General Public |
License as published by the Free Software Foundation; either |
version 2 of the License, or (at your option) any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
Library General Public License for more details. |
You should have received a copy of the GNU Library General Public |
License along with this library; if not, write to the Free Software |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
*/ |
/* @(#) $Id: sys_elf.h.in,v 1.3 1998/06/04 15:26:48 michael Exp $ */ |
/* |
* DO NOT USE THIS IN APPLICATIONS - #include <libelf.h> INSTEAD! |
*/ |
/* Define to `<elf.h>' or `<sys/elf.h>' if one of them is present */ |
#define __LIBELF_HEADER_ELF_H <elf.h> |
/* Define if you want 64-bit support (and your system supports it) */ |
#define __LIBELF64 1 |
/* Define if you want 64-bit support, and are running IRIX */ |
/* #undef __LIBELF64_IRIX */ |
/* Define if you want 64-bit support, and are running Linux */ |
/* #undef __LIBELF64_LINUX */ |
/* Define to a 64-bit signed integer type if one exists */ |
#define __libelf_i64_t long long |
/* Define to a 64-bit unsigned integer type if one exists */ |
#define __libelf_u64_t unsigned long long |
/* Define to a 32-bit signed integer type if one exists */ |
#define __libelf_i32_t long |
/* Define to a 32-bit unsigned integer type if one exists */ |
#define __libelf_u32_t unsigned long |
/* Define to a 16-bit signed integer type if one exists */ |
#define __libelf_i16_t short |
/* Define to a 16-bit unsigned integer type if one exists */ |
#define __libelf_u16_t unsigned short |
/* |
* Ok, now get the correct instance of elf.h... |
*/ |
#ifdef __LIBELF_HEADER_ELF_H |
# include __LIBELF_HEADER_ELF_H |
#else /* __LIBELF_HEADER_ELF_H */ |
# if __LIBELF_INTERNAL__ |
# include <elf_repl.h> |
# else /* __LIBELF_INTERNAL__ */ |
# include <libelf/elf_repl.h> |
# endif /* __LIBELF_INTERNAL__ */ |
#endif /* __LIBELF_HEADER_ELF_H */ |
/* |
* Workaround for broken <elf.h> on Linux... |
*/ |
#if __LIBELF64 && __LIBELF64_LINUX |
typedef __libelf_u64_t Elf64_Addr; |
typedef __libelf_u16_t Elf64_Half; |
typedef __libelf_u64_t Elf64_Off; |
typedef __libelf_i32_t Elf64_Sword; |
typedef __libelf_i64_t Elf64_Sxword; |
typedef __libelf_u32_t Elf64_Word; |
typedef __libelf_u64_t Elf64_Xword; |
#endif /* __LIBELF64 && __LIBELF64_LINUX */ |