1 /* SPARC ELF support for BFD. 2 Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003 3 Free Software Foundation, Inc. 4 By Doug Evans, Cygnus Support, <dje@cygnus.com>. 5 6 This file is part of BFD, the Binary File Descriptor library. 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 21 22 #ifndef _ELF_SPARC_H 23 #define _ELF_SPARC_H 24 25 /* Processor specific flags for the ELF header e_flags field. */ 26 27 /* These are defined by Sun. */ 28 29 #define EF_SPARC_32PLUS_MASK 0xffff00 /* bits indicating V8+ type */ 30 #define EF_SPARC_32PLUS 0x000100 /* generic V8+ features */ 31 #define EF_SPARC_SUN_US1 0x000200 /* Sun UltraSPARC1 extensions */ 32 #define EF_SPARC_HAL_R1 0x000400 /* HAL R1 extensions */ 33 #define EF_SPARC_SUN_US3 0x000800 /* Sun UltraSPARCIII extensions */ 34 35 #define EF_SPARC_LEDATA 0x800000 /* little endian data */ 36 37 /* This name is used in the V9 ABI. */ 38 #define EF_SPARC_EXT_MASK 0xffff00 /* reserved for vendor extensions */ 39 40 /* V9 memory models */ 41 #define EF_SPARCV9_MM 0x3 /* memory model mask */ 42 #define EF_SPARCV9_TSO 0x0 /* total store ordering */ 43 #define EF_SPARCV9_PSO 0x1 /* partial store ordering */ 44 #define EF_SPARCV9_RMO 0x2 /* relaxed store ordering */ 45 46 /* Section indices. */ 47 48 #define SHN_BEFORE 0xff00 /* used with SHF_ORDERED */ 49 #define SHN_AFTER 0xff01 /* used with SHF_ORDERED */ 50 51 /* Section flags. */ 52 53 #define SHF_EXCLUDE 0x80000000 /* exclude from linking */ 54 #define SHF_ORDERED 0x40000000 /* treat sh_link,sh_info specially */ 55 56 /* Symbol types. */ 57 58 #define STT_REGISTER 13 /* global reg reserved to app. */ 59 60 #include "elf/reloc-macros.h" 61 62 /* Relocation types. */ 63 START_RELOC_NUMBERS (elf_sparc_reloc_type) 64 RELOC_NUMBER (R_SPARC_NONE, 0) 65 RELOC_NUMBER (R_SPARC_8, 1) 66 RELOC_NUMBER (R_SPARC_16, 2) 67 RELOC_NUMBER (R_SPARC_32, 3) 68 RELOC_NUMBER (R_SPARC_DISP8, 4) 69 RELOC_NUMBER (R_SPARC_DISP16, 5) 70 RELOC_NUMBER (R_SPARC_DISP32, 6) 71 RELOC_NUMBER (R_SPARC_WDISP30, 7) 72 RELOC_NUMBER (R_SPARC_WDISP22, 8) 73 RELOC_NUMBER (R_SPARC_HI22, 9) 74 RELOC_NUMBER (R_SPARC_22, 10) 75 RELOC_NUMBER (R_SPARC_13, 11) 76 RELOC_NUMBER (R_SPARC_LO10, 12) 77 RELOC_NUMBER (R_SPARC_GOT10, 13) 78 RELOC_NUMBER (R_SPARC_GOT13, 14) 79 RELOC_NUMBER (R_SPARC_GOT22, 15) 80 RELOC_NUMBER (R_SPARC_PC10, 16) 81 RELOC_NUMBER (R_SPARC_PC22, 17) 82 RELOC_NUMBER (R_SPARC_WPLT30, 18) 83 RELOC_NUMBER (R_SPARC_COPY, 19) 84 RELOC_NUMBER (R_SPARC_GLOB_DAT, 20) 85 RELOC_NUMBER (R_SPARC_JMP_SLOT, 21) 86 RELOC_NUMBER (R_SPARC_RELATIVE, 22) 87 RELOC_NUMBER (R_SPARC_UA32, 23) 88 89 /* ??? These 6 relocs are new but not currently used. For binary 90 compatibility in the sparc64-elf toolchain, we leave them out. 91 A non-binary upward compatible change is expected for sparc64-elf. */ 92 #ifndef SPARC64_OLD_RELOCS 93 /* ??? New relocs on the UltraSPARC. Not sure what they're for yet. */ 94 RELOC_NUMBER (R_SPARC_PLT32, 24) 95 RELOC_NUMBER (R_SPARC_HIPLT22, 25) 96 RELOC_NUMBER (R_SPARC_LOPLT10, 26) 97 RELOC_NUMBER (R_SPARC_PCPLT32, 27) 98 RELOC_NUMBER (R_SPARC_PCPLT22, 28) 99 RELOC_NUMBER (R_SPARC_PCPLT10, 29) 100 #endif 101 102 /* v9 relocs */ 103 RELOC_NUMBER (R_SPARC_10, 30) 104 RELOC_NUMBER (R_SPARC_11, 31) 105 RELOC_NUMBER (R_SPARC_64, 32) 106 RELOC_NUMBER (R_SPARC_OLO10, 33) 107 RELOC_NUMBER (R_SPARC_HH22, 34) 108 RELOC_NUMBER (R_SPARC_HM10, 35) 109 RELOC_NUMBER (R_SPARC_LM22, 36) 110 RELOC_NUMBER (R_SPARC_PC_HH22, 37) 111 RELOC_NUMBER (R_SPARC_PC_HM10, 38) 112 RELOC_NUMBER (R_SPARC_PC_LM22, 39) 113 RELOC_NUMBER (R_SPARC_WDISP16, 40) 114 RELOC_NUMBER (R_SPARC_WDISP19, 41) 115 RELOC_NUMBER (R_SPARC_UNUSED_42, 42) 116 RELOC_NUMBER (R_SPARC_7, 43) 117 RELOC_NUMBER (R_SPARC_5, 44) 118 RELOC_NUMBER (R_SPARC_6, 45) 119 RELOC_NUMBER (R_SPARC_DISP64, 46) 120 RELOC_NUMBER (R_SPARC_PLT64, 47) 121 RELOC_NUMBER (R_SPARC_HIX22, 48) 122 RELOC_NUMBER (R_SPARC_LOX10, 49) 123 RELOC_NUMBER (R_SPARC_H44, 50) 124 RELOC_NUMBER (R_SPARC_M44, 51) 125 RELOC_NUMBER (R_SPARC_L44, 52) 126 RELOC_NUMBER (R_SPARC_REGISTER, 53) 127 RELOC_NUMBER (R_SPARC_UA64, 54) 128 RELOC_NUMBER (R_SPARC_UA16, 55) 129 130 RELOC_NUMBER (R_SPARC_TLS_GD_HI22, 56) 131 RELOC_NUMBER (R_SPARC_TLS_GD_LO10, 57) 132 RELOC_NUMBER (R_SPARC_TLS_GD_ADD, 58) 133 RELOC_NUMBER (R_SPARC_TLS_GD_CALL, 59) 134 RELOC_NUMBER (R_SPARC_TLS_LDM_HI22, 60) 135 RELOC_NUMBER (R_SPARC_TLS_LDM_LO10, 61) 136 RELOC_NUMBER (R_SPARC_TLS_LDM_ADD, 62) 137 RELOC_NUMBER (R_SPARC_TLS_LDM_CALL, 63) 138 RELOC_NUMBER (R_SPARC_TLS_LDO_HIX22, 64) 139 RELOC_NUMBER (R_SPARC_TLS_LDO_LOX10, 65) 140 RELOC_NUMBER (R_SPARC_TLS_LDO_ADD, 66) 141 RELOC_NUMBER (R_SPARC_TLS_IE_HI22, 67) 142 RELOC_NUMBER (R_SPARC_TLS_IE_LO10, 68) 143 RELOC_NUMBER (R_SPARC_TLS_IE_LD, 69) 144 RELOC_NUMBER (R_SPARC_TLS_IE_LDX, 70) 145 RELOC_NUMBER (R_SPARC_TLS_IE_ADD, 71) 146 RELOC_NUMBER (R_SPARC_TLS_LE_HIX22, 72) 147 RELOC_NUMBER (R_SPARC_TLS_LE_LOX10, 73) 148 RELOC_NUMBER (R_SPARC_TLS_DTPMOD32, 74) 149 RELOC_NUMBER (R_SPARC_TLS_DTPMOD64, 75) 150 RELOC_NUMBER (R_SPARC_TLS_DTPOFF32, 76) 151 RELOC_NUMBER (R_SPARC_TLS_DTPOFF64, 77) 152 RELOC_NUMBER (R_SPARC_TLS_TPOFF32, 78) 153 RELOC_NUMBER (R_SPARC_TLS_TPOFF64, 79) 154 155 EMPTY_RELOC (R_SPARC_max_std) 156 157 RELOC_NUMBER (R_SPARC_GNU_VTINHERIT, 250) 158 RELOC_NUMBER (R_SPARC_GNU_VTENTRY, 251) 159 RELOC_NUMBER (R_SPARC_REV32, 252) 160 161 END_RELOC_NUMBERS (R_SPARC_max) 162 163 /* Relocation macros. */ 164 165 #define ELF64_R_TYPE_DATA(info) \ 166 (((bfd_signed_vma)(ELF64_R_TYPE(info) >> 8) ^ 0x800000) - 0x800000) 167 #define ELF64_R_TYPE_ID(info) \ 168 ((info) & 0xff) 169 #define ELF64_R_TYPE_INFO(data, type) \ 170 (((bfd_vma) ((data) & 0xffffff) << 8) | (bfd_vma) (type)) 171 172 /* Values for Elf64_Dyn.d_tag. */ 173 174 #define DT_SPARC_REGISTER 0x70000001 175 176 #endif /* _ELF_SPARC_H */ 177