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