Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /*
  2. ext_types.h - external representation of ELF data types.
  3. Copyright (C) 1995 - 1998 Michael Riepe <michael@stud.uni-hannover.de>
  4.  
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public
  7. License as published by the Free Software Foundation; either
  8. version 2 of the License, or (at your option) any later version.
  9.  
  10. This library is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. Library General Public License for more details.
  14.  
  15. You should have received a copy of the GNU Library General Public
  16. License along with this library; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19.  
  20. /* @(#) $Id: ext_types.h,v 1.3 1998/06/01 19:47:15 michael Exp $ */
  21.  
  22. #ifndef _EXT_TYPES_H
  23. #define _EXT_TYPES_H
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif /* __cplusplus */
  28.  
  29. /*
  30.  * Scalar data types
  31.  */
  32. typedef unsigned char __ext_Elf32_Addr  [ELF32_FSZ_ADDR];
  33. typedef unsigned char __ext_Elf32_Half  [ELF32_FSZ_HALF];
  34. typedef unsigned char __ext_Elf32_Off   [ELF32_FSZ_OFF];
  35. typedef unsigned char __ext_Elf32_Sword [ELF32_FSZ_SWORD];
  36. typedef unsigned char __ext_Elf32_Word  [ELF32_FSZ_WORD];
  37.  
  38. #if __LIBELF64
  39. typedef unsigned char __ext_Elf64_Addr  [ELF64_FSZ_ADDR];
  40. typedef unsigned char __ext_Elf64_Half  [ELF64_FSZ_HALF];
  41. typedef unsigned char __ext_Elf64_Off   [ELF64_FSZ_OFF];
  42. typedef unsigned char __ext_Elf64_Sword [ELF64_FSZ_SWORD];
  43. typedef unsigned char __ext_Elf64_Sxword[ELF64_FSZ_SXWORD];
  44. typedef unsigned char __ext_Elf64_Word  [ELF64_FSZ_WORD];
  45. typedef unsigned char __ext_Elf64_Xword [ELF64_FSZ_XWORD];
  46. #endif /* __LIBELF64 */
  47.  
  48. /*
  49.  * ELF header
  50.  */
  51. typedef struct {
  52.     unsigned char       e_ident[EI_NIDENT];
  53.     __ext_Elf32_Half    e_type;
  54.     __ext_Elf32_Half    e_machine;
  55.     __ext_Elf32_Word    e_version;
  56.     __ext_Elf32_Addr    e_entry;
  57.     __ext_Elf32_Off     e_phoff;
  58.     __ext_Elf32_Off     e_shoff;
  59.     __ext_Elf32_Word    e_flags;
  60.     __ext_Elf32_Half    e_ehsize;
  61.     __ext_Elf32_Half    e_phentsize;
  62.     __ext_Elf32_Half    e_phnum;
  63.     __ext_Elf32_Half    e_shentsize;
  64.     __ext_Elf32_Half    e_shnum;
  65.     __ext_Elf32_Half    e_shstrndx;
  66. } __ext_Elf32_Ehdr;
  67.  
  68. #if __LIBELF64
  69. typedef struct {
  70.     unsigned char       e_ident[EI_NIDENT];
  71.     __ext_Elf64_Half    e_type;
  72.     __ext_Elf64_Half    e_machine;
  73.     __ext_Elf64_Word    e_version;
  74.     __ext_Elf64_Addr    e_entry;
  75.     __ext_Elf64_Off     e_phoff;
  76.     __ext_Elf64_Off     e_shoff;
  77.     __ext_Elf64_Word    e_flags;
  78.     __ext_Elf64_Half    e_ehsize;
  79.     __ext_Elf64_Half    e_phentsize;
  80.     __ext_Elf64_Half    e_phnum;
  81.     __ext_Elf64_Half    e_shentsize;
  82.     __ext_Elf64_Half    e_shnum;
  83.     __ext_Elf64_Half    e_shstrndx;
  84. } __ext_Elf64_Ehdr;
  85. #endif /* __LIBELF64 */
  86.  
  87. /*
  88.  * Section header
  89.  */
  90. typedef struct {
  91.     __ext_Elf32_Word    sh_name;
  92.     __ext_Elf32_Word    sh_type;
  93.     __ext_Elf32_Word    sh_flags;
  94.     __ext_Elf32_Addr    sh_addr;
  95.     __ext_Elf32_Off     sh_offset;
  96.     __ext_Elf32_Word    sh_size;
  97.     __ext_Elf32_Word    sh_link;
  98.     __ext_Elf32_Word    sh_info;
  99.     __ext_Elf32_Word    sh_addralign;
  100.     __ext_Elf32_Word    sh_entsize;
  101. } __ext_Elf32_Shdr;
  102.  
  103. #if __LIBELF64
  104. typedef struct {
  105.     __ext_Elf64_Word    sh_name;
  106.     __ext_Elf64_Word    sh_type;
  107.     __ext_Elf64_Xword   sh_flags;
  108.     __ext_Elf64_Addr    sh_addr;
  109.     __ext_Elf64_Off     sh_offset;
  110.     __ext_Elf64_Xword   sh_size;
  111.     __ext_Elf64_Word    sh_link;
  112.     __ext_Elf64_Word    sh_info;
  113.     __ext_Elf64_Xword   sh_addralign;
  114.     __ext_Elf64_Xword   sh_entsize;
  115. } __ext_Elf64_Shdr;
  116. #endif /* __LIBELF64 */
  117.  
  118. /*
  119.  * Symbol table
  120.  */
  121. typedef struct {
  122.     __ext_Elf32_Word    st_name;
  123.     __ext_Elf32_Addr    st_value;
  124.     __ext_Elf32_Word    st_size;
  125.     unsigned char       st_info;
  126.     unsigned char       st_other;
  127.     __ext_Elf32_Half    st_shndx;
  128. } __ext_Elf32_Sym;
  129.  
  130. #if __LIBELF64
  131. typedef struct {
  132.     __ext_Elf64_Word    st_name;
  133.     unsigned char       st_info;
  134.     unsigned char       st_other;
  135.     __ext_Elf64_Half    st_shndx;
  136.     __ext_Elf64_Addr    st_value;
  137.     __ext_Elf64_Xword   st_size;
  138. } __ext_Elf64_Sym;
  139. #endif /* __LIBELF64 */
  140.  
  141. /*
  142.  * Relocation
  143.  */
  144. typedef struct {
  145.     __ext_Elf32_Addr    r_offset;
  146.     __ext_Elf32_Word    r_info;
  147. } __ext_Elf32_Rel;
  148.  
  149. typedef struct {
  150.     __ext_Elf32_Addr    r_offset;
  151.     __ext_Elf32_Word    r_info;
  152.     __ext_Elf32_Sword   r_addend;
  153. } __ext_Elf32_Rela;
  154.  
  155. #if __LIBELF64
  156. typedef struct {
  157.     __ext_Elf64_Addr    r_offset;
  158. #if __LIBELF64_IRIX
  159.     __ext_Elf64_Word    r_sym;
  160.     unsigned char       r_ssym;
  161.     unsigned char       r_type3;
  162.     unsigned char       r_type2;
  163.     unsigned char       r_type;
  164. #else /* __LIBELF64_IRIX */
  165.     __ext_Elf64_Xword   r_info;
  166. #endif /* __LIBELF64_IRIX */
  167. } __ext_Elf64_Rel;
  168.  
  169. typedef struct {
  170.     __ext_Elf64_Addr    r_offset;
  171. #if __LIBELF64_IRIX
  172.     __ext_Elf64_Word    r_sym;
  173.     unsigned char       r_ssym;
  174.     unsigned char       r_type3;
  175.     unsigned char       r_type2;
  176.     unsigned char       r_type;
  177. #else /* __LIBELF64_IRIX */
  178.     __ext_Elf64_Xword   r_info;
  179. #endif /* __LIBELF64_IRIX */
  180.     __ext_Elf64_Sxword  r_addend;
  181. } __ext_Elf64_Rela;
  182. #endif /* __LIBELF64 */
  183.  
  184. /*
  185.  * Program header
  186.  */
  187. typedef struct {
  188.     __ext_Elf32_Word    p_type;
  189.     __ext_Elf32_Off     p_offset;
  190.     __ext_Elf32_Addr    p_vaddr;
  191.     __ext_Elf32_Addr    p_paddr;
  192.     __ext_Elf32_Word    p_filesz;
  193.     __ext_Elf32_Word    p_memsz;
  194.     __ext_Elf32_Word    p_flags;
  195.     __ext_Elf32_Word    p_align;
  196. } __ext_Elf32_Phdr;
  197.  
  198. #if __LIBELF64
  199. typedef struct {
  200.     __ext_Elf64_Word    p_type;
  201.     __ext_Elf64_Word    p_flags;
  202.     __ext_Elf64_Off     p_offset;
  203.     __ext_Elf64_Addr    p_vaddr;
  204.     __ext_Elf64_Addr    p_paddr;
  205.     __ext_Elf64_Xword   p_filesz;
  206.     __ext_Elf64_Xword   p_memsz;
  207.     __ext_Elf64_Xword   p_align;
  208. } __ext_Elf64_Phdr;
  209. #endif /* __LIBELF64 */
  210.  
  211. /*
  212.  * Dynamic structure
  213.  */
  214. typedef struct {
  215.     __ext_Elf32_Sword   d_tag;
  216.     union {
  217.         __ext_Elf32_Word        d_val;
  218.         __ext_Elf32_Addr        d_ptr;
  219.     } d_un;
  220. } __ext_Elf32_Dyn;
  221.  
  222. #if __LIBELF64
  223. typedef struct {
  224.     __ext_Elf64_Sxword  d_tag;
  225.     union {
  226.         __ext_Elf64_Xword       d_val;
  227.         __ext_Elf64_Addr        d_ptr;
  228.     } d_un;
  229. } __ext_Elf64_Dyn;
  230. #endif /* __LIBELF64 */
  231.  
  232. #ifdef  __cplusplus
  233. }
  234. #endif /* __cplusplus */
  235.  
  236. #endif /* _EXT_TYPES_H */
  237.