Back to index

cell-binutils  2.17cvs20070401
sh.h
Go to the documentation of this file.
00001 /* SH ELF support for BFD.
00002    Copyright 1998, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
00003 
00004    This file is part of BFD, the Binary File Descriptor library.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software Foundation,
00018    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00019 
00020 #ifndef _ELF_SH_H
00021 #define _ELF_SH_H
00022 
00023 /* Processor specific flags for the ELF header e_flags field.  */
00024 
00025 #define EF_SH_MACH_MASK     0x1f
00026 #define EF_SH_UNKNOWN          0 /* For backwards compatibility.  */
00027 #define EF_SH1                 1
00028 #define EF_SH2                 2
00029 #define EF_SH3                 3
00030 #define EF_SH_DSP       4
00031 #define EF_SH3_DSP      5
00032 #define EF_SH4AL_DSP    6
00033 #define EF_SH3E                8
00034 #define EF_SH4                 9
00035 #define EF_SH2E            11
00036 #define EF_SH4A                12
00037 #define EF_SH2A            13
00038 
00039 #define EF_SH4_NOFPU    16
00040 #define EF_SH4A_NOFPU          17
00041 #define EF_SH4_NOMMU_NOFPU 18
00042 #define EF_SH2A_NOFPU      19
00043 #define EF_SH3_NOMMU       20
00044 
00045 #define EF_SH2A_SH4_NOFPU  21
00046 #define EF_SH2A_SH3_NOFPU  22
00047 #define EF_SH2A_SH4        23
00048 #define EF_SH2A_SH3E       24
00049 
00050 /* This one can only mix in objects from other EF_SH5 objects.  */
00051 #define EF_SH5                10
00052 
00053 /* Define the mapping from ELF to bfd mach numbers.
00054    bfd_mach_* are defined in bfd_in2.h (generated from
00055    archures.c).  */
00056 #define EF_SH_BFD_TABLE \
00057 /* EF_SH_UNKNOWN     */ bfd_mach_sh3             , \
00058 /* EF_SH1            */ bfd_mach_sh              , \
00059 /* EF_SH2            */ bfd_mach_sh2             , \
00060 /* EF_SH3            */ bfd_mach_sh3             , \
00061 /* EF_SH_DSP         */ bfd_mach_sh_dsp   , \
00062 /* EF_SH3_DSP        */ bfd_mach_sh3_dsp  , \
00063 /* EF_SHAL_DSP              */ bfd_mach_sh4al_dsp       , \
00064 /* 7                 */ 0, \
00065 /* EF_SH3E           */ bfd_mach_sh3e     , \
00066 /* EF_SH4            */ bfd_mach_sh4             , \
00067 /* EF_SH5            */ 0, \
00068 /* EF_SH2E           */ bfd_mach_sh2e     , \
00069 /* EF_SH4A           */ bfd_mach_sh4a     , \
00070 /* EF_SH2A           */ bfd_mach_sh2a        , \
00071 /* 14, 15            */ 0, 0, \
00072 /* EF_SH4_NOFPU             */ bfd_mach_sh4_nofpu       , \
00073 /* EF_SH4A_NOFPU     */ bfd_mach_sh4a_nofpu      , \
00074 /* EF_SH4_NOMMU_NOFPU       */ bfd_mach_sh4_nommu_nofpu, \
00075 /* EF_SH2A_NOFPU     */ bfd_mach_sh2a_nofpu  , \
00076 /* EF_SH3_NOMMU             */ bfd_mach_sh3_nommu   , \
00077 /* EF_SH2A_SH4_NOFPU    */ bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu, \
00078 /* EF_SH2A_SH3_NOFPU    */ bfd_mach_sh2a_nofpu_or_sh3_nommu, \
00079 /* EF_SH2A_SH4          */ bfd_mach_sh2a_or_sh4 , \
00080 /* EF_SH2A_SH3E         */ bfd_mach_sh2a_or_sh3e
00081 
00082 /* Convert arch_sh* into EF_SH*.  */
00083 int sh_find_elf_flags (unsigned int arch_set);
00084 
00085 /* Convert bfd_mach_* into EF_SH*.  */
00086 int sh_elf_get_flags_from_mach (unsigned long mach);
00087 
00088 /* Flags for the st_other symbol field.
00089    Keep away from the STV_ visibility flags (bit 0..1).  */
00090 
00091 /* A reference to this symbol should by default add 1.  */
00092 #define STO_SH5_ISA32 (1 << 2)
00093 
00094 /* Section contains only SHmedia code (no SHcompact code).  */
00095 #define SHF_SH5_ISA32              0x40000000
00096 
00097 /* Section contains both SHmedia and SHcompact code, and possibly also
00098    constants.  */
00099 #define SHF_SH5_ISA32_MIXED 0x20000000
00100 
00101 /* If applied to a .cranges section, marks that the section is sorted by
00102    increasing cr_addr values.  */
00103 #define SHT_SH5_CR_SORTED 0x80000001
00104 
00105 /* Symbol should be handled as DataLabel (attached to global SHN_UNDEF
00106    symbols).  */
00107 #define STT_DATALABEL STT_LOPROC
00108 
00109 #include "elf/reloc-macros.h"
00110 
00111 /* Relocations.  */
00112 /* Relocations 10-32 and 128-255 are GNU extensions.
00113    25..32 and 10 are used for relaxation.  */
00114 START_RELOC_NUMBERS (elf_sh_reloc_type)
00115   RELOC_NUMBER (R_SH_NONE, 0)
00116   RELOC_NUMBER (R_SH_DIR32, 1)
00117   RELOC_NUMBER (R_SH_REL32, 2)
00118   RELOC_NUMBER (R_SH_DIR8WPN, 3)
00119   RELOC_NUMBER (R_SH_IND12W, 4)
00120   RELOC_NUMBER (R_SH_DIR8WPL, 5)
00121   RELOC_NUMBER (R_SH_DIR8WPZ, 6)
00122   RELOC_NUMBER (R_SH_DIR8BP, 7)
00123   RELOC_NUMBER (R_SH_DIR8W, 8)
00124   RELOC_NUMBER (R_SH_DIR8L, 9)
00125 
00126   RELOC_NUMBER (R_SH_LOOP_START, 10)
00127   RELOC_NUMBER (R_SH_LOOP_END, 11)
00128 
00129   FAKE_RELOC (R_SH_FIRST_INVALID_RELOC, 12)
00130   FAKE_RELOC (R_SH_LAST_INVALID_RELOC, 21)
00131 
00132   RELOC_NUMBER (R_SH_GNU_VTINHERIT, 22)
00133   RELOC_NUMBER (R_SH_GNU_VTENTRY, 23)
00134   RELOC_NUMBER (R_SH_SWITCH8, 24)
00135   RELOC_NUMBER (R_SH_SWITCH16, 25)
00136   RELOC_NUMBER (R_SH_SWITCH32, 26)
00137   RELOC_NUMBER (R_SH_USES, 27)
00138   RELOC_NUMBER (R_SH_COUNT, 28)
00139   RELOC_NUMBER (R_SH_ALIGN, 29)
00140   RELOC_NUMBER (R_SH_CODE, 30)
00141   RELOC_NUMBER (R_SH_DATA, 31)
00142   RELOC_NUMBER (R_SH_LABEL, 32)
00143 
00144   RELOC_NUMBER (R_SH_DIR16, 33)
00145   RELOC_NUMBER (R_SH_DIR8, 34)
00146   RELOC_NUMBER (R_SH_DIR8UL, 35)
00147   RELOC_NUMBER (R_SH_DIR8UW, 36)
00148   RELOC_NUMBER (R_SH_DIR8U, 37)
00149   RELOC_NUMBER (R_SH_DIR8SW, 38)
00150   RELOC_NUMBER (R_SH_DIR8S, 39)
00151   RELOC_NUMBER (R_SH_DIR4UL, 40)
00152   RELOC_NUMBER (R_SH_DIR4UW, 41)
00153   RELOC_NUMBER (R_SH_DIR4U, 42)
00154   RELOC_NUMBER (R_SH_PSHA, 43)
00155   RELOC_NUMBER (R_SH_PSHL, 44)
00156   RELOC_NUMBER (R_SH_DIR5U, 45)
00157   RELOC_NUMBER (R_SH_DIR6U, 46)
00158   RELOC_NUMBER (R_SH_DIR6S, 47)
00159   RELOC_NUMBER (R_SH_DIR10S, 48)
00160   RELOC_NUMBER (R_SH_DIR10SW, 49)
00161   RELOC_NUMBER (R_SH_DIR10SL, 50)
00162   RELOC_NUMBER (R_SH_DIR10SQ, 51)
00163   FAKE_RELOC (R_SH_FIRST_INVALID_RELOC_2, 52)
00164   FAKE_RELOC (R_SH_LAST_INVALID_RELOC_2, 52)
00165   RELOC_NUMBER (R_SH_DIR16S, 53)
00166   FAKE_RELOC (R_SH_FIRST_INVALID_RELOC_3, 54)
00167   FAKE_RELOC (R_SH_LAST_INVALID_RELOC_3, 143)
00168   RELOC_NUMBER (R_SH_TLS_GD_32, 144)
00169   RELOC_NUMBER (R_SH_TLS_LD_32, 145)
00170   RELOC_NUMBER (R_SH_TLS_LDO_32, 146)
00171   RELOC_NUMBER (R_SH_TLS_IE_32, 147)
00172   RELOC_NUMBER (R_SH_TLS_LE_32, 148)
00173   RELOC_NUMBER (R_SH_TLS_DTPMOD32, 149)
00174   RELOC_NUMBER (R_SH_TLS_DTPOFF32, 150)
00175   RELOC_NUMBER (R_SH_TLS_TPOFF32, 151)
00176   FAKE_RELOC (R_SH_FIRST_INVALID_RELOC_4, 152)
00177   FAKE_RELOC (R_SH_LAST_INVALID_RELOC_4, 159)
00178   RELOC_NUMBER (R_SH_GOT32, 160)
00179   RELOC_NUMBER (R_SH_PLT32, 161)
00180   RELOC_NUMBER (R_SH_COPY, 162)
00181   RELOC_NUMBER (R_SH_GLOB_DAT, 163)
00182   RELOC_NUMBER (R_SH_JMP_SLOT, 164)
00183   RELOC_NUMBER (R_SH_RELATIVE, 165)
00184   RELOC_NUMBER (R_SH_GOTOFF, 166)
00185   RELOC_NUMBER (R_SH_GOTPC, 167)
00186   RELOC_NUMBER (R_SH_GOTPLT32, 168)
00187   RELOC_NUMBER (R_SH_GOT_LOW16, 169)
00188   RELOC_NUMBER (R_SH_GOT_MEDLOW16, 170)
00189   RELOC_NUMBER (R_SH_GOT_MEDHI16, 171)
00190   RELOC_NUMBER (R_SH_GOT_HI16, 172)
00191   RELOC_NUMBER (R_SH_GOTPLT_LOW16, 173)
00192   RELOC_NUMBER (R_SH_GOTPLT_MEDLOW16, 174)
00193   RELOC_NUMBER (R_SH_GOTPLT_MEDHI16, 175)
00194   RELOC_NUMBER (R_SH_GOTPLT_HI16, 176)
00195   RELOC_NUMBER (R_SH_PLT_LOW16, 177)
00196   RELOC_NUMBER (R_SH_PLT_MEDLOW16, 178)
00197   RELOC_NUMBER (R_SH_PLT_MEDHI16, 179)
00198   RELOC_NUMBER (R_SH_PLT_HI16, 180)
00199   RELOC_NUMBER (R_SH_GOTOFF_LOW16, 181)
00200   RELOC_NUMBER (R_SH_GOTOFF_MEDLOW16, 182)
00201   RELOC_NUMBER (R_SH_GOTOFF_MEDHI16, 183)
00202   RELOC_NUMBER (R_SH_GOTOFF_HI16, 184)
00203   RELOC_NUMBER (R_SH_GOTPC_LOW16, 185)
00204   RELOC_NUMBER (R_SH_GOTPC_MEDLOW16, 186)
00205   RELOC_NUMBER (R_SH_GOTPC_MEDHI16, 187)
00206   RELOC_NUMBER (R_SH_GOTPC_HI16, 188)
00207   RELOC_NUMBER (R_SH_GOT10BY4, 189)
00208   RELOC_NUMBER (R_SH_GOTPLT10BY4, 190)
00209   RELOC_NUMBER (R_SH_GOT10BY8, 191)
00210   RELOC_NUMBER (R_SH_GOTPLT10BY8, 192)
00211   RELOC_NUMBER (R_SH_COPY64, 193)
00212   RELOC_NUMBER (R_SH_GLOB_DAT64, 194)
00213   RELOC_NUMBER (R_SH_JMP_SLOT64, 195)
00214   RELOC_NUMBER (R_SH_RELATIVE64, 196)
00215   FAKE_RELOC (R_SH_FIRST_INVALID_RELOC_5, 197)
00216   FAKE_RELOC (R_SH_LAST_INVALID_RELOC_5, 241)
00217   RELOC_NUMBER (R_SH_SHMEDIA_CODE, 242)
00218   RELOC_NUMBER (R_SH_PT_16, 243)
00219   RELOC_NUMBER (R_SH_IMMS16, 244)
00220   RELOC_NUMBER (R_SH_IMMU16, 245)
00221   RELOC_NUMBER (R_SH_IMM_LOW16, 246)
00222   RELOC_NUMBER (R_SH_IMM_LOW16_PCREL, 247)
00223   RELOC_NUMBER (R_SH_IMM_MEDLOW16, 248)
00224   RELOC_NUMBER (R_SH_IMM_MEDLOW16_PCREL, 249)
00225   RELOC_NUMBER (R_SH_IMM_MEDHI16, 250)
00226   RELOC_NUMBER (R_SH_IMM_MEDHI16_PCREL, 251)
00227   RELOC_NUMBER (R_SH_IMM_HI16, 252)
00228   RELOC_NUMBER (R_SH_IMM_HI16_PCREL, 253)
00229   RELOC_NUMBER (R_SH_64, 254)
00230   RELOC_NUMBER (R_SH_64_PCREL, 255)
00231 END_RELOC_NUMBERS (R_SH_max)
00232 
00233 #endif