Back to index

cell-binutils  2.17cvs20070401
mmix.h
Go to the documentation of this file.
00001 /* MMIX support for BFD.
00002    Copyright 2001, 2002, 2003 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
00018 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00019 
00020 /* This file holds definitions specific to the MMIX ELF ABI. */
00021 #ifndef ELF_MMIX_H
00022 #define ELF_MMIX_H
00023 
00024 #include "elf/reloc-macros.h"
00025 
00026 /* Relocations.  See the reloc table in bfd/elf64-mmix.c for details.  */
00027 START_RELOC_NUMBERS (elf_mmix_reloc_type)
00028   RELOC_NUMBER (R_MMIX_NONE, 0)
00029 
00030   /* Standard absolute relocations.  */
00031   RELOC_NUMBER (R_MMIX_8, 1)
00032   RELOC_NUMBER (R_MMIX_16, 2)
00033   RELOC_NUMBER (R_MMIX_24, 3)
00034   RELOC_NUMBER (R_MMIX_32, 4)
00035   RELOC_NUMBER (R_MMIX_64, 5)
00036 
00037   /* Standard relative relocations.  */
00038   RELOC_NUMBER (R_MMIX_PC_8, 6)
00039   RELOC_NUMBER (R_MMIX_PC_16, 7)
00040   RELOC_NUMBER (R_MMIX_PC_24, 8)
00041   RELOC_NUMBER (R_MMIX_PC_32, 9)
00042   RELOC_NUMBER (R_MMIX_PC_64, 10)
00043 
00044   /* GNU extensions for C++ vtables.  */
00045   RELOC_NUMBER (R_MMIX_GNU_VTINHERIT, 11)
00046   RELOC_NUMBER (R_MMIX_GNU_VTENTRY, 12)
00047 
00048   /* A GETA instruction.  */
00049   RELOC_NUMBER (R_MMIX_GETA, 13)
00050   RELOC_NUMBER (R_MMIX_GETA_1, 14)
00051   RELOC_NUMBER (R_MMIX_GETA_2, 15)
00052   RELOC_NUMBER (R_MMIX_GETA_3, 16)
00053 
00054   /* A conditional branch instruction.  */
00055   RELOC_NUMBER (R_MMIX_CBRANCH, 17)
00056   RELOC_NUMBER (R_MMIX_CBRANCH_J, 18)
00057   RELOC_NUMBER (R_MMIX_CBRANCH_1, 19)
00058   RELOC_NUMBER (R_MMIX_CBRANCH_2, 20)
00059   RELOC_NUMBER (R_MMIX_CBRANCH_3, 21)
00060 
00061   /* A PUSHJ instruction.  */
00062   RELOC_NUMBER (R_MMIX_PUSHJ, 22)
00063   RELOC_NUMBER (R_MMIX_PUSHJ_1, 23)
00064   RELOC_NUMBER (R_MMIX_PUSHJ_2, 24)
00065   RELOC_NUMBER (R_MMIX_PUSHJ_3, 25)
00066 
00067   /* A JMP instruction.  */
00068   RELOC_NUMBER (R_MMIX_JMP, 26)
00069   RELOC_NUMBER (R_MMIX_JMP_1, 27)
00070   RELOC_NUMBER (R_MMIX_JMP_2, 28)
00071   RELOC_NUMBER (R_MMIX_JMP_3, 29)
00072 
00073   /* A relative address such as in a GETA or a branch.  */
00074   RELOC_NUMBER (R_MMIX_ADDR19, 30)
00075 
00076   /* A relative address such as in a JMP (only).  */
00077   RELOC_NUMBER (R_MMIX_ADDR27, 31)
00078 
00079   /* A general register or a number 0..255.  */
00080   RELOC_NUMBER (R_MMIX_REG_OR_BYTE, 32)
00081 
00082   /* A general register. */
00083   RELOC_NUMBER (R_MMIX_REG, 33)
00084 
00085   /* A global register and an offset, the global register (allocated at
00086      link time) contents plus the offset made equivalent to the relocation
00087      expression at link time.  The relocation must point at the Y field of
00088      an instruction.  */
00089   RELOC_NUMBER (R_MMIX_BASE_PLUS_OFFSET, 34)
00090 
00091   /* A LOCAL assertion.  */
00092   RELOC_NUMBER (R_MMIX_LOCAL, 35)
00093 
00094   /* A PUSHJ instruction, generating a stub if it does not reach.  */
00095   RELOC_NUMBER (R_MMIX_PUSHJ_STUBBABLE, 36)
00096 END_RELOC_NUMBERS (R_MMIX_max)
00097 
00098 
00099 /* Section Attributes.  */
00100 /* A section containing necessary information for relaxation.  */
00101 #define SHF_MMIX_CANRELAX   0x80000000
00102 
00103 /* Symbol attributes.  */
00104 /* A symbol with this section-index is a register.  */
00105 #define SHN_REGISTER SHN_LOPROC
00106 
00107 /* This section holds contents for each initialized register, at VMA
00108    regno*8.  A symbol relative to this section will be transformed to an
00109    absolute symbol with the value corresponding to the register number at
00110    final link time.  A symbol with a value outside the inclusive range
00111    32*8 .. 254*8 is an error.  It is highly recommended to only use an
00112    upper bound of 253*8 or lower as specified in the (currently
00113    unspecified) ABI.  */
00114 #define MMIX_REG_CONTENTS_SECTION_NAME ".MMIX.reg_contents"
00115 
00116 /* At link time, a section by this name is created, expected to be
00117    included in MMIX_REG_CONTENTS_SECTION_NAME in the output.  */
00118 #define MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME \
00119  ".MMIX.reg_contents.linker_allocated"
00120 
00121 /* This is a faked section holding symbols with SHN_REGISTER.  Don't
00122    confuse it with MMIX_REG_CONTENTS_SECTION_NAME; this one has no
00123    contents, just values.  It is an error for a value in this section to
00124    be outside the range 32..255 and it must never become an actual section
00125    in an object file.  */
00126 #define MMIX_REG_SECTION_NAME "*REG*"
00127 
00128 /* Appended with a number N=0..65535, this is a representation of the
00129    mmixal "BSPEC N" ... "ESPEC" directive pair; the contents go into an
00130    ELF section by name ".MMIX.spec_data.N".  */
00131 #define MMIX_OTHER_SPEC_SECTION_PREFIX ".MMIX.spec_data."
00132 
00133 /* A section SECNAME is noted to start at "__.MMIX.start.SECNAME" by the
00134    presence of this symbol.  Currently only implemented for ".text"
00135    through the symbol "__.MMIX.start..text".  */
00136 #define MMIX_LOC_SECTION_START_SYMBOL_PREFIX "__.MMIX.start."
00137 
00138 /* This symbol is always a function.  */
00139 #define MMIX_START_SYMBOL_NAME "Main"
00140 
00141 
00142 /* We smuggle in a few MMO specifics here.  We don't make a specific MMO
00143    file, since we can't reasonably support MMO without ELF; we have to
00144    include this file anyway.  */
00145 
00146 #define MMO_TEXT_SECTION_NAME ".text"
00147 #define MMO_DATA_SECTION_NAME ".data"
00148 
00149 /* A definition for the flags we put in spec data in files.  A copy of our
00150    own of some flags to keep immune to BFD flag changes.  See section.c of
00151    2001-07-18 for flag documentation.  */
00152 #define MMO_SEC_ALLOC      0x001
00153 #define MMO_SEC_LOAD       0x002
00154 #define MMO_SEC_RELOC      0x004
00155 #define MMO_SEC_READONLY   0x010
00156 #define MMO_SEC_CODE       0x020
00157 #define MMO_SEC_DATA       0x040
00158 #define MMO_SEC_NEVER_LOAD 0x400
00159 #define MMO_SEC_IS_COMMON 0x8000
00160 #define MMO_SEC_DEBUGGING 0x10000
00161 
00162 #ifdef BFD_ARCH_SIZE
00163 extern bfd_boolean _bfd_mmix_before_linker_allocation
00164   (bfd *, struct bfd_link_info *);
00165 extern bfd_boolean _bfd_mmix_after_linker_allocation
00166   (bfd *, struct bfd_link_info *);
00167 extern bfd_boolean _bfd_mmix_check_all_relocs
00168   (bfd *, struct bfd_link_info *);
00169 #endif
00170 
00171 #endif /* ELF_MMIX_H */