1*fae548d3Szrj /* CRIS ELF support for BFD. 2*fae548d3Szrj Copyright (C) 2000-2020 Free Software Foundation, Inc. 3*fae548d3Szrj Contributed by Axis Communications AB, Lund, Sweden. 4*fae548d3Szrj Written by Hans-Peter Nilsson. 5*fae548d3Szrj 6*fae548d3Szrj This file is part of BFD, the Binary File Descriptor library. 7*fae548d3Szrj 8*fae548d3Szrj This program is free software; you can redistribute it and/or modify 9*fae548d3Szrj it under the terms of the GNU General Public License as published by 10*fae548d3Szrj the Free Software Foundation; either version 3 of the License, or 11*fae548d3Szrj (at your option) any later version. 12*fae548d3Szrj 13*fae548d3Szrj This program is distributed in the hope that it will be useful, 14*fae548d3Szrj but WITHOUT ANY WARRANTY; without even the implied warranty of 15*fae548d3Szrj MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16*fae548d3Szrj GNU General Public License for more details. 17*fae548d3Szrj 18*fae548d3Szrj You should have received a copy of the GNU General Public License 19*fae548d3Szrj along with this program; if not, write to the Free Software Foundation, 20*fae548d3Szrj Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 21*fae548d3Szrj 22*fae548d3Szrj #ifndef _ELF_CRIS_H 23*fae548d3Szrj #define _ELF_CRIS_H 24*fae548d3Szrj 25*fae548d3Szrj #include "elf/reloc-macros.h" 26*fae548d3Szrj 27*fae548d3Szrj /* Relocations. */ 28*fae548d3Szrj START_RELOC_NUMBERS (elf_cris_reloc_type) 29*fae548d3Szrj RELOC_NUMBER (R_CRIS_NONE, 0) 30*fae548d3Szrj RELOC_NUMBER (R_CRIS_8, 1) 31*fae548d3Szrj RELOC_NUMBER (R_CRIS_16, 2) 32*fae548d3Szrj RELOC_NUMBER (R_CRIS_32, 3) 33*fae548d3Szrj 34*fae548d3Szrj /* The "PC" position is the location right after the relocation. */ 35*fae548d3Szrj RELOC_NUMBER (R_CRIS_8_PCREL, 4) 36*fae548d3Szrj RELOC_NUMBER (R_CRIS_16_PCREL, 5) 37*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_PCREL, 6) 38*fae548d3Szrj 39*fae548d3Szrj RELOC_NUMBER (R_CRIS_GNU_VTINHERIT, 7) 40*fae548d3Szrj RELOC_NUMBER (R_CRIS_GNU_VTENTRY, 8) 41*fae548d3Szrj 42*fae548d3Szrj /* Copy contents at dynlinking. Generated by the linker. 43*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_COPY. */ 44*fae548d3Szrj RELOC_NUMBER (R_CRIS_COPY, 9) 45*fae548d3Szrj 46*fae548d3Szrj /* Create GOT entry. Generated by the linker. 47*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_GLOB_DAT. */ 48*fae548d3Szrj RELOC_NUMBER (R_CRIS_GLOB_DAT, 10) 49*fae548d3Szrj 50*fae548d3Szrj /* Create PLT entry. Generated by the linker. 51*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_JUMP_SLOT. */ 52*fae548d3Szrj RELOC_NUMBER (R_CRIS_JUMP_SLOT, 11) 53*fae548d3Szrj 54*fae548d3Szrj /* Adjust by program base. Generated by the linker. 55*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_RELATIVE. */ 56*fae548d3Szrj RELOC_NUMBER (R_CRIS_RELATIVE, 12) 57*fae548d3Szrj 58*fae548d3Szrj /* A 16-bit offset to entry in GOT and request to create GOT entry for 59*fae548d3Szrj that symbol. 60*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_16_GOT. */ 61*fae548d3Szrj RELOC_NUMBER (R_CRIS_16_GOT, 13) 62*fae548d3Szrj 63*fae548d3Szrj /* A 32-bit offset to entry in GOT and request to create GOT entry for 64*fae548d3Szrj that symbol. 65*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_32_GOT. */ 66*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_GOT, 14) 67*fae548d3Szrj 68*fae548d3Szrj /* A 16-bit offset to entry in PLT part of GOT and request to create PLT 69*fae548d3Szrj entry for that symbol. 70*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_16_GOTPLT. */ 71*fae548d3Szrj RELOC_NUMBER (R_CRIS_16_GOTPLT, 15) 72*fae548d3Szrj 73*fae548d3Szrj /* A 32-bit offset to entry in PLT part of GOT and request to create PLT 74*fae548d3Szrj entry for that symbol. 75*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_32_GOTPLT. */ 76*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_GOTPLT, 16) 77*fae548d3Szrj 78*fae548d3Szrj /* A 32-bit offset from GOT to (local) symbol: no GOT entry should be 79*fae548d3Szrj necessary. 80*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_32_GOTREL. */ 81*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_GOTREL, 17) 82*fae548d3Szrj 83*fae548d3Szrj /* A 32-bit offset from GOT to entry for this symbol in PLT and request 84*fae548d3Szrj to create PLT entry for symbol. 85*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_32_GOTREL. */ 86*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_PLT_GOTREL, 18) 87*fae548d3Szrj 88*fae548d3Szrj /* A 32-bit offset from location after this relocation (addend specifies 89*fae548d3Szrj offset) to entry for this symbol in PLT and request to create PLT 90*fae548d3Szrj entry for symbol. 91*fae548d3Szrj The BFD equivalent is BFD_RELOC_CRIS_32_PLT_PCREL. */ 92*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_PLT_PCREL, 19) 93*fae548d3Szrj 94*fae548d3Szrj /* An assembler-generated-only relocation, instructing the linker to 95*fae548d3Szrj reserve two GOT slots, carrying the R_CRIS_DTP relocation for the 96*fae548d3Szrj symbol (pointing to the first slot, the relocation fills in 97*fae548d3Szrj both). The value is a 32-bit-value, relative to the start of the 98*fae548d3Szrj GOT. Assembly syntax: "sym:GDGOTREL". */ 99*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_GOT_GD, 20) 100*fae548d3Szrj 101*fae548d3Szrj /* Similar to R_CRIS_32_GOT_GD, but the value is a 16-bit unsigned 102*fae548d3Szrj number, limiting access to 65536/4 global symbols per module (or 103*fae548d3Szrj 65536/8 thread variables; loosely speaking G*4+T*8 < 65536, where 104*fae548d3Szrj T is the number of thread variables and G is the number of other 105*fae548d3Szrj external global variables and functions). Assembly syntax: 106*fae548d3Szrj "sym:GDGOTREL16". */ 107*fae548d3Szrj RELOC_NUMBER (R_CRIS_16_GOT_GD, 21) 108*fae548d3Szrj 109*fae548d3Szrj /* Similar to R_CRIS_32_GOT_GD, but the value is the absolute 110*fae548d3Szrj address of the GOT entry. Disallowed in DSOs created with 111*fae548d3Szrj -shared. Assembly syntax: "sym:GD". */ 112*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_GD, 22) 113*fae548d3Szrj 114*fae548d3Szrj /* A linker-generated-only relocation, instructing the dynamic 115*fae548d3Szrj linker to fill in the module ID and module-relative-TLS-block 116*fae548d3Szrj offset of the symbol in question, used for GOT entries. Note 117*fae548d3Szrj that this relocation instructs to fill in two 32-bit values. */ 118*fae548d3Szrj RELOC_NUMBER (R_CRIS_DTP, 23) 119*fae548d3Szrj 120*fae548d3Szrj /* An assembler-generated-only relocation, instructing the linker to 121*fae548d3Szrj reserve the first two GOT slots, and attach the R_CRIS_DTPMOD 122*fae548d3Szrj relocation(*) for the module to the first slot, the second 123*fae548d3Szrj containing zero. The value is 32 bits, the offset from the start 124*fae548d3Szrj of the TLS block of the module to the thread-local symbol 125*fae548d3Szrj mentioned in the relocation. This relocation must only be applied 126*fae548d3Szrj to module-local symbols. Assembly syntax: "expr:DTPREL". */ 127*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_DTPREL, 24) 128*fae548d3Szrj 129*fae548d3Szrj /* Similar to R_CRIS_32_DTPREL, but the value is a 16-bit signed 130*fae548d3Szrj number, limiting the size of thread-variables of the DSO to 32768 131*fae548d3Szrj bytes. (Note: matches both model 1 and 2 and allows use of addo.w 132*fae548d3Szrj as the instruction where this relocation is used.) Assembly 133*fae548d3Szrj syntax: "expr:DTPREL16". */ 134*fae548d3Szrj RELOC_NUMBER (R_CRIS_16_DTPREL, 25) 135*fae548d3Szrj 136*fae548d3Szrj /* An assembler-generated-only relocation, instructing the linker to 137*fae548d3Szrj reserve a GOT slot and attach the R_CRIS_32_TPREL relocation for 138*fae548d3Szrj the symbol in question. The value is 32 bits, which is the 139*fae548d3Szrj GOT-relative offset of the slot. Assembly syntax: 140*fae548d3Szrj "sym:TPOFFGOT". */ 141*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_GOT_TPREL, 26) 142*fae548d3Szrj 143*fae548d3Szrj /* Similar to R_CRIS_32_TPREL, but the value is a 16-bit positive 144*fae548d3Szrj number, limiting the number of thread- and global variables of 145*fae548d3Szrj the DSO to 32768/4. Assembly syntax: "sym:TPOFFGOT16". */ 146*fae548d3Szrj RELOC_NUMBER (R_CRIS_16_GOT_TPREL, 27) 147*fae548d3Szrj 148*fae548d3Szrj /* An assembler- and linker-generated relocation, instructing to 149*fae548d3Szrj resolve the symbol in question yielding the TLS offset of the 150*fae548d3Szrj thread variable, relative to the global TLS block. Not allowed 151*fae548d3Szrj as input when generating a DSO. Assembly syntax: 152*fae548d3Szrj "expr:TPOFF". */ 153*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_TPREL, 28) 154*fae548d3Szrj 155*fae548d3Szrj /* Similar to R_CRIS_32_TPREL, but only applicable to executables 156*fae548d3Szrj compiled with -msmall-tls. Not allowed in a DSO. The value is a 157*fae548d3Szrj 16-bit signed number, limiting the size of thread-variables of 158*fae548d3Szrj the executable to 32768 bytes. (Note: being signed makes it match 159*fae548d3Szrj both model 1 and 2 and allows use of addo.w as the instruction 160*fae548d3Szrj where this relocation is applied.) Assembly syntax: 161*fae548d3Szrj "expr:TPOFF16". */ 162*fae548d3Szrj RELOC_NUMBER (R_CRIS_16_TPREL, 29) 163*fae548d3Szrj 164*fae548d3Szrj /* A linker-generated-only relocation, instructing the dynamic 165*fae548d3Szrj linker to fill in the current module ID, used for GOT entries 166*fae548d3Szrj (usually the fourth one). */ 167*fae548d3Szrj RELOC_NUMBER (R_CRIS_DTPMOD, 30) 168*fae548d3Szrj 169*fae548d3Szrj /* Similar to R_CRIS_32_GOT_TPREL, but the value is the absolute 170*fae548d3Szrj address of the GOT entry. Disallowed in DSOs created with 171*fae548d3Szrj -shared. Assembly syntax: "sym:IE". */ 172*fae548d3Szrj RELOC_NUMBER (R_CRIS_32_IE, 31) 173*fae548d3Szrj 174*fae548d3Szrj /* No other relocs must be visible outside the assembler. */ 175*fae548d3Szrj 176*fae548d3Szrj END_RELOC_NUMBERS (R_CRIS_max) 177*fae548d3Szrj 178*fae548d3Szrj /* User symbols in this file have a leading underscore. */ 179*fae548d3Szrj #define EF_CRIS_UNDERSCORE 0x00000001 180*fae548d3Szrj 181*fae548d3Szrj /* This is a mask for different incompatible machine variants. */ 182*fae548d3Szrj #define EF_CRIS_VARIANT_MASK 0x0000000e 183*fae548d3Szrj 184*fae548d3Szrj /* Variant 0; may contain v0..10 object. */ 185*fae548d3Szrj #define EF_CRIS_VARIANT_ANY_V0_V10 0x00000000 186*fae548d3Szrj 187*fae548d3Szrj /* Variant 1; contains v32 object. */ 188*fae548d3Szrj #define EF_CRIS_VARIANT_V32 0x00000002 189*fae548d3Szrj 190*fae548d3Szrj /* Variant 2; contains object compatible with v32 and v10. */ 191*fae548d3Szrj #define EF_CRIS_VARIANT_COMMON_V10_V32 0x00000004 192*fae548d3Szrj 193*fae548d3Szrj #endif /* _ELF_CRIS_H */ 194