Home | History | Annotate | Line # | Download | only in elf
      1 /* C-SKY ELF support for BFD.
      2    Copyright (C) 1998-2025 Free Software Foundation, Inc.
      3    Contributed by C-SKY Microsystems and Mentor Graphics.
      4 
      5    This file is part of BFD, the Binary File Descriptor library.
      6 
      7    This program is free software; you can redistribute it and/or modify
      8    it under the terms of the GNU General Public License as published by
      9    the Free Software Foundation; either version 3 of the License, or
     10    (at your option) any later version.
     11 
     12    This program is distributed in the hope that it will be useful,
     13    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15    GNU General Public License for more details.
     16 
     17    You should have received a copy of the GNU General Public License
     18    along with this program; if not, write to the Free Software Foundation,
     19    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
     20 
     21 #ifndef _ELF_CSKY_H
     22 #define _ELF_CSKY_H
     23 
     24 #include "elf/reloc-macros.h"
     25 
     26 /* Values of relocation types according to the ABI doc.
     27    The order should be consistent with csky bfd reloc type
     28    table in bfd-in2.h.  */
     29 START_RELOC_NUMBERS (elf_csky_reloc_type)
     30     RELOC_NUMBER (R_CKCORE_NONE,0)
     31     RELOC_NUMBER (R_CKCORE_ADDR32,1)
     32     RELOC_NUMBER (R_CKCORE_PCREL_IMM8BY4,2)
     33     RELOC_NUMBER (R_CKCORE_PCREL_IMM11BY2,3)
     34     RELOC_NUMBER (R_CKCORE_PCREL_IMM4BY2,4)
     35     RELOC_NUMBER (R_CKCORE_PCREL32,5)
     36     RELOC_NUMBER (R_CKCORE_PCREL_JSR_IMM11BY2,6)
     37     RELOC_NUMBER (R_CKCORE_GNU_VTINHERIT,7)
     38     RELOC_NUMBER (R_CKCORE_GNU_VTENTRY,8)
     39     RELOC_NUMBER (R_CKCORE_RELATIVE,9)
     40     RELOC_NUMBER (R_CKCORE_COPY,10)
     41     RELOC_NUMBER (R_CKCORE_GLOB_DAT,11)
     42     RELOC_NUMBER (R_CKCORE_JUMP_SLOT,12)
     43     RELOC_NUMBER (R_CKCORE_GOTOFF,13)
     44     RELOC_NUMBER (R_CKCORE_GOTPC,14)
     45     RELOC_NUMBER (R_CKCORE_GOT32,15)
     46     RELOC_NUMBER (R_CKCORE_PLT32,16)
     47     RELOC_NUMBER (R_CKCORE_ADDRGOT,17)
     48     RELOC_NUMBER (R_CKCORE_ADDRPLT,18)
     49     RELOC_NUMBER (R_CKCORE_PCREL_IMM26BY2,19)
     50     RELOC_NUMBER (R_CKCORE_PCREL_IMM16BY2,20)
     51     RELOC_NUMBER (R_CKCORE_PCREL_IMM16BY4,21)
     52     RELOC_NUMBER (R_CKCORE_PCREL_IMM10BY2,22)
     53     RELOC_NUMBER (R_CKCORE_PCREL_IMM10BY4,23)
     54     RELOC_NUMBER (R_CKCORE_ADDR_HI16,24)
     55     RELOC_NUMBER (R_CKCORE_ADDR_LO16,25)
     56     RELOC_NUMBER (R_CKCORE_GOTPC_HI16,26)
     57     RELOC_NUMBER (R_CKCORE_GOTPC_LO16,27)
     58     RELOC_NUMBER (R_CKCORE_GOTOFF_HI16,28)
     59     RELOC_NUMBER (R_CKCORE_GOTOFF_LO16,29)
     60     RELOC_NUMBER (R_CKCORE_GOT12,30)
     61     RELOC_NUMBER (R_CKCORE_GOT_HI16,31)
     62     RELOC_NUMBER (R_CKCORE_GOT_LO16,32)
     63     RELOC_NUMBER (R_CKCORE_PLT12,33)
     64     RELOC_NUMBER (R_CKCORE_PLT_HI16,34)
     65     RELOC_NUMBER (R_CKCORE_PLT_LO16,35)
     66     RELOC_NUMBER (R_CKCORE_ADDRGOT_HI16,36)
     67     RELOC_NUMBER (R_CKCORE_ADDRGOT_LO16,37)
     68     RELOC_NUMBER (R_CKCORE_ADDRPLT_HI16,38)
     69     RELOC_NUMBER (R_CKCORE_ADDRPLT_LO16,39)
     70     RELOC_NUMBER (R_CKCORE_PCREL_JSR_IMM26BY2,40)
     71     RELOC_NUMBER (R_CKCORE_TOFFSET_LO16, 41)
     72     RELOC_NUMBER (R_CKCORE_DOFFSET_LO16, 42)
     73     RELOC_NUMBER (R_CKCORE_PCREL_IMM18BY2, 43)
     74     RELOC_NUMBER (R_CKCORE_DOFFSET_IMM18, 44)
     75     RELOC_NUMBER (R_CKCORE_DOFFSET_IMM18BY2, 45)
     76     RELOC_NUMBER (R_CKCORE_DOFFSET_IMM18BY4, 46)
     77     RELOC_NUMBER (R_CKCORE_GOTOFF_IMM18, 47)
     78     RELOC_NUMBER (R_CKCORE_GOT_IMM18BY4, 48)
     79     RELOC_NUMBER (R_CKCORE_PLT_IMM18BY4, 49)
     80     RELOC_NUMBER (R_CKCORE_PCREL_IMM7BY4, 50)
     81     RELOC_NUMBER (R_CKCORE_TLS_LE32, 51)
     82     RELOC_NUMBER (R_CKCORE_TLS_IE32, 52)
     83     RELOC_NUMBER (R_CKCORE_TLS_GD32, 53)
     84     RELOC_NUMBER (R_CKCORE_TLS_LDM32, 54)
     85     RELOC_NUMBER (R_CKCORE_TLS_LDO32, 55)
     86     RELOC_NUMBER (R_CKCORE_TLS_DTPMOD32, 56)
     87     RELOC_NUMBER (R_CKCORE_TLS_DTPOFF32, 57)
     88     RELOC_NUMBER (R_CKCORE_TLS_TPOFF32, 58)
     89     RELOC_NUMBER (R_CKCORE_PCREL_FLRW_IMM8BY4, 59)
     90     RELOC_NUMBER (R_CKCORE_NOJSRI, 60)
     91     RELOC_NUMBER (R_CKCORE_CALLGRAPH, 61)
     92     RELOC_NUMBER (R_CKCORE_IRELATIVE, 62)
     93     RELOC_NUMBER (R_CKCORE_PCREL_BLOOP_IMM4BY4, 63)
     94     RELOC_NUMBER (R_CKCORE_PCREL_BLOOP_IMM12BY4, 64)
     95 END_RELOC_NUMBERS (R_CKCORE_MAX)
     96 
     97 /* Additional section types.  */
     98 #define SHT_CSKY_ATTRIBUTES       (SHT_LOPROC + 1) /* Section holds attributes.  */
     99 
    100 /* Object attribute tags.  */
    101 enum
    102 {
    103   /* 0-3 are generic. */
    104   /* Arch name for this object file.  */
    105   Tag_CSKY_ARCH_NAME = 4,
    106   Tag_CSKY_CPU_NAME = 5,
    107 
    108   /* ISA flags for this object file.  */
    109   Tag_CSKY_ISA_FLAGS,
    110   Tag_CSKY_ISA_EXT_FLAGS,
    111 
    112   /* CSKY DSP version used by this object file.  */
    113   Tag_CSKY_DSP_VERSION,
    114 
    115   /* CSKY VDSP version used by this object file.  */
    116   Tag_CSKY_VDSP_VERSION,
    117 
    118   /* CSKY FPU version used by this object file.  */
    119   Tag_CSKY_FPU_VERSION = 0x10,
    120   /* FPU ABI.  params: Soft GR/Hard GR/Hard FR. */
    121   Tag_CSKY_FPU_ABI,
    122   /* Rounding Support.  */
    123   Tag_CSKY_FPU_ROUNDING,
    124   /* Denormal Support.  */
    125   Tag_CSKY_FPU_DENORMAL,
    126   /* Exeception Support.  */
    127   Tag_CSKY_FPU_Exception,
    128   /* Number Module Support("IEEE 754").  */
    129   Tag_CSKY_FPU_NUMBER_MODULE,
    130   /* Half/Single/Double.  */
    131   Tag_CSKY_FPU_HARDFP,
    132 
    133   Tag_CSKY_MAX,
    134 };
    135 
    136 /* Object attribute values.  */
    137 enum
    138 {
    139   /* Values defined for Tag_CSKY_DSP_VERSION.  */
    140   VAL_CSKY_DSP_VERSION_EXTENSION = 1,	/* hi-lo DSP extension.  */
    141   VAL_CSKY_DSP_VERSION_2 = 2,		/* CK803s EDSP.  */
    142 };
    143 
    144 enum
    145 {
    146   /* Values defined for Tag_CSKY_VDSP_VERSION.  */
    147   VAL_CSKY_VDSP_VERSION_1 = 1,	/* VDSP version 1.  */
    148   VAL_CSKY_VDSP_VERSION_2	/* VDSP version 1.  */
    149 };
    150 
    151 enum
    152 {
    153   /* Values defined for Tag_CSKY_FPU_VERSION.  */
    154   VAL_CSKY_FPU_VERSION_1 = 1,	/* ABIV1 FPU.  */
    155   VAL_CSKY_FPU_VERSION_2,	/* ABIV2 FPU.  */
    156 };
    157 
    158 enum
    159 {
    160   VAL_CSKY_FPU_ABI_SOFT = 1,
    161   VAL_CSKY_FPU_ABI_SOFTFP,
    162   VAL_CSKY_FPU_ABI_HARD,
    163 };
    164 
    165 enum
    166 {
    167   VAL_CSKY_FPU_HARDFP_HALF = 1,
    168   VAL_CSKY_FPU_HARDFP_SINGLE = 2,
    169   VAL_CSKY_FPU_HARDFP_DOUBLE = 4,
    170 };
    171 
    172 #endif /* _ELF_CSKY_H  */
    173