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