Back to index

cell-binutils  2.17cvs20070401
ppc.h
Go to the documentation of this file.
00001 /* PPC ELF support for BFD.
00002    Copyright 1995, 1996, 1998, 2000, 2001, 2002, 2003, 2005
00003    Free Software Foundation, Inc.
00004 
00005    By Michael Meissner, Cygnus Support, <meissner@cygnus.com>, from information
00006    in the System V Application Binary Interface, PowerPC Processor Supplement
00007    and the PowerPC Embedded Application Binary Interface (eabi).
00008 
00009 This file is part of BFD, the Binary File Descriptor library.
00010 
00011 This program is free software; you can redistribute it and/or modify
00012 it under the terms of the GNU General Public License as published by
00013 the Free Software Foundation; either version 2 of the License, or
00014 (at your option) any later version.
00015 
00016 This program is distributed in the hope that it will be useful,
00017 but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 GNU General Public License for more details.
00020 
00021 You should have received a copy of the GNU General Public License
00022 along with this program; if not, write to the Free Software
00023 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00024 
00025 /* This file holds definitions specific to the PPC ELF ABI.  Note
00026    that most of this is not actually implemented by BFD.  */
00027 
00028 #ifndef _ELF_PPC_H
00029 #define _ELF_PPC_H
00030 
00031 #include "elf/reloc-macros.h"
00032 
00033 /* Relocations.  */
00034 START_RELOC_NUMBERS (elf_ppc_reloc_type)
00035   RELOC_NUMBER (R_PPC_NONE,          0)
00036   RELOC_NUMBER (R_PPC_ADDR32,               1)
00037   RELOC_NUMBER (R_PPC_ADDR24,               2)
00038   RELOC_NUMBER (R_PPC_ADDR16,               3)
00039   RELOC_NUMBER (R_PPC_ADDR16_LO,     4)
00040   RELOC_NUMBER (R_PPC_ADDR16_HI,     5)
00041   RELOC_NUMBER (R_PPC_ADDR16_HA,     6)
00042   RELOC_NUMBER (R_PPC_ADDR14,               7)
00043   RELOC_NUMBER (R_PPC_ADDR14_BRTAKEN,       8)
00044   RELOC_NUMBER (R_PPC_ADDR14_BRNTAKEN,      9)
00045   RELOC_NUMBER (R_PPC_REL24,               10)
00046   RELOC_NUMBER (R_PPC_REL14,               11)
00047   RELOC_NUMBER (R_PPC_REL14_BRTAKEN,       12)
00048   RELOC_NUMBER (R_PPC_REL14_BRNTAKEN,      13)
00049   RELOC_NUMBER (R_PPC_GOT16,               14)
00050   RELOC_NUMBER (R_PPC_GOT16_LO,            15)
00051   RELOC_NUMBER (R_PPC_GOT16_HI,            16)
00052   RELOC_NUMBER (R_PPC_GOT16_HA,            17)
00053   RELOC_NUMBER (R_PPC_PLTREL24,            18)
00054   RELOC_NUMBER (R_PPC_COPY,         19)
00055   RELOC_NUMBER (R_PPC_GLOB_DAT,            20)
00056   RELOC_NUMBER (R_PPC_JMP_SLOT,            21)
00057   RELOC_NUMBER (R_PPC_RELATIVE,            22)
00058   RELOC_NUMBER (R_PPC_LOCAL24PC,    23)
00059   RELOC_NUMBER (R_PPC_UADDR32,             24)
00060   RELOC_NUMBER (R_PPC_UADDR16,             25)
00061   RELOC_NUMBER (R_PPC_REL32,               26)
00062   RELOC_NUMBER (R_PPC_PLT32,               27)
00063   RELOC_NUMBER (R_PPC_PLTREL32,            28)
00064   RELOC_NUMBER (R_PPC_PLT16_LO,            29)
00065   RELOC_NUMBER (R_PPC_PLT16_HI,            30)
00066   RELOC_NUMBER (R_PPC_PLT16_HA,            31)
00067   RELOC_NUMBER (R_PPC_SDAREL16,            32)
00068   RELOC_NUMBER (R_PPC_SECTOFF,             33)
00069   RELOC_NUMBER (R_PPC_SECTOFF_LO,   34)
00070   RELOC_NUMBER (R_PPC_SECTOFF_HI,   35)
00071   RELOC_NUMBER (R_PPC_SECTOFF_HA,   36)
00072   RELOC_NUMBER (R_PPC_ADDR30,              37)
00073 
00074   /* Relocs added to support TLS.  */
00075   RELOC_NUMBER (R_PPC_TLS,          67)
00076   RELOC_NUMBER (R_PPC_DTPMOD32,            68)
00077   RELOC_NUMBER (R_PPC_TPREL16,             69)
00078   RELOC_NUMBER (R_PPC_TPREL16_LO,   70)
00079   RELOC_NUMBER (R_PPC_TPREL16_HI,   71)
00080   RELOC_NUMBER (R_PPC_TPREL16_HA,   72)
00081   RELOC_NUMBER (R_PPC_TPREL32,             73)
00082   RELOC_NUMBER (R_PPC_DTPREL16,            74)
00083   RELOC_NUMBER (R_PPC_DTPREL16_LO,  75)
00084   RELOC_NUMBER (R_PPC_DTPREL16_HI,  76)
00085   RELOC_NUMBER (R_PPC_DTPREL16_HA,  77)
00086   RELOC_NUMBER (R_PPC_DTPREL32,            78)
00087   RELOC_NUMBER (R_PPC_GOT_TLSGD16,  79)
00088   RELOC_NUMBER (R_PPC_GOT_TLSGD16_LO,      80)
00089   RELOC_NUMBER (R_PPC_GOT_TLSGD16_HI,      81)
00090   RELOC_NUMBER (R_PPC_GOT_TLSGD16_HA,      82)
00091   RELOC_NUMBER (R_PPC_GOT_TLSLD16,  83)
00092   RELOC_NUMBER (R_PPC_GOT_TLSLD16_LO,      84)
00093   RELOC_NUMBER (R_PPC_GOT_TLSLD16_HI,      85)
00094   RELOC_NUMBER (R_PPC_GOT_TLSLD16_HA,      86)
00095   RELOC_NUMBER (R_PPC_GOT_TPREL16,  87)
00096   RELOC_NUMBER (R_PPC_GOT_TPREL16_LO,      88)
00097   RELOC_NUMBER (R_PPC_GOT_TPREL16_HI,      89)
00098   RELOC_NUMBER (R_PPC_GOT_TPREL16_HA,      90)
00099   RELOC_NUMBER (R_PPC_GOT_DTPREL16,        91)
00100   RELOC_NUMBER (R_PPC_GOT_DTPREL16_LO,     92)
00101   RELOC_NUMBER (R_PPC_GOT_DTPREL16_HI,     93)
00102   RELOC_NUMBER (R_PPC_GOT_DTPREL16_HA,     94)
00103 
00104 /* The remaining relocs are from the Embedded ELF ABI, and are not
00105    in the SVR4 ELF ABI.  */
00106   RELOC_NUMBER (R_PPC_EMB_NADDR32, 101)
00107   RELOC_NUMBER (R_PPC_EMB_NADDR16, 102)
00108   RELOC_NUMBER (R_PPC_EMB_NADDR16_LO,     103)
00109   RELOC_NUMBER (R_PPC_EMB_NADDR16_HI,     104)
00110   RELOC_NUMBER (R_PPC_EMB_NADDR16_HA,     105)
00111   RELOC_NUMBER (R_PPC_EMB_SDAI16,  106)
00112   RELOC_NUMBER (R_PPC_EMB_SDA2I16, 107)
00113   RELOC_NUMBER (R_PPC_EMB_SDA2REL, 108)
00114   RELOC_NUMBER (R_PPC_EMB_SDA21,   109)
00115   RELOC_NUMBER (R_PPC_EMB_MRKREF,  110)
00116   RELOC_NUMBER (R_PPC_EMB_RELSEC16,       111)
00117   RELOC_NUMBER (R_PPC_EMB_RELST_LO,       112)
00118   RELOC_NUMBER (R_PPC_EMB_RELST_HI,       113)
00119   RELOC_NUMBER (R_PPC_EMB_RELST_HA,       114)
00120   RELOC_NUMBER (R_PPC_EMB_BIT_FLD, 115)
00121   RELOC_NUMBER (R_PPC_EMB_RELSDA,  116)
00122 
00123 /* Fake relocations for branch stubs, only used internally by ld.  */
00124 #define R_PPC_RELAX32 245
00125 #define R_PPC_RELAX32PC 246
00126 #define R_PPC_RELAX32_PLT 247
00127 #define R_PPC_RELAX32PC_PLT 248
00128 
00129 /* These are GNU extensions used in PIC code sequences.  */
00130   RELOC_NUMBER (R_PPC_REL16,              249)
00131   RELOC_NUMBER (R_PPC_REL16_LO,           250)
00132   RELOC_NUMBER (R_PPC_REL16_HI,           251)
00133   RELOC_NUMBER (R_PPC_REL16_HA,           252)
00134 
00135 /* These are GNU extensions to enable C++ vtable garbage collection.  */
00136   RELOC_NUMBER (R_PPC_GNU_VTINHERIT,      253)
00137   RELOC_NUMBER (R_PPC_GNU_VTENTRY, 254)
00138 
00139 /* This is a phony reloc to handle any old fashioned TOC16 references
00140    that may still be in object files.  */
00141   RELOC_NUMBER (R_PPC_TOC16,              255)
00142 
00143 END_RELOC_NUMBERS (R_PPC_max)
00144 
00145 #define IS_PPC_TLS_RELOC(R) \
00146   ((R) >= R_PPC_TLS && (R) <= R_PPC_GOT_DTPREL16_HA)
00147 
00148 /* Specify the value of _GLOBAL_OFFSET_TABLE_.  */
00149 #define DT_PPC_GOT          DT_LOPROC
00150 
00151 /* Processor specific flags for the ELF header e_flags field.  */
00152 
00153 #define       EF_PPC_EMB           0x80000000    /* PowerPC embedded flag.  */
00154 
00155 #define       EF_PPC_RELOCATABLE   0x00010000    /* PowerPC -mrelocatable flag.  */
00156 #define       EF_PPC_RELOCATABLE_LIB      0x00008000    /* PowerPC -mrelocatable-lib flag.  */
00157 
00158 /* Processor specific section headers, sh_type field.  */
00159 
00160 #define SHT_ORDERED         SHT_HIPROC    /* Link editor is to sort the \
00161                                              entries in this section \
00162                                              based on the address \
00163                                              specified in the associated \
00164                                              symbol table entry.  */
00165 
00166 /* Processor specific section flags, sh_flags field.  */
00167 
00168 #define SHF_EXCLUDE         0x80000000    /* Link editor is to exclude \
00169                                              this section from executable \
00170                                              and shared objects that it \
00171                                              builds when those objects \
00172                                              are not to be furhter \
00173                                              relocated.  */
00174 #endif /* _ELF_PPC_H */