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