xref: /netbsd-src/external/gpl3/gdb/dist/include/elf/m32c.h (revision 02f41505626a9ceb584d30d0789203495760ac88)
198b9484cSchristos /* M32C ELF support for BFD.
2*02f41505Schristos    Copyright (C) 2004-2024 Free Software Foundation, Inc.
398b9484cSchristos 
498b9484cSchristos    This file is part of BFD, the Binary File Descriptor library.
598b9484cSchristos 
698b9484cSchristos    This program is free software; you can redistribute it and/or modify
798b9484cSchristos    it under the terms of the GNU General Public License as published by
898b9484cSchristos    the Free Software Foundation; either version 3 of the License, or
998b9484cSchristos    (at your option) any later version.
1098b9484cSchristos 
1198b9484cSchristos    This program is distributed in the hope that it will be useful,
1298b9484cSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
1398b9484cSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1498b9484cSchristos    GNU General Public License for more details.
1598b9484cSchristos 
1698b9484cSchristos    You should have received a copy of the GNU General Public License
1798b9484cSchristos    along with this program; if not, write to the Free Software Foundation,
1898b9484cSchristos    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
1998b9484cSchristos 
2098b9484cSchristos #ifndef _ELF_M32C_H
2198b9484cSchristos #define _ELF_M32C_H
2298b9484cSchristos 
2398b9484cSchristos #include "elf/reloc-macros.h"
2498b9484cSchristos 
2598b9484cSchristos   /* Relocations.  */
2698b9484cSchristos   START_RELOC_NUMBERS (elf_m32c_reloc_type)
2798b9484cSchristos      RELOC_NUMBER (R_M32C_NONE, 0)
2898b9484cSchristos      RELOC_NUMBER (R_M32C_16, 1)
2998b9484cSchristos      RELOC_NUMBER (R_M32C_24, 2)
3098b9484cSchristos      RELOC_NUMBER (R_M32C_32, 3)
3198b9484cSchristos      RELOC_NUMBER (R_M32C_8_PCREL, 4)
3298b9484cSchristos      RELOC_NUMBER (R_M32C_16_PCREL, 5)
3398b9484cSchristos 
3498b9484cSchristos     /* 8 bit unsigned address, used for dsp8[a0] etc */
3598b9484cSchristos      RELOC_NUMBER (R_M32C_8, 6)
3698b9484cSchristos     /* Bits 0..15 of an address, for SMOVF's A0, A1A0, etc. */
3798b9484cSchristos      RELOC_NUMBER (R_M32C_LO16, 7)
3898b9484cSchristos     /* Bits 16..23 of an address, for SMOVF's R1H etc. */
3998b9484cSchristos      RELOC_NUMBER (R_M32C_HI8, 8)
4098b9484cSchristos     /* Bits 16..31 of an address, for LDE's A1A0 etc. */
4198b9484cSchristos      RELOC_NUMBER (R_M32C_HI16, 9)
4298b9484cSchristos 
4398b9484cSchristos     /* These are relocs we need when relaxing.  */
4498b9484cSchristos     /* Marks various jump opcodes.  */
4598b9484cSchristos      RELOC_NUMBER (R_M32C_RL_JUMP, 10)
4698b9484cSchristos     /* Marks standard one-address form.  */
4798b9484cSchristos      RELOC_NUMBER (R_M32C_RL_1ADDR, 11)
4898b9484cSchristos     /* Marks standard two-address form.  */
4998b9484cSchristos      RELOC_NUMBER (R_M32C_RL_2ADDR, 12)
5098b9484cSchristos 
5198b9484cSchristos      END_RELOC_NUMBERS (R_M32C_max)
5298b9484cSchristos 
5398b9484cSchristos #define EF_M32C_CPU_M16C	0x00000075      /* default */
5498b9484cSchristos #define EF_M32C_CPU_M32C        0x00000078      /* m32c */
5598b9484cSchristos #define EF_M32C_CPU_MASK	0x0000007F	/* specific cpu bits */
5698b9484cSchristos #define EF_M32C_ALL_FLAGS	(EF_M32C_CPU_MASK)
5798b9484cSchristos 
5898b9484cSchristos /* Define the data & instruction memory discriminator.  In a linked
5998b9484cSchristos    executable, an symbol should be deemed to point to an instruction
6098b9484cSchristos    if ((address & M16C_INSN_MASK) == M16C_INSN_VALUE), and similarly
6198b9484cSchristos    for the data space.  See also `ld/emulparams/elf32m32c.sh'.  */
6298b9484cSchristos #define M32C_DATA_MASK   0xffc00000
6398b9484cSchristos #define M32C_DATA_VALUE  0x00000000
6498b9484cSchristos #define M32C_INSN_MASK   0xffc00000
6598b9484cSchristos #define M32C_INSN_VALUE  0x00400000
6698b9484cSchristos 
6798b9484cSchristos #endif /* _ELF_M32C_H */
68