xref: /netbsd-src/external/gpl3/binutils/dist/elfcpp/sparc.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
12a6b7db3Sskrll // sparc.h -- ELF definitions specific to EM_SPARC  -*- C++ -*-
22a6b7db3Sskrll 
3*cb63e24eSchristos // Copyright (C) 2008-2024 Free Software Foundation, Inc.
42a6b7db3Sskrll // Written by David S. Miller <davem@davemloft.net>.
52a6b7db3Sskrll 
62a6b7db3Sskrll // This file is part of elfcpp.
72a6b7db3Sskrll 
82a6b7db3Sskrll // This program is free software; you can redistribute it and/or
92a6b7db3Sskrll // modify it under the terms of the GNU Library General Public License
102a6b7db3Sskrll // as published by the Free Software Foundation; either version 2, or
112a6b7db3Sskrll // (at your option) any later version.
122a6b7db3Sskrll 
132a6b7db3Sskrll // In addition to the permissions in the GNU Library General Public
142a6b7db3Sskrll // License, the Free Software Foundation gives you unlimited
152a6b7db3Sskrll // permission to link the compiled version of this file into
162a6b7db3Sskrll // combinations with other programs, and to distribute those
172a6b7db3Sskrll // combinations without any restriction coming from the use of this
182a6b7db3Sskrll // file.  (The Library Public License restrictions do apply in other
192a6b7db3Sskrll // respects; for example, they cover modification of the file, and
202a6b7db3Sskrll /// distribution when not linked into a combined executable.)
212a6b7db3Sskrll 
222a6b7db3Sskrll // This program is distributed in the hope that it will be useful, but
232a6b7db3Sskrll // WITHOUT ANY WARRANTY; without even the implied warranty of
242a6b7db3Sskrll // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
252a6b7db3Sskrll // Library General Public License for more details.
262a6b7db3Sskrll 
272a6b7db3Sskrll // You should have received a copy of the GNU Library General Public
282a6b7db3Sskrll // License along with this program; if not, write to the Free Software
292a6b7db3Sskrll // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
302a6b7db3Sskrll // 02110-1301, USA.
312a6b7db3Sskrll 
322a6b7db3Sskrll #ifndef ELFCPP_SPARC_H
332a6b7db3Sskrll #define ELFCPP_SPARC_H
342a6b7db3Sskrll 
352a6b7db3Sskrll // Documentation for the TLS relocs is taken from
362a6b7db3Sskrll //   http://people.redhat.com/drepper/tls.pdf
372a6b7db3Sskrll //
382a6b7db3Sskrll // More full documentation on sparc specific ELF file
392a6b7db3Sskrll // format details can be found at
402a6b7db3Sskrll //
412a6b7db3Sskrll //   http://docs.sun.com/app/docs/doc/819/0690/
422a6b7db3Sskrll //   "Linker and Libraries Guide"
432a6b7db3Sskrll //
442a6b7db3Sskrll // specifically Chapter 7 "Object File Format" and
452a6b7db3Sskrll // Chapter 8 "Thread-Local Storage"
462a6b7db3Sskrll 
472a6b7db3Sskrll namespace elfcpp
482a6b7db3Sskrll {
492a6b7db3Sskrll 
502a6b7db3Sskrll enum
512a6b7db3Sskrll {
522a6b7db3Sskrll   R_SPARC_NONE = 0,           // No reloc
532a6b7db3Sskrll   R_SPARC_8 = 1,              // Direct 8 bit
542a6b7db3Sskrll   R_SPARC_16 = 2,             // Direct 16 bit
552a6b7db3Sskrll   R_SPARC_32 = 3,             // Direct 32 bit
562a6b7db3Sskrll   R_SPARC_DISP8 = 4,          // PC relative 8 bit
572a6b7db3Sskrll   R_SPARC_DISP16 = 5,         // PC relative 16 bit
582a6b7db3Sskrll   R_SPARC_DISP32 = 6,         // PC relative 32 bit
592a6b7db3Sskrll   R_SPARC_WDISP30 = 7,        // PC relative 30 bit shifted
602a6b7db3Sskrll   R_SPARC_WDISP22 = 8,        // PC relative 22 bit shifted
612a6b7db3Sskrll   R_SPARC_HI22 = 9,           // High 22 bit
622a6b7db3Sskrll   R_SPARC_22 = 10,            // Direct 22 bit
632a6b7db3Sskrll   R_SPARC_13 = 11,            // Direct 13 bit
642a6b7db3Sskrll   R_SPARC_LO10 = 12,          // Truncated 10 bit
652a6b7db3Sskrll   R_SPARC_GOT10 = 13,         // Truncated 10 bit GOT entry
662a6b7db3Sskrll   R_SPARC_GOT13 = 14,         // 13 bit GOT entry
672a6b7db3Sskrll   R_SPARC_GOT22 = 15,         // 22 bit GOT entry shifted
682a6b7db3Sskrll   R_SPARC_PC10 = 16,          // PC relative 10 bit truncated
692a6b7db3Sskrll   R_SPARC_PC22 = 17,          // PC relative 22 bit shifted
702a6b7db3Sskrll   R_SPARC_WPLT30 = 18,        // 30 bit PC relative PLT address
712a6b7db3Sskrll   R_SPARC_COPY = 19,          // Copy symbol at runtime
722a6b7db3Sskrll   R_SPARC_GLOB_DAT = 20,      // Create GOT entry
732a6b7db3Sskrll   R_SPARC_JMP_SLOT = 21,      // Create PLT entry
742a6b7db3Sskrll   R_SPARC_RELATIVE = 22,      // Adjust by program base
752a6b7db3Sskrll   R_SPARC_UA32 = 23,          // Direct 32 bit unaligned
762a6b7db3Sskrll   R_SPARC_PLT32 = 24,         // Direct 32 bit ref to PLT entry
772a6b7db3Sskrll   R_SPARC_HIPLT22 = 25,       // High 22 bit PLT entry
782a6b7db3Sskrll   R_SPARC_LOPLT10 = 26,       // Truncated 10 bit PLT entry
792a6b7db3Sskrll   R_SPARC_PCPLT32 = 27,       // PC rel 32 bit ref to PLT entry
802a6b7db3Sskrll   R_SPARC_PCPLT22 = 28,       // PC rel high 22 bit PLT entry
812a6b7db3Sskrll   R_SPARC_PCPLT10 = 29,       // PC rel trunc 10 bit PLT entry
822a6b7db3Sskrll   R_SPARC_10 = 30,            // Direct 10 bit
832a6b7db3Sskrll   R_SPARC_11 = 31,            // Direct 11 bit
842a6b7db3Sskrll   R_SPARC_64 = 32,            // Direct 64 bit
852a6b7db3Sskrll   R_SPARC_OLO10 = 33,         // 10bit with secondary 13bit addend
862a6b7db3Sskrll   R_SPARC_HH22 = 34,          // Top 22 bits of direct 64 bit
872a6b7db3Sskrll   R_SPARC_HM10 = 35,          // High middle 10 bits of ...
882a6b7db3Sskrll   R_SPARC_LM22 = 36,          // Low middle 22 bits of ...
892a6b7db3Sskrll   R_SPARC_PC_HH22 = 37,       // Top 22 bits of pc rel 64 bit
902a6b7db3Sskrll   R_SPARC_PC_HM10 = 38,       // High middle 10 bit of ...
912a6b7db3Sskrll   R_SPARC_PC_LM22 = 39,       // Low miggle 22 bits of ...
922a6b7db3Sskrll   R_SPARC_WDISP16 = 40,       // PC relative 16 bit shifted
932a6b7db3Sskrll   R_SPARC_WDISP19 = 41,       // PC relative 19 bit shifted
942a6b7db3Sskrll   R_SPARC_GLOB_JMP = 42,      // was part of v9 ABI but was removed
952a6b7db3Sskrll   R_SPARC_7 = 43,             // Direct 7 bit
962a6b7db3Sskrll   R_SPARC_5 = 44,             // Direct 5 bit
972a6b7db3Sskrll   R_SPARC_6 = 45,             // Direct 6 bit
982a6b7db3Sskrll   R_SPARC_DISP64 = 46,        // PC relative 64 bit
992a6b7db3Sskrll   R_SPARC_PLT64 = 47,         // Direct 64 bit ref to PLT entry
1002a6b7db3Sskrll   R_SPARC_HIX22 = 48,         // High 22 bit complemented
1012a6b7db3Sskrll   R_SPARC_LOX10 = 49,         // Truncated 11 bit complemented
1022a6b7db3Sskrll   R_SPARC_H44 = 50,           // Direct high 12 of 44 bit
1032a6b7db3Sskrll   R_SPARC_M44 = 51,           // Direct mid 22 of 44 bit
1042a6b7db3Sskrll   R_SPARC_L44 = 52,           // Direct low 10 of 44 bit
1052a6b7db3Sskrll   R_SPARC_REGISTER = 53,      // Global register usage
1062a6b7db3Sskrll   R_SPARC_UA64 = 54,          // Direct 64 bit unaligned
1072a6b7db3Sskrll   R_SPARC_UA16 = 55,          // Direct 16 bit unaligned
1082a6b7db3Sskrll   R_SPARC_TLS_GD_HI22 = 56,   // Initial General Dynamic reloc, high 22-bit
1092a6b7db3Sskrll   R_SPARC_TLS_GD_LO10 = 57,   // Initial General Dynamic reloc, low 10-bit
1102a6b7db3Sskrll   R_SPARC_TLS_GD_ADD = 58,    // Initial General Dynamic reloc, add
1112a6b7db3Sskrll   R_SPARC_TLS_GD_CALL = 59,   // Initial General Dynamic reloc, call
1122a6b7db3Sskrll   R_SPARC_TLS_LDM_HI22 = 60,  // Initial Local Dynamic reloc, high 22-bit
1132a6b7db3Sskrll   R_SPARC_TLS_LDM_LO10 = 61,  // Initial Local Dynamic reloc, low 10-bit
1142a6b7db3Sskrll   R_SPARC_TLS_LDM_ADD = 62,   // Initial Local Dynamic reloc, add
1152a6b7db3Sskrll   R_SPARC_TLS_LDM_CALL = 63,  // Initial Local Dynamic reloc, call
1162a6b7db3Sskrll   R_SPARC_TLS_LDO_HIX22 = 64, // Initial Local Dynamic, high extended 22-bit
1172a6b7db3Sskrll   R_SPARC_TLS_LDO_LOX10 = 65, // Initial Local Dynamic, low extended 10-bit
1182a6b7db3Sskrll   R_SPARC_TLS_LDO_ADD = 66,   // Initial Local Dynamic, add extended
1192a6b7db3Sskrll   R_SPARC_TLS_IE_HI22 = 67,   // Initial Initial Exec reloc, high 22-bit
1202a6b7db3Sskrll   R_SPARC_TLS_IE_LO10 = 68,   // Initial Initial Exec reloc, low 10-bit
1212a6b7db3Sskrll   R_SPARC_TLS_IE_LD = 69,     // Initial Initial Exec reloc, load 32-bit
1222a6b7db3Sskrll   R_SPARC_TLS_IE_LDX = 70,    // Initial Initial Exec reloc, load 64-bit
1232a6b7db3Sskrll   R_SPARC_TLS_IE_ADD = 71,    // Initial Initial Exec reloc, add
1242a6b7db3Sskrll   R_SPARC_TLS_LE_HIX22 = 72,  // Initial Local Exec reloc, high extended 22-bit
1252a6b7db3Sskrll   R_SPARC_TLS_LE_LOX10 = 73,  // Initial Local Exec reloc, low extended 10-bit
1262a6b7db3Sskrll   R_SPARC_TLS_DTPMOD32 = 74,  // Outstanding General/Local Dynamic reloc, 32-bit
1272a6b7db3Sskrll   R_SPARC_TLS_DTPMOD64 = 75,  // Outstanding General/Local Dynamic reloc, 64-bit
1282a6b7db3Sskrll   R_SPARC_TLS_DTPOFF32 = 76,  // Outstanding General Dynamic reloc, 32-bit
1292a6b7db3Sskrll   R_SPARC_TLS_DTPOFF64 = 77,  // Outstanding General Dynamic reloc, 64-bit
1302a6b7db3Sskrll   R_SPARC_TLS_TPOFF32 = 78,   // Outstanding Initial Exec reloc, 32-bit
1312a6b7db3Sskrll   R_SPARC_TLS_TPOFF64 = 79,   // Outstanding Initial Exec reloc, 64-bit
1322a6b7db3Sskrll 
1332a6b7db3Sskrll   // GOT data code transformations
1342a6b7db3Sskrll   R_SPARC_GOTDATA_HIX22 = 80,
1352a6b7db3Sskrll   R_SPARC_GOTDATA_LOX10 = 81,
1362a6b7db3Sskrll   R_SPARC_GOTDATA_OP_HIX22 = 82,
1372a6b7db3Sskrll   R_SPARC_GOTDATA_OP_LOX10 = 83,
1382a6b7db3Sskrll   R_SPARC_GOTDATA_OP = 84,
1392a6b7db3Sskrll 
1402a6b7db3Sskrll   R_SPARC_H34 = 85,           // Direct high 12 of 34 bit
1412a6b7db3Sskrll   R_SPARC_SIZE32 = 86,        // size of symbol, 32-bit
1422a6b7db3Sskrll   R_SPARC_SIZE64 = 87,        // size of symbol, 64-bit
143883529b6Schristos   R_SPARC_WDISP10 = 88,       // PC relative 10 bit shifted
1442a6b7db3Sskrll 
145883529b6Schristos   R_SPARC_JMP_IREL = 248,     // Create PLT slot to IFUNC function
146be12b8bcSchristos   R_SPARC_IRELATIVE = 249,    // Adjust indirectly by program base
147be12b8bcSchristos 
1482a6b7db3Sskrll   // GNU vtable garbage collection extensions.
1492a6b7db3Sskrll   R_SPARC_GNU_VTINHERIT = 250,
1502a6b7db3Sskrll   R_SPARC_GNU_VTENTRY = 251,
1512a6b7db3Sskrll 
1522a6b7db3Sskrll   R_SPARC_REV32 = 252,
1532a6b7db3Sskrll };
1542a6b7db3Sskrll 
1552a6b7db3Sskrll // e_flags values defined for sparc
1562a6b7db3Sskrll enum
1572a6b7db3Sskrll {
1582a6b7db3Sskrll   EF_SPARC_EXT_MASK = 0xffff00,    // reserved for vendor extensions
1592a6b7db3Sskrll   EF_SPARC_32PLUS_MASK = 0xffff00, // bits indicating V8+ type
1602a6b7db3Sskrll   EF_SPARC_32PLUS = 0x000100,      // generic V8+ features
1612a6b7db3Sskrll   EF_SPARC_SUN_US1 = 0x000200,     // Sun UltraSPARC-I extensions
1622a6b7db3Sskrll   EF_SPARC_HAL_R1 = 0x000400,      // HAL R1 extensions
1632a6b7db3Sskrll   EF_SPARC_SUN_US3 = 0x000800,     // Sun UltraSPARC-III extensions
1642a6b7db3Sskrll   EF_SPARC_LEDATA = 0x800000,      // little endian data
1652a6b7db3Sskrll   EF_SPARCV9_MM = 0x3,             // memory model mask
1662a6b7db3Sskrll   EF_SPARCV9_TSO = 0x0,            // total store ordering
1672a6b7db3Sskrll   EF_SPARCV9_PSO = 0x1,            // partial store ordering
1682a6b7db3Sskrll   EF_SPARCV9_RMO = 0x2,            // relaxed store ordering
1692a6b7db3Sskrll };
1702a6b7db3Sskrll 
1712a6b7db3Sskrll } // End namespace elfcpp.
1722a6b7db3Sskrll 
1732a6b7db3Sskrll #endif // !defined(ELFCPP_SPARC_H)
174