1*a9fa9459Szrj /* M32C ELF support for BFD.
2*a9fa9459Szrj    Copyright (C) 2004-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 Foundation,
18*a9fa9459Szrj    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
19*a9fa9459Szrj 
20*a9fa9459Szrj #ifndef _ELF_M32C_H
21*a9fa9459Szrj #define _ELF_M32C_H
22*a9fa9459Szrj 
23*a9fa9459Szrj #include "elf/reloc-macros.h"
24*a9fa9459Szrj 
25*a9fa9459Szrj   /* Relocations.  */
26*a9fa9459Szrj   START_RELOC_NUMBERS (elf_m32c_reloc_type)
27*a9fa9459Szrj      RELOC_NUMBER (R_M32C_NONE, 0)
28*a9fa9459Szrj      RELOC_NUMBER (R_M32C_16, 1)
29*a9fa9459Szrj      RELOC_NUMBER (R_M32C_24, 2)
30*a9fa9459Szrj      RELOC_NUMBER (R_M32C_32, 3)
31*a9fa9459Szrj      RELOC_NUMBER (R_M32C_8_PCREL, 4)
32*a9fa9459Szrj      RELOC_NUMBER (R_M32C_16_PCREL, 5)
33*a9fa9459Szrj 
34*a9fa9459Szrj     /* 8 bit unsigned address, used for dsp8[a0] etc */
35*a9fa9459Szrj      RELOC_NUMBER (R_M32C_8, 6)
36*a9fa9459Szrj     /* Bits 0..15 of an address, for SMOVF's A0, A1A0, etc. */
37*a9fa9459Szrj      RELOC_NUMBER (R_M32C_LO16, 7)
38*a9fa9459Szrj     /* Bits 16..23 of an address, for SMOVF's R1H etc. */
39*a9fa9459Szrj      RELOC_NUMBER (R_M32C_HI8, 8)
40*a9fa9459Szrj     /* Bits 16..31 of an address, for LDE's A1A0 etc. */
41*a9fa9459Szrj      RELOC_NUMBER (R_M32C_HI16, 9)
42*a9fa9459Szrj 
43*a9fa9459Szrj     /* These are relocs we need when relaxing.  */
44*a9fa9459Szrj     /* Marks various jump opcodes.  */
45*a9fa9459Szrj      RELOC_NUMBER (R_M32C_RL_JUMP, 10)
46*a9fa9459Szrj     /* Marks standard one-address form.  */
47*a9fa9459Szrj      RELOC_NUMBER (R_M32C_RL_1ADDR, 11)
48*a9fa9459Szrj     /* Marks standard two-address form.  */
49*a9fa9459Szrj      RELOC_NUMBER (R_M32C_RL_2ADDR, 12)
50*a9fa9459Szrj 
51*a9fa9459Szrj      END_RELOC_NUMBERS (R_M32C_max)
52*a9fa9459Szrj 
53*a9fa9459Szrj #define EF_M32C_CPU_M16C	0x00000075      /* default */
54*a9fa9459Szrj #define EF_M32C_CPU_M32C        0x00000078      /* m32c */
55*a9fa9459Szrj #define EF_M32C_CPU_MASK	0x0000007F	/* specific cpu bits */
56*a9fa9459Szrj #define EF_M32C_ALL_FLAGS	(EF_M32C_CPU_MASK)
57*a9fa9459Szrj 
58*a9fa9459Szrj /* Define the data & instruction memory discriminator.  In a linked
59*a9fa9459Szrj    executable, an symbol should be deemed to point to an instruction
60*a9fa9459Szrj    if ((address & M16C_INSN_MASK) == M16C_INSN_VALUE), and similarly
61*a9fa9459Szrj    for the data space.  See also `ld/emulparams/elf32m32c.sh'.  */
62*a9fa9459Szrj #define M32C_DATA_MASK   0xffc00000
63*a9fa9459Szrj #define M32C_DATA_VALUE  0x00000000
64*a9fa9459Szrj #define M32C_INSN_MASK   0xffc00000
65*a9fa9459Szrj #define M32C_INSN_VALUE  0x00400000
66*a9fa9459Szrj 
67*a9fa9459Szrj #endif /* _ELF_M32C_H */
68