Back to index

cell-binutils  2.17cvs20070401
arm.h
Go to the documentation of this file.
00001 /* ARM ELF support for BFD.
00002    Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
00003    Free Software Foundation, Inc.
00004 
00005    This file is part of BFD, the Binary File Descriptor library.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software Foundation,
00019    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 #ifndef _ELF_ARM_H
00022 #define _ELF_ARM_H
00023 
00024 #include "elf/reloc-macros.h"
00025 
00026 /* Processor specific flags for the ELF header e_flags field.  */
00027 #define EF_ARM_RELEXEC     0x01
00028 #define EF_ARM_HASENTRY    0x02
00029 #define EF_ARM_INTERWORK   0x04
00030 #define EF_ARM_APCS_26     0x08
00031 #define EF_ARM_APCS_FLOAT  0x10
00032 #define EF_ARM_PIC         0x20
00033 #define EF_ARM_ALIGN8          0x40              /* 8-bit structure alignment is in use.  */
00034 #define EF_ARM_NEW_ABI     0x80
00035 #define EF_ARM_OLD_ABI     0x100
00036 #define EF_ARM_SOFT_FLOAT  0x200
00037 #define EF_ARM_VFP_FLOAT   0x400
00038 #define EF_ARM_MAVERICK_FLOAT 0x800
00039 
00040 /* Frame unwind information */
00041 #define PT_ARM_EXIDX (PT_LOPROC + 1)
00042 
00043 /* Other constants defined in the ARM ELF spec. version B-01.  */
00044 #define EF_ARM_SYMSARESORTED 0x04  /* NB conflicts with EF_INTERWORK */
00045 #define EF_ARM_DYNSYMSUSESEGIDX 0x08      /* NB conflicts with EF_APCS26 */
00046 #define EF_ARM_MAPSYMSFIRST 0x10   /* NB conflicts with EF_APCS_FLOAT */
00047 #define EF_ARM_EABIMASK      0xFF000000
00048 
00049 /* Constants defined in AAELF.  */
00050 #define EF_ARM_BE8       0x00800000
00051 #define EF_ARM_LE8       0x00400000
00052 
00053 #define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
00054 #define EF_ARM_EABI_UNKNOWN  0x00000000
00055 #define EF_ARM_EABI_VER1     0x01000000
00056 #define EF_ARM_EABI_VER2     0x02000000
00057 #define EF_ARM_EABI_VER3     0x03000000
00058 #define EF_ARM_EABI_VER4     0x04000000
00059 #define EF_ARM_EABI_VER5     0x05000000
00060 
00061 /* Local aliases for some flags to match names used by COFF port.  */
00062 #define F_INTERWORK     EF_ARM_INTERWORK
00063 #define F_APCS26        EF_ARM_APCS_26
00064 #define F_APCS_FLOAT    EF_ARM_APCS_FLOAT
00065 #define F_PIC              EF_ARM_PIC
00066 #define F_SOFT_FLOAT    EF_ARM_SOFT_FLOAT
00067 #define F_VFP_FLOAT     EF_ARM_VFP_FLOAT
00068 
00069 /* Additional symbol types for Thumb.  */
00070 #define STT_ARM_TFUNC      STT_LOPROC   /* A Thumb function.  */
00071 #define STT_ARM_16BIT      STT_HIPROC   /* A Thumb label.  */
00072 
00073 /* Additional section types.  */
00074 #define SHT_ARM_EXIDX          0x70000001 /* Section holds ARM unwind info.  */
00075 #define SHT_ARM_PREEMPTMAP 0x70000002     /* Section pre-emption details.  */
00076 #define SHT_ARM_ATTRIBUTES 0x70000003     /* Section holds attributes.  */
00077 
00078 /* ARM-specific values for sh_flags.  */
00079 #define SHF_ENTRYSECT      0x10000000   /* Section contains an entry point.  */
00080 #define SHF_COMDEF         0x80000000   /* Section may be multiply defined in the input to a link step.  */
00081 
00082 /* ARM-specific program header flags.  */
00083 #define PF_ARM_SB          0x10000000   /* Segment contains the location addressed by the static base.  */
00084 #define PF_ARM_PI          0x20000000   /* Segment is position-independent.  */
00085 #define PF_ARM_ABS         0x40000000   /* Segment must be loaded at its base address.  */
00086 
00087 /* Values for the Tag_CPU_arch EABI attribute.  */
00088 #define TAG_CPU_ARCH_PRE_V4    0
00089 #define TAG_CPU_ARCH_V4                1
00090 #define TAG_CPU_ARCH_V4T       2
00091 #define TAG_CPU_ARCH_V5T       3
00092 #define TAG_CPU_ARCH_V5TE      4
00093 #define TAG_CPU_ARCH_V5TEJ     5
00094 #define TAG_CPU_ARCH_V6                6
00095 #define TAG_CPU_ARCH_V6KZ      7
00096 #define TAG_CPU_ARCH_V6T2      8
00097 #define TAG_CPU_ARCH_V6K       9
00098 #define TAG_CPU_ARCH_V7                10
00099 
00100 /* Relocation types.  */
00101 
00102 START_RELOC_NUMBERS (elf_arm_reloc_type)
00103 /* AAELF official names and numbers.  */
00104   RELOC_NUMBER (R_ARM_NONE,                 0)
00105   RELOC_NUMBER (R_ARM_PC24,                 1)   /* deprecated */
00106   RELOC_NUMBER (R_ARM_ABS32,                2)
00107   RELOC_NUMBER (R_ARM_REL32,                3)
00108   RELOC_NUMBER (R_ARM_LDR_PC_G0,            4)
00109   RELOC_NUMBER (R_ARM_ABS16,                5)
00110   RELOC_NUMBER (R_ARM_ABS12,                6)
00111   RELOC_NUMBER (R_ARM_THM_ABS5,             7)
00112   RELOC_NUMBER (R_ARM_ABS8,                 8)
00113   RELOC_NUMBER (R_ARM_SBREL32,              9)
00114   RELOC_NUMBER (R_ARM_THM_CALL,            10)
00115   RELOC_NUMBER (R_ARM_THM_PC8,             11)
00116   RELOC_NUMBER (R_ARM_BREL_ADJ,                   12)
00117   RELOC_NUMBER (R_ARM_SWI24,               13)   /* obsolete */
00118   RELOC_NUMBER (R_ARM_THM_SWI8,            14)   /* obsolete */
00119   RELOC_NUMBER (R_ARM_XPC25,               15)   /* obsolete */
00120   RELOC_NUMBER (R_ARM_THM_XPC22,           16)   /* obsolete */
00121   RELOC_NUMBER (R_ARM_TLS_DTPMOD32,        17)
00122   RELOC_NUMBER (R_ARM_TLS_DTPOFF32,        18)
00123   RELOC_NUMBER (R_ARM_TLS_TPOFF32,         19)
00124   RELOC_NUMBER (R_ARM_COPY,                20)   /* Copy symbol at runtime.  */
00125   RELOC_NUMBER (R_ARM_GLOB_DAT,            21)   /* Create GOT entry.  */
00126   RELOC_NUMBER (R_ARM_JUMP_SLOT,           22)   /* Create PLT entry.  */
00127   RELOC_NUMBER (R_ARM_RELATIVE,            23)   /* Adjust by program base.  */
00128   RELOC_NUMBER (R_ARM_GOTOFF32,            24)   /* 32 bit offset to GOT.  */
00129   RELOC_NUMBER (R_ARM_BASE_PREL,           25)   /* 32 bit PC relative offset to GOT.  */
00130   RELOC_NUMBER (R_ARM_GOT_BREL,            26)   /* 32 bit GOT entry.  */
00131   RELOC_NUMBER (R_ARM_PLT32,               27)   /* deprecated - 32 bit PLT address.  */
00132   RELOC_NUMBER (R_ARM_CALL,                28)
00133   RELOC_NUMBER (R_ARM_JUMP24,              29)
00134   RELOC_NUMBER (R_ARM_THM_JUMP24,          30)
00135   RELOC_NUMBER (R_ARM_BASE_ABS,            31)
00136   RELOC_NUMBER (R_ARM_ALU_PCREL7_0,        32)   /* obsolete */
00137   RELOC_NUMBER (R_ARM_ALU_PCREL15_8,       33)   /* obsolete */
00138   RELOC_NUMBER (R_ARM_ALU_PCREL23_15,      34)   /* obsolete */
00139   RELOC_NUMBER (R_ARM_LDR_SBREL_11_0,      35)   /* deprecated, should have _NC suffix */
00140   RELOC_NUMBER (R_ARM_ALU_SBREL_19_12,     36)   /* deprecated, should have _NC suffix */
00141   RELOC_NUMBER (R_ARM_ALU_SBREL_27_20,     37)   /* deprecated, should have _CK suffix */
00142   RELOC_NUMBER (R_ARM_TARGET1,             38)
00143   RELOC_NUMBER (R_ARM_SBREL31,             39)   /* deprecated */
00144   RELOC_NUMBER (R_ARM_V4BX,                40)
00145   RELOC_NUMBER (R_ARM_TARGET2,                    41)
00146   RELOC_NUMBER (R_ARM_PREL31,                     42)
00147   RELOC_NUMBER (R_ARM_MOVW_ABS_NC,         43)
00148   RELOC_NUMBER (R_ARM_MOVT_ABS,            44)
00149   RELOC_NUMBER (R_ARM_MOVW_PREL_NC,        45)
00150   RELOC_NUMBER (R_ARM_MOVT_PREL,           46)
00151   RELOC_NUMBER (R_ARM_THM_MOVW_ABS_NC,     47)
00152   RELOC_NUMBER (R_ARM_THM_MOVT_ABS,        48)
00153   RELOC_NUMBER (R_ARM_THM_MOVW_PREL_NC,    49)
00154   RELOC_NUMBER (R_ARM_THM_MOVT_PREL,       50)
00155   RELOC_NUMBER (R_ARM_THM_JUMP19,          51)
00156   RELOC_NUMBER (R_ARM_THM_JUMP6,           52)
00157   RELOC_NUMBER (R_ARM_THM_ALU_PREL_11_0, 53)
00158   RELOC_NUMBER (R_ARM_THM_PC12,            54)
00159   RELOC_NUMBER (R_ARM_ABS32_NOI,           55)
00160   RELOC_NUMBER (R_ARM_REL32_NOI,           56)
00161   RELOC_NUMBER (R_ARM_ALU_PC_G0_NC,      57)
00162   RELOC_NUMBER (R_ARM_ALU_PC_G0,         58)
00163   RELOC_NUMBER (R_ARM_ALU_PC_G1_NC,      59)
00164   RELOC_NUMBER (R_ARM_ALU_PC_G1,         60)
00165   RELOC_NUMBER (R_ARM_ALU_PC_G2,         61)
00166   RELOC_NUMBER (R_ARM_LDR_PC_G1,         62)
00167   RELOC_NUMBER (R_ARM_LDR_PC_G2,         63)
00168   RELOC_NUMBER (R_ARM_LDRS_PC_G0,        64)
00169   RELOC_NUMBER (R_ARM_LDRS_PC_G1,        65)
00170   RELOC_NUMBER (R_ARM_LDRS_PC_G2,        66)
00171   RELOC_NUMBER (R_ARM_LDC_PC_G0,         67)
00172   RELOC_NUMBER (R_ARM_LDC_PC_G1,         68)
00173   RELOC_NUMBER (R_ARM_LDC_PC_G2,         69)
00174   RELOC_NUMBER (R_ARM_ALU_SB_G0_NC,      70)
00175   RELOC_NUMBER (R_ARM_ALU_SB_G0,         71)
00176   RELOC_NUMBER (R_ARM_ALU_SB_G1_NC,      72)
00177   RELOC_NUMBER (R_ARM_ALU_SB_G1,         73)
00178   RELOC_NUMBER (R_ARM_ALU_SB_G2,         74)
00179   RELOC_NUMBER (R_ARM_LDR_SB_G0,         75)
00180   RELOC_NUMBER (R_ARM_LDR_SB_G1,         76)
00181   RELOC_NUMBER (R_ARM_LDR_SB_G2,         77)
00182   RELOC_NUMBER (R_ARM_LDRS_SB_G0,        78)
00183   RELOC_NUMBER (R_ARM_LDRS_SB_G1,        79)
00184   RELOC_NUMBER (R_ARM_LDRS_SB_G2,        80)
00185   RELOC_NUMBER (R_ARM_LDC_SB_G0,         81)
00186   RELOC_NUMBER (R_ARM_LDC_SB_G1,         82)
00187   RELOC_NUMBER (R_ARM_LDC_SB_G2,         83)
00188   RELOC_NUMBER (R_ARM_MOVW_BREL_NC,        84)
00189   RELOC_NUMBER (R_ARM_MOVT_BREL,           85)
00190   RELOC_NUMBER (R_ARM_MOVW_BREL,           86)
00191   RELOC_NUMBER (R_ARM_THM_MOVW_BREL_NC,    87)
00192   RELOC_NUMBER (R_ARM_THM_MOVT_BREL,       88)
00193   RELOC_NUMBER (R_ARM_THM_MOVW_BREL,       89)
00194   /* 90-93 unallocated */
00195   RELOC_NUMBER (R_ARM_PLT32_ABS,           94)
00196   RELOC_NUMBER (R_ARM_GOT_ABS,                    95)
00197   RELOC_NUMBER (R_ARM_GOT_PREL,                   96)
00198   RELOC_NUMBER (R_ARM_GOT_BREL12,          97)
00199   RELOC_NUMBER (R_ARM_GOTOFF12,                   98)
00200   RELOC_NUMBER (R_ARM_GOTRELAX,                   99)
00201   RELOC_NUMBER (R_ARM_GNU_VTENTRY,        100)   /* deprecated - old C++ abi */
00202   RELOC_NUMBER (R_ARM_GNU_VTINHERIT,      101)   /* deprecated - old C++ abi */
00203   RELOC_NUMBER (R_ARM_THM_JUMP11,         102)
00204   RELOC_NUMBER (R_ARM_THM_JUMP8,          103)
00205   RELOC_NUMBER (R_ARM_TLS_GD32,           104)
00206   RELOC_NUMBER (R_ARM_TLS_LDM32,          105)
00207   RELOC_NUMBER (R_ARM_TLS_LDO32,          106)
00208   RELOC_NUMBER (R_ARM_TLS_IE32,           107)
00209   RELOC_NUMBER (R_ARM_TLS_LE32,           108)
00210   RELOC_NUMBER (R_ARM_TLS_LDO12,          109)
00211   RELOC_NUMBER (R_ARM_TLS_LE12,           110)
00212   RELOC_NUMBER (R_ARM_TLS_IE12GP,         111)
00213   /* 112 - 127 private range */
00214   RELOC_NUMBER (R_ARM_ME_TOO,              128)   /* obsolete */
00215 
00216   /* Extensions?  R=read-only?  */
00217   RELOC_NUMBER (R_ARM_RXPC25,             249)
00218   RELOC_NUMBER (R_ARM_RSBREL32,           250)
00219   RELOC_NUMBER (R_ARM_THM_RPC22,          251)
00220   RELOC_NUMBER (R_ARM_RREL32,             252)
00221   RELOC_NUMBER (R_ARM_RABS32,             253)
00222   RELOC_NUMBER (R_ARM_RPC24,              254)
00223   RELOC_NUMBER (R_ARM_RBASE,              255)
00224 
00225   /* Unofficial names for some of the relocs.  */
00226   FAKE_RELOC (R_ARM_GOTOFF,             R_ARM_GOTOFF32)   /* 32 bit offset to GOT.  */
00227   FAKE_RELOC (R_ARM_THM_PC22,           R_ARM_THM_CALL)
00228   FAKE_RELOC (R_ARM_THM_PC11,           R_ARM_THM_JUMP11)
00229   FAKE_RELOC (R_ARM_THM_PC9,            R_ARM_THM_JUMP8)
00230 
00231   /* Relocs with both a different name, and (apparently) different meaning in
00232      GNU usage.  */
00233   FAKE_RELOC (R_ARM_GOTPC,              R_ARM_BASE_PREL)  /* 32 bit PC relative offset to GOT.  */
00234   FAKE_RELOC (R_ARM_GOT32,              R_ARM_GOT_BREL)   /* 32 bit GOT entry.  */
00235   FAKE_RELOC (R_ARM_ROSEGREL32,         R_ARM_SBREL31)    /* ??? */
00236   FAKE_RELOC (R_ARM_AMP_VCALL9,         R_ARM_BREL_ADJ)   /* Thumb-something.  Not used.  */
00237 END_RELOC_NUMBERS (R_ARM_max)
00238 
00239 #ifdef BFD_ARCH_SIZE
00240 /* Routines for manipulating EABI object attributes.  */
00241 void elf32_arm_add_eabi_attr_int (bfd *, int, unsigned int);
00242 void elf32_arm_add_eabi_attr_string (bfd *, int, const char *);
00243 void elf32_arm_add_eabi_attr_compat (bfd *, unsigned int, const char *);
00244 int elf32_arm_get_eabi_attr_int (bfd *, int);
00245 
00246 void elf32_arm_set_eabi_attr_contents (bfd *, bfd_byte *, bfd_vma);
00247 bfd_vma elf32_arm_eabi_attr_size (bfd *);
00248 
00249 enum
00250 {
00251   Tag_NULL,
00252   Tag_File,
00253   Tag_Section,
00254   Tag_Symbol,
00255   Tag_CPU_raw_name,
00256   Tag_CPU_name,
00257   Tag_CPU_arch,
00258   Tag_CPU_arch_profile,
00259   Tag_ARM_ISA_use,
00260   Tag_THUMB_ISA_use,
00261   Tag_VFP_arch,
00262   Tag_WMMX_arch,
00263   Tag_NEON_arch,
00264   Tag_PCS_config,
00265   Tag_ABI_PCS_R9_use,
00266   Tag_ABI_PCS_RW_data,
00267   Tag_ABI_PCS_RO_data,
00268   Tag_ABI_PCS_GOT_use,
00269   Tag_ABI_PCS_wchar_t,
00270   Tag_ABI_FP_rounding,
00271   Tag_ABI_FP_denormal,
00272   Tag_ABI_FP_exceptions,
00273   Tag_ABI_FP_user_exceptions,
00274   Tag_ABI_FP_number_model,
00275   Tag_ABI_align8_needed,
00276   Tag_ABI_align8_preserved,
00277   Tag_ABI_enum_size,
00278   Tag_ABI_HardFP_use,
00279   Tag_ABI_VFP_args,
00280   Tag_ABI_WMMX_args,
00281   Tag_ABI_optimization_goals,
00282   Tag_ABI_FP_optimization_goals,
00283   Tag_compatibility,
00284 };
00285 
00286 #endif
00287 
00288 /* The name of the note section used to identify arm variants.  */
00289 #define ARM_NOTE_SECTION ".note.gnu.arm.ident"
00290 
00291 /* Special section names.  */
00292 #define ELF_STRING_ARM_unwind           ".ARM.exidx"
00293 #define ELF_STRING_ARM_unwind_info      ".ARM.extab"
00294 #define ELF_STRING_ARM_unwind_once      ".gnu.linkonce.armexidx."
00295 #define ELF_STRING_ARM_unwind_info_once ".gnu.linkonce.armextab."
00296 
00297 #endif /* _ELF_ARM_H */