x86_64.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // x86-64.h -- ELF definitions specific to EM_X86_64 -*- C++ -*-
  2. // Copyright (C) 2006-2022 Free Software Foundation, Inc.
  3. // Written by Andrew Chatham.
  4. // This file is part of elfcpp.
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU Library General Public License
  7. // as published by the Free Software Foundation; either version 2, or
  8. // (at your option) any later version.
  9. // In addition to the permissions in the GNU Library General Public
  10. // License, the Free Software Foundation gives you unlimited
  11. // permission to link the compiled version of this file into
  12. // combinations with other programs, and to distribute those
  13. // combinations without any restriction coming from the use of this
  14. // file. (The Library Public License restrictions do apply in other
  15. // respects; for example, they cover modification of the file, and
  16. /// distribution when not linked into a combined executable.)
  17. // This program is distributed in the hope that it will be useful, but
  18. // WITHOUT ANY WARRANTY; without even the implied warranty of
  19. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. // Library General Public License for more details.
  21. // You should have received a copy of the GNU Library General Public
  22. // License along with this program; if not, write to the Free Software
  23. // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
  24. // 02110-1301, USA.
  25. #ifndef ELFCPP_X86_64_H
  26. #define ELFCPP_X86_64_H
  27. namespace elfcpp
  28. {
  29. // Documentation is taken from
  30. // http://www.x86-64.org/documentation/abi-0.98.pdf
  31. // elf.h
  32. // Documentation for the TLS relocs is taken from
  33. // http://people.redhat.com/drepper/tls.pdf
  34. // http://www.lsd.ic.unicamp.br/~oliva/writeups/TLS/RFC-TLSDESC-x86.txt
  35. enum
  36. {
  37. R_X86_64_NONE = 0, // No reloc
  38. R_X86_64_64 = 1, // Direct 64 bit
  39. R_X86_64_PC32 = 2, // PC relative 32 bit signed
  40. R_X86_64_GOT32 = 3, // 32 bit GOT entry
  41. R_X86_64_PLT32 = 4, // 32 bit PLT address
  42. R_X86_64_COPY = 5, // Copy symbol at runtime
  43. R_X86_64_GLOB_DAT = 6, // Create GOT entry
  44. R_X86_64_JUMP_SLOT = 7, // Create PLT entry
  45. R_X86_64_RELATIVE = 8, // Adjust by program base
  46. R_X86_64_GOTPCREL = 9, // 32 bit signed PC relative offset to GOT
  47. R_X86_64_32 = 10, // Direct 32 bit zero extended
  48. R_X86_64_32S = 11, // Direct 32 bit sign extended
  49. R_X86_64_16 = 12, // Direct 16 bit zero extended
  50. R_X86_64_PC16 = 13, // 16 bit sign extended pc relative
  51. R_X86_64_8 = 14, // Direct 8 bit sign extended
  52. R_X86_64_PC8 = 15, // 8 bit sign extended pc relative
  53. // TLS relocations
  54. R_X86_64_DTPMOD64 = 16, // ID of module containing symbol
  55. R_X86_64_DTPOFF64 = 17, // Offset in module's TLS block
  56. R_X86_64_TPOFF64 = 18, // Offset in initial TLS block
  57. R_X86_64_TLSGD = 19, // 32 bit signed PC relative offset to two
  58. // GOT entries for GD symbol
  59. R_X86_64_TLSLD = 20, // 32 bit signed PC relative offset to two
  60. // GOT entries for LD symbol
  61. R_X86_64_DTPOFF32 = 21, // Offset in TLS block
  62. R_X86_64_GOTTPOFF = 22, // 32 bit signed PC relative offset to GOT
  63. // entry for IE symbol
  64. R_X86_64_TPOFF32 = 23, // Offset in initial TLS block
  65. R_X86_64_PC64 = 24, // 64-bit PC relative
  66. R_X86_64_GOTOFF64 = 25, // 64-bit GOT offset
  67. R_X86_64_GOTPC32 = 26, // 32-bit PC relative offset to GOT
  68. R_X86_64_GOT64 = 27, // 64-bit GOT entry offset
  69. R_X86_64_GOTPCREL64 = 28, // 64-bit PC relative offset to GOT entry
  70. R_X86_64_GOTPC64 = 29, // 64-bit PC relative offset to GOT
  71. R_X86_64_GOTPLT64 = 30, // Like GOT64, indicates that PLT entry needed
  72. R_X86_64_PLTOFF64 = 31, // 64-bit GOT relative offset to PLT entry
  73. R_X86_64_SIZE32 = 32,
  74. R_X86_64_SIZE64 = 33,
  75. R_X86_64_GOTPC32_TLSDESC = 34, // 32-bit PC relative to TLS descriptor in GOT
  76. R_X86_64_TLSDESC_CALL = 35, // Relaxable call through TLS descriptor
  77. R_X86_64_TLSDESC = 36, // 2 by 64-bit TLS descriptor
  78. R_X86_64_IRELATIVE = 37, // Adjust indirectly by program base
  79. R_X86_64_RELATIVE64 = 38, // 64-bit adjust by program base
  80. R_X86_64_PC32_BND = 39, // PC relative 32 bit signed with BND prefix
  81. R_X86_64_PLT32_BND = 40, // 32 bit PLT address with BND prefix
  82. R_X86_64_GOTPCRELX = 41, // 32 bit signed PC relative offset to GOT
  83. // without REX prefix, relaxable.
  84. R_X86_64_REX_GOTPCRELX = 42, // 32 bit signed PC relative offset to GOT
  85. // with REX prefix, relaxable.
  86. // GNU vtable garbage collection extensions.
  87. R_X86_64_GNU_VTINHERIT = 250,
  88. R_X86_64_GNU_VTENTRY = 251
  89. };
  90. // The bit values that can appear in the GNU_PROPERTY_X86_FEATURE_1_AND
  91. // program property.
  92. const uint64_t GNU_PROPERTY_X86_FEATURE_1_IBT = 1ULL << 0;
  93. const uint64_t GNU_PROPERTY_X86_FEATURE_1_SHSTK = 1ULL << 1;
  94. } // End namespace elfcpp.
  95. #endif // !defined(ELFCPP_X86_64_H)