xref: /netbsd-src/external/gpl3/binutils.old/dist/include/elf/m32c.h (revision e992f068c547fd6e84b3f104dc2340adcc955732)
175fd0b74Schristos /* M32C ELF support for BFD.
2*e992f068Schristos    Copyright (C) 2004-2022 Free Software Foundation, Inc.
375fd0b74Schristos 
475fd0b74Schristos    This file is part of BFD, the Binary File Descriptor library.
575fd0b74Schristos 
675fd0b74Schristos    This program is free software; you can redistribute it and/or modify
775fd0b74Schristos    it under the terms of the GNU General Public License as published by
875fd0b74Schristos    the Free Software Foundation; either version 3 of the License, or
975fd0b74Schristos    (at your option) any later version.
1075fd0b74Schristos 
1175fd0b74Schristos    This program is distributed in the hope that it will be useful,
1275fd0b74Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
1375fd0b74Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1475fd0b74Schristos    GNU General Public License for more details.
1575fd0b74Schristos 
1675fd0b74Schristos    You should have received a copy of the GNU General Public License
1775fd0b74Schristos    along with this program; if not, write to the Free Software Foundation,
1875fd0b74Schristos    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
1975fd0b74Schristos 
2075fd0b74Schristos #ifndef _ELF_M32C_H
2175fd0b74Schristos #define _ELF_M32C_H
2275fd0b74Schristos 
2375fd0b74Schristos #include "elf/reloc-macros.h"
2475fd0b74Schristos 
2575fd0b74Schristos   /* Relocations.  */
2675fd0b74Schristos   START_RELOC_NUMBERS (elf_m32c_reloc_type)
2775fd0b74Schristos      RELOC_NUMBER (R_M32C_NONE, 0)
2875fd0b74Schristos      RELOC_NUMBER (R_M32C_16, 1)
2975fd0b74Schristos      RELOC_NUMBER (R_M32C_24, 2)
3075fd0b74Schristos      RELOC_NUMBER (R_M32C_32, 3)
3175fd0b74Schristos      RELOC_NUMBER (R_M32C_8_PCREL, 4)
3275fd0b74Schristos      RELOC_NUMBER (R_M32C_16_PCREL, 5)
3375fd0b74Schristos 
3475fd0b74Schristos     /* 8 bit unsigned address, used for dsp8[a0] etc */
3575fd0b74Schristos      RELOC_NUMBER (R_M32C_8, 6)
3675fd0b74Schristos     /* Bits 0..15 of an address, for SMOVF's A0, A1A0, etc. */
3775fd0b74Schristos      RELOC_NUMBER (R_M32C_LO16, 7)
3875fd0b74Schristos     /* Bits 16..23 of an address, for SMOVF's R1H etc. */
3975fd0b74Schristos      RELOC_NUMBER (R_M32C_HI8, 8)
4075fd0b74Schristos     /* Bits 16..31 of an address, for LDE's A1A0 etc. */
4175fd0b74Schristos      RELOC_NUMBER (R_M32C_HI16, 9)
4275fd0b74Schristos 
4375fd0b74Schristos     /* These are relocs we need when relaxing.  */
4475fd0b74Schristos     /* Marks various jump opcodes.  */
4575fd0b74Schristos      RELOC_NUMBER (R_M32C_RL_JUMP, 10)
4675fd0b74Schristos     /* Marks standard one-address form.  */
4775fd0b74Schristos      RELOC_NUMBER (R_M32C_RL_1ADDR, 11)
4875fd0b74Schristos     /* Marks standard two-address form.  */
4975fd0b74Schristos      RELOC_NUMBER (R_M32C_RL_2ADDR, 12)
5075fd0b74Schristos 
5175fd0b74Schristos      END_RELOC_NUMBERS (R_M32C_max)
5275fd0b74Schristos 
5375fd0b74Schristos #define EF_M32C_CPU_M16C	0x00000075      /* default */
5475fd0b74Schristos #define EF_M32C_CPU_M32C        0x00000078      /* m32c */
5575fd0b74Schristos #define EF_M32C_CPU_MASK	0x0000007F	/* specific cpu bits */
5675fd0b74Schristos #define EF_M32C_ALL_FLAGS	(EF_M32C_CPU_MASK)
5775fd0b74Schristos 
5875fd0b74Schristos /* Define the data & instruction memory discriminator.  In a linked
5975fd0b74Schristos    executable, an symbol should be deemed to point to an instruction
6075fd0b74Schristos    if ((address & M16C_INSN_MASK) == M16C_INSN_VALUE), and similarly
6175fd0b74Schristos    for the data space.  See also `ld/emulparams/elf32m32c.sh'.  */
6275fd0b74Schristos #define M32C_DATA_MASK   0xffc00000
6375fd0b74Schristos #define M32C_DATA_VALUE  0x00000000
6475fd0b74Schristos #define M32C_INSN_MASK   0xffc00000
6575fd0b74Schristos #define M32C_INSN_VALUE  0x00400000
6675fd0b74Schristos 
6775fd0b74Schristos #endif /* _ELF_M32C_H */
68