1*3d8817e4Smiod /* MMIX support for BFD. 2*3d8817e4Smiod Copyright 2001, 2002, 2003 Free Software Foundation, Inc. 3*3d8817e4Smiod 4*3d8817e4Smiod This file is part of BFD, the Binary File Descriptor library. 5*3d8817e4Smiod 6*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 7*3d8817e4Smiod it under the terms of the GNU General Public License as published by 8*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or 9*3d8817e4Smiod (at your option) any later version. 10*3d8817e4Smiod 11*3d8817e4Smiod This program is distributed in the hope that it will be useful, 12*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 13*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*3d8817e4Smiod GNU General Public License for more details. 15*3d8817e4Smiod 16*3d8817e4Smiod You should have received a copy of the GNU General Public License 17*3d8817e4Smiod along with this program; if not, write to the Free Software 18*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 19*3d8817e4Smiod 20*3d8817e4Smiod /* This file holds definitions specific to the MMIX ELF ABI. */ 21*3d8817e4Smiod #ifndef ELF_MMIX_H 22*3d8817e4Smiod #define ELF_MMIX_H 23*3d8817e4Smiod 24*3d8817e4Smiod #include "elf/reloc-macros.h" 25*3d8817e4Smiod 26*3d8817e4Smiod /* Relocations. See the reloc table in bfd/elf64-mmix.c for details. */ 27*3d8817e4Smiod START_RELOC_NUMBERS (elf_mmix_reloc_type) 28*3d8817e4Smiod RELOC_NUMBER (R_MMIX_NONE, 0) 29*3d8817e4Smiod 30*3d8817e4Smiod /* Standard absolute relocations. */ 31*3d8817e4Smiod RELOC_NUMBER (R_MMIX_8, 1) 32*3d8817e4Smiod RELOC_NUMBER (R_MMIX_16, 2) 33*3d8817e4Smiod RELOC_NUMBER (R_MMIX_24, 3) 34*3d8817e4Smiod RELOC_NUMBER (R_MMIX_32, 4) 35*3d8817e4Smiod RELOC_NUMBER (R_MMIX_64, 5) 36*3d8817e4Smiod 37*3d8817e4Smiod /* Standard relative relocations. */ 38*3d8817e4Smiod RELOC_NUMBER (R_MMIX_PC_8, 6) 39*3d8817e4Smiod RELOC_NUMBER (R_MMIX_PC_16, 7) 40*3d8817e4Smiod RELOC_NUMBER (R_MMIX_PC_24, 8) 41*3d8817e4Smiod RELOC_NUMBER (R_MMIX_PC_32, 9) 42*3d8817e4Smiod RELOC_NUMBER (R_MMIX_PC_64, 10) 43*3d8817e4Smiod 44*3d8817e4Smiod /* GNU extensions for C++ vtables. */ 45*3d8817e4Smiod RELOC_NUMBER (R_MMIX_GNU_VTINHERIT, 11) 46*3d8817e4Smiod RELOC_NUMBER (R_MMIX_GNU_VTENTRY, 12) 47*3d8817e4Smiod 48*3d8817e4Smiod /* A GETA instruction. */ 49*3d8817e4Smiod RELOC_NUMBER (R_MMIX_GETA, 13) 50*3d8817e4Smiod RELOC_NUMBER (R_MMIX_GETA_1, 14) 51*3d8817e4Smiod RELOC_NUMBER (R_MMIX_GETA_2, 15) 52*3d8817e4Smiod RELOC_NUMBER (R_MMIX_GETA_3, 16) 53*3d8817e4Smiod 54*3d8817e4Smiod /* A conditional branch instruction. */ 55*3d8817e4Smiod RELOC_NUMBER (R_MMIX_CBRANCH, 17) 56*3d8817e4Smiod RELOC_NUMBER (R_MMIX_CBRANCH_J, 18) 57*3d8817e4Smiod RELOC_NUMBER (R_MMIX_CBRANCH_1, 19) 58*3d8817e4Smiod RELOC_NUMBER (R_MMIX_CBRANCH_2, 20) 59*3d8817e4Smiod RELOC_NUMBER (R_MMIX_CBRANCH_3, 21) 60*3d8817e4Smiod 61*3d8817e4Smiod /* A PUSHJ instruction. */ 62*3d8817e4Smiod RELOC_NUMBER (R_MMIX_PUSHJ, 22) 63*3d8817e4Smiod RELOC_NUMBER (R_MMIX_PUSHJ_1, 23) 64*3d8817e4Smiod RELOC_NUMBER (R_MMIX_PUSHJ_2, 24) 65*3d8817e4Smiod RELOC_NUMBER (R_MMIX_PUSHJ_3, 25) 66*3d8817e4Smiod 67*3d8817e4Smiod /* A JMP instruction. */ 68*3d8817e4Smiod RELOC_NUMBER (R_MMIX_JMP, 26) 69*3d8817e4Smiod RELOC_NUMBER (R_MMIX_JMP_1, 27) 70*3d8817e4Smiod RELOC_NUMBER (R_MMIX_JMP_2, 28) 71*3d8817e4Smiod RELOC_NUMBER (R_MMIX_JMP_3, 29) 72*3d8817e4Smiod 73*3d8817e4Smiod /* A relative address such as in a GETA or a branch. */ 74*3d8817e4Smiod RELOC_NUMBER (R_MMIX_ADDR19, 30) 75*3d8817e4Smiod 76*3d8817e4Smiod /* A relative address such as in a JMP (only). */ 77*3d8817e4Smiod RELOC_NUMBER (R_MMIX_ADDR27, 31) 78*3d8817e4Smiod 79*3d8817e4Smiod /* A general register or a number 0..255. */ 80*3d8817e4Smiod RELOC_NUMBER (R_MMIX_REG_OR_BYTE, 32) 81*3d8817e4Smiod 82*3d8817e4Smiod /* A general register. */ 83*3d8817e4Smiod RELOC_NUMBER (R_MMIX_REG, 33) 84*3d8817e4Smiod 85*3d8817e4Smiod /* A global register and an offset, the global register (allocated at 86*3d8817e4Smiod link time) contents plus the offset made equivalent to the relocation 87*3d8817e4Smiod expression at link time. The relocation must point at the Y field of 88*3d8817e4Smiod an instruction. */ 89*3d8817e4Smiod RELOC_NUMBER (R_MMIX_BASE_PLUS_OFFSET, 34) 90*3d8817e4Smiod 91*3d8817e4Smiod /* A LOCAL assertion. */ 92*3d8817e4Smiod RELOC_NUMBER (R_MMIX_LOCAL, 35) 93*3d8817e4Smiod 94*3d8817e4Smiod /* A PUSHJ instruction, generating a stub if it does not reach. */ 95*3d8817e4Smiod RELOC_NUMBER (R_MMIX_PUSHJ_STUBBABLE, 36) 96*3d8817e4Smiod END_RELOC_NUMBERS (R_MMIX_max) 97*3d8817e4Smiod 98*3d8817e4Smiod 99*3d8817e4Smiod /* Section Attributes. */ 100*3d8817e4Smiod /* A section containing necessary information for relaxation. */ 101*3d8817e4Smiod #define SHF_MMIX_CANRELAX 0x80000000 102*3d8817e4Smiod 103*3d8817e4Smiod /* Symbol attributes. */ 104*3d8817e4Smiod /* A symbol with this section-index is a register. */ 105*3d8817e4Smiod #define SHN_REGISTER SHN_LOPROC 106*3d8817e4Smiod 107*3d8817e4Smiod /* This section holds contents for each initialized register, at VMA 108*3d8817e4Smiod regno*8. A symbol relative to this section will be transformed to an 109*3d8817e4Smiod absolute symbol with the value corresponding to the register number at 110*3d8817e4Smiod final link time. A symbol with a value outside the inclusive range 111*3d8817e4Smiod 32*8 .. 254*8 is an error. It is highly recommended to only use an 112*3d8817e4Smiod upper bound of 253*8 or lower as specified in the (currently 113*3d8817e4Smiod unspecified) ABI. */ 114*3d8817e4Smiod #define MMIX_REG_CONTENTS_SECTION_NAME ".MMIX.reg_contents" 115*3d8817e4Smiod 116*3d8817e4Smiod /* At link time, a section by this name is created, expected to be 117*3d8817e4Smiod included in MMIX_REG_CONTENTS_SECTION_NAME in the output. */ 118*3d8817e4Smiod #define MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME \ 119*3d8817e4Smiod ".MMIX.reg_contents.linker_allocated" 120*3d8817e4Smiod 121*3d8817e4Smiod /* This is a faked section holding symbols with SHN_REGISTER. Don't 122*3d8817e4Smiod confuse it with MMIX_REG_CONTENTS_SECTION_NAME; this one has no 123*3d8817e4Smiod contents, just values. It is an error for a value in this section to 124*3d8817e4Smiod be outside the range 32..255 and it must never become an actual section 125*3d8817e4Smiod in an object file. */ 126*3d8817e4Smiod #define MMIX_REG_SECTION_NAME "*REG*" 127*3d8817e4Smiod 128*3d8817e4Smiod /* Appended with a number N=0..65535, this is a representation of the 129*3d8817e4Smiod mmixal "BSPEC N" ... "ESPEC" directive pair; the contents go into an 130*3d8817e4Smiod ELF section by name ".MMIX.spec_data.N". */ 131*3d8817e4Smiod #define MMIX_OTHER_SPEC_SECTION_PREFIX ".MMIX.spec_data." 132*3d8817e4Smiod 133*3d8817e4Smiod /* A section SECNAME is noted to start at "__.MMIX.start.SECNAME" by the 134*3d8817e4Smiod presence of this symbol. Currently only implemented for ".text" 135*3d8817e4Smiod through the symbol "__.MMIX.start..text". */ 136*3d8817e4Smiod #define MMIX_LOC_SECTION_START_SYMBOL_PREFIX "__.MMIX.start." 137*3d8817e4Smiod 138*3d8817e4Smiod /* This symbol is always a function. */ 139*3d8817e4Smiod #define MMIX_START_SYMBOL_NAME "Main" 140*3d8817e4Smiod 141*3d8817e4Smiod 142*3d8817e4Smiod /* We smuggle in a few MMO specifics here. We don't make a specific MMO 143*3d8817e4Smiod file, since we can't reasonably support MMO without ELF; we have to 144*3d8817e4Smiod include this file anyway. */ 145*3d8817e4Smiod 146*3d8817e4Smiod #define MMO_TEXT_SECTION_NAME ".text" 147*3d8817e4Smiod #define MMO_DATA_SECTION_NAME ".data" 148*3d8817e4Smiod 149*3d8817e4Smiod /* A definition for the flags we put in spec data in files. A copy of our 150*3d8817e4Smiod own of some flags to keep immune to BFD flag changes. See section.c of 151*3d8817e4Smiod 2001-07-18 for flag documentation. */ 152*3d8817e4Smiod #define MMO_SEC_ALLOC 0x001 153*3d8817e4Smiod #define MMO_SEC_LOAD 0x002 154*3d8817e4Smiod #define MMO_SEC_RELOC 0x004 155*3d8817e4Smiod #define MMO_SEC_READONLY 0x010 156*3d8817e4Smiod #define MMO_SEC_CODE 0x020 157*3d8817e4Smiod #define MMO_SEC_DATA 0x040 158*3d8817e4Smiod #define MMO_SEC_NEVER_LOAD 0x400 159*3d8817e4Smiod #define MMO_SEC_IS_COMMON 0x8000 160*3d8817e4Smiod #define MMO_SEC_DEBUGGING 0x10000 161*3d8817e4Smiod 162*3d8817e4Smiod #ifdef BFD_ARCH_SIZE 163*3d8817e4Smiod extern bfd_boolean _bfd_mmix_before_linker_allocation 164*3d8817e4Smiod (bfd *, struct bfd_link_info *); 165*3d8817e4Smiod extern bfd_boolean _bfd_mmix_after_linker_allocation 166*3d8817e4Smiod (bfd *, struct bfd_link_info *); 167*3d8817e4Smiod extern bfd_boolean _bfd_mmix_check_all_relocs 168*3d8817e4Smiod (bfd *, struct bfd_link_info *); 169*3d8817e4Smiod #endif 170*3d8817e4Smiod 171*3d8817e4Smiod #endif /* ELF_MMIX_H */ 172