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