elf.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* This file defines standard ELF types, structures, and macros.
  2. Copyright (C) 1995-2022 Free Software Foundation, Inc.
  3. This file is part of libctf.
  4. libctf is free software; you can redistribute it and/or modify it under
  5. the terms of the GNU General Public License as published by the Free
  6. Software Foundation; either version 3, or (at your option) any later
  7. version.
  8. This program is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. See the GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; see the file COPYING. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _CTF_ELF_H
  16. #define _CTF_ELF_H
  17. #include "config.h"
  18. #include "ansidecl.h"
  19. #include <stdint.h>
  20. #include "elf/common.h"
  21. #include "elf/external.h"
  22. typedef uint32_t Elf32_Word;
  23. typedef uint32_t Elf64_Word;
  24. typedef uint32_t Elf32_Addr;
  25. typedef uint64_t Elf64_Addr;
  26. typedef uint64_t Elf64_Xword;
  27. typedef uint16_t Elf32_Section;
  28. typedef uint16_t Elf64_Section;
  29. #define SHN_EXTABS 0xFFF1 /* Associated symbol is absolute */
  30. /* Symbol table entry. */
  31. typedef struct
  32. {
  33. Elf32_Word st_name; /* Symbol name (string tbl index) */
  34. Elf32_Addr st_value; /* Symbol value */
  35. Elf32_Word st_size; /* Symbol size */
  36. unsigned char st_info; /* Symbol type and binding */
  37. unsigned char st_other; /* Symbol visibility */
  38. Elf32_Section st_shndx; /* Section index */
  39. } Elf32_Sym;
  40. typedef struct
  41. {
  42. Elf64_Word st_name; /* Symbol name (string tbl index) */
  43. unsigned char st_info; /* Symbol type and binding */
  44. unsigned char st_other; /* Symbol visibility */
  45. Elf64_Section st_shndx; /* Section index */
  46. Elf64_Addr st_value; /* Symbol value */
  47. Elf64_Xword st_size; /* Symbol size */
  48. } Elf64_Sym;
  49. #endif /* _CTF_ELF_H */