Back to index

cell-binutils  2.17cvs20070401
sparc.h
Go to the documentation of this file.
00001 /* SPARC ELF support for BFD.
00002    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2003
00003    Free Software Foundation, Inc.
00004    By Doug Evans, Cygnus Support, <dje@cygnus.com>.
00005 
00006 This file is part of BFD, the Binary File Descriptor library.
00007 
00008 This program is free software; you can redistribute it and/or modify
00009 it under the terms of the GNU General Public License as published by
00010 the Free Software Foundation; either version 2 of the License, or
00011 (at your option) any later version.
00012 
00013 This program is distributed in the hope that it will be useful,
00014 but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 GNU General Public License for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with this program; if not, write to the Free Software
00020 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00021 
00022 #ifndef _ELF_SPARC_H
00023 #define _ELF_SPARC_H
00024 
00025 /* Processor specific flags for the ELF header e_flags field.  */
00026 
00027 /* These are defined by Sun.  */
00028 
00029 #define EF_SPARC_32PLUS_MASK       0xffff00      /* bits indicating V8+ type */
00030 #define EF_SPARC_32PLUS            0x000100      /* generic V8+ features */
00031 #define EF_SPARC_SUN_US1    0x000200      /* Sun UltraSPARC1 extensions */
00032 #define EF_SPARC_HAL_R1            0x000400      /* HAL R1 extensions */
00033 #define EF_SPARC_SUN_US3    0x000800      /* Sun UltraSPARCIII extensions */
00034 
00035 #define EF_SPARC_LEDATA         0x800000  /* little endian data */
00036 
00037 /* This name is used in the V9 ABI.  */
00038 #define EF_SPARC_EXT_MASK   0xffff00      /* reserved for vendor extensions */
00039 
00040 /* V9 memory models */
00041 #define EF_SPARCV9_MM              0x3           /* memory model mask */
00042 #define EF_SPARCV9_TSO             0x0           /* total store ordering */
00043 #define EF_SPARCV9_PSO             0x1           /* partial store ordering */
00044 #define EF_SPARCV9_RMO             0x2           /* relaxed store ordering */
00045 
00046 /* Section indices.  */
00047 
00048 #define SHN_BEFORE          0xff00        /* used with SHF_ORDERED */
00049 #define SHN_AFTER           0xff01        /* used with SHF_ORDERED */
00050 
00051 /* Section flags.  */
00052 
00053 #define SHF_EXCLUDE         0x80000000    /* exclude from linking */
00054 #define SHF_ORDERED         0x40000000    /* treat sh_link,sh_info specially */
00055 
00056 /* Symbol types.  */
00057 
00058 #define STT_REGISTER        13            /* global reg reserved to app. */
00059 
00060 #include "elf/reloc-macros.h"
00061 
00062 /* Relocation types.  */
00063 START_RELOC_NUMBERS (elf_sparc_reloc_type)
00064   RELOC_NUMBER (R_SPARC_NONE, 0)
00065   RELOC_NUMBER (R_SPARC_8, 1)
00066   RELOC_NUMBER (R_SPARC_16, 2)
00067   RELOC_NUMBER (R_SPARC_32, 3)
00068   RELOC_NUMBER (R_SPARC_DISP8, 4)
00069   RELOC_NUMBER (R_SPARC_DISP16, 5)
00070   RELOC_NUMBER (R_SPARC_DISP32, 6)
00071   RELOC_NUMBER (R_SPARC_WDISP30, 7)
00072   RELOC_NUMBER (R_SPARC_WDISP22, 8)
00073   RELOC_NUMBER (R_SPARC_HI22, 9)
00074   RELOC_NUMBER (R_SPARC_22, 10)
00075   RELOC_NUMBER (R_SPARC_13, 11)
00076   RELOC_NUMBER (R_SPARC_LO10, 12)
00077   RELOC_NUMBER (R_SPARC_GOT10, 13)
00078   RELOC_NUMBER (R_SPARC_GOT13, 14)
00079   RELOC_NUMBER (R_SPARC_GOT22, 15)
00080   RELOC_NUMBER (R_SPARC_PC10, 16)
00081   RELOC_NUMBER (R_SPARC_PC22, 17)
00082   RELOC_NUMBER (R_SPARC_WPLT30, 18)
00083   RELOC_NUMBER (R_SPARC_COPY, 19)
00084   RELOC_NUMBER (R_SPARC_GLOB_DAT, 20)
00085   RELOC_NUMBER (R_SPARC_JMP_SLOT, 21)
00086   RELOC_NUMBER (R_SPARC_RELATIVE, 22)
00087   RELOC_NUMBER (R_SPARC_UA32, 23)
00088 
00089   /* ??? These 6 relocs are new but not currently used.  For binary
00090      compatibility in the sparc64-elf toolchain, we leave them out.
00091      A non-binary upward compatible change is expected for sparc64-elf.  */
00092 #ifndef SPARC64_OLD_RELOCS
00093   /* ??? New relocs on the UltraSPARC.  Not sure what they're for yet.  */
00094   RELOC_NUMBER (R_SPARC_PLT32, 24)
00095   RELOC_NUMBER (R_SPARC_HIPLT22, 25)
00096   RELOC_NUMBER (R_SPARC_LOPLT10, 26)
00097   RELOC_NUMBER (R_SPARC_PCPLT32, 27)
00098   RELOC_NUMBER (R_SPARC_PCPLT22, 28)
00099   RELOC_NUMBER (R_SPARC_PCPLT10, 29)
00100 #endif
00101 
00102   /* v9 relocs */
00103   RELOC_NUMBER (R_SPARC_10, 30)
00104   RELOC_NUMBER (R_SPARC_11, 31)
00105   RELOC_NUMBER (R_SPARC_64, 32)
00106   RELOC_NUMBER (R_SPARC_OLO10, 33)
00107   RELOC_NUMBER (R_SPARC_HH22, 34)
00108   RELOC_NUMBER (R_SPARC_HM10, 35)
00109   RELOC_NUMBER (R_SPARC_LM22, 36)
00110   RELOC_NUMBER (R_SPARC_PC_HH22, 37)
00111   RELOC_NUMBER (R_SPARC_PC_HM10, 38)
00112   RELOC_NUMBER (R_SPARC_PC_LM22, 39)
00113   RELOC_NUMBER (R_SPARC_WDISP16, 40)
00114   RELOC_NUMBER (R_SPARC_WDISP19, 41)
00115   RELOC_NUMBER (R_SPARC_UNUSED_42, 42)
00116   RELOC_NUMBER (R_SPARC_7, 43)
00117   RELOC_NUMBER (R_SPARC_5, 44)
00118   RELOC_NUMBER (R_SPARC_6, 45)
00119   RELOC_NUMBER (R_SPARC_DISP64, 46)
00120   RELOC_NUMBER (R_SPARC_PLT64, 47)
00121   RELOC_NUMBER (R_SPARC_HIX22, 48)
00122   RELOC_NUMBER (R_SPARC_LOX10, 49)
00123   RELOC_NUMBER (R_SPARC_H44, 50)
00124   RELOC_NUMBER (R_SPARC_M44, 51)
00125   RELOC_NUMBER (R_SPARC_L44, 52)
00126   RELOC_NUMBER (R_SPARC_REGISTER, 53)
00127   RELOC_NUMBER (R_SPARC_UA64, 54)
00128   RELOC_NUMBER (R_SPARC_UA16, 55)
00129 
00130   RELOC_NUMBER (R_SPARC_TLS_GD_HI22, 56)
00131   RELOC_NUMBER (R_SPARC_TLS_GD_LO10, 57)
00132   RELOC_NUMBER (R_SPARC_TLS_GD_ADD, 58)
00133   RELOC_NUMBER (R_SPARC_TLS_GD_CALL, 59)
00134   RELOC_NUMBER (R_SPARC_TLS_LDM_HI22, 60)
00135   RELOC_NUMBER (R_SPARC_TLS_LDM_LO10, 61)
00136   RELOC_NUMBER (R_SPARC_TLS_LDM_ADD, 62)
00137   RELOC_NUMBER (R_SPARC_TLS_LDM_CALL, 63)
00138   RELOC_NUMBER (R_SPARC_TLS_LDO_HIX22, 64)
00139   RELOC_NUMBER (R_SPARC_TLS_LDO_LOX10, 65)
00140   RELOC_NUMBER (R_SPARC_TLS_LDO_ADD, 66)
00141   RELOC_NUMBER (R_SPARC_TLS_IE_HI22, 67)
00142   RELOC_NUMBER (R_SPARC_TLS_IE_LO10, 68)
00143   RELOC_NUMBER (R_SPARC_TLS_IE_LD, 69)
00144   RELOC_NUMBER (R_SPARC_TLS_IE_LDX, 70)
00145   RELOC_NUMBER (R_SPARC_TLS_IE_ADD, 71)
00146   RELOC_NUMBER (R_SPARC_TLS_LE_HIX22, 72)
00147   RELOC_NUMBER (R_SPARC_TLS_LE_LOX10, 73)
00148   RELOC_NUMBER (R_SPARC_TLS_DTPMOD32, 74)
00149   RELOC_NUMBER (R_SPARC_TLS_DTPMOD64, 75)
00150   RELOC_NUMBER (R_SPARC_TLS_DTPOFF32, 76)
00151   RELOC_NUMBER (R_SPARC_TLS_DTPOFF64, 77)
00152   RELOC_NUMBER (R_SPARC_TLS_TPOFF32, 78)
00153   RELOC_NUMBER (R_SPARC_TLS_TPOFF64, 79)
00154   
00155   EMPTY_RELOC  (R_SPARC_max_std)
00156 
00157   RELOC_NUMBER (R_SPARC_GNU_VTINHERIT, 250)
00158   RELOC_NUMBER (R_SPARC_GNU_VTENTRY, 251)
00159   RELOC_NUMBER (R_SPARC_REV32, 252)
00160 
00161 END_RELOC_NUMBERS (R_SPARC_max)
00162 
00163 /* Relocation macros.  */
00164 
00165 #define ELF64_R_TYPE_DATA(info) \
00166   (((bfd_signed_vma)(ELF64_R_TYPE(info) >> 8) ^ 0x800000) - 0x800000)
00167 #define ELF64_R_TYPE_ID(info) \
00168   ((info) & 0xff)
00169 #define ELF64_R_TYPE_INFO(data, type) \
00170   (((bfd_vma) ((data) & 0xffffff) << 8) | (bfd_vma) (type))
00171 
00172 /* Values for Elf64_Dyn.d_tag.  */
00173 
00174 #define DT_SPARC_REGISTER   0x70000001
00175 
00176 #endif /* _ELF_SPARC_H */