xref: /netbsd-src/external/gpl3/binutils/dist/include/elf/m32c.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
12a6b7db3Sskrll /* M32C ELF support for BFD.
2*cb63e24eSchristos    Copyright (C) 2004-2024 Free Software Foundation, Inc.
32a6b7db3Sskrll 
42a6b7db3Sskrll    This file is part of BFD, the Binary File Descriptor library.
52a6b7db3Sskrll 
62a6b7db3Sskrll    This program is free software; you can redistribute it and/or modify
72a6b7db3Sskrll    it under the terms of the GNU General Public License as published by
845548106Schristos    the Free Software Foundation; either version 3 of the License, or
92a6b7db3Sskrll    (at your option) any later version.
102a6b7db3Sskrll 
112a6b7db3Sskrll    This program is distributed in the hope that it will be useful,
122a6b7db3Sskrll    but WITHOUT ANY WARRANTY; without even the implied warranty of
132a6b7db3Sskrll    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
142a6b7db3Sskrll    GNU General Public License for more details.
152a6b7db3Sskrll 
162a6b7db3Sskrll    You should have received a copy of the GNU General Public License
1745548106Schristos    along with this program; if not, write to the Free Software Foundation,
1845548106Schristos    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
192a6b7db3Sskrll 
202a6b7db3Sskrll #ifndef _ELF_M32C_H
212a6b7db3Sskrll #define _ELF_M32C_H
222a6b7db3Sskrll 
232a6b7db3Sskrll #include "elf/reloc-macros.h"
242a6b7db3Sskrll 
252a6b7db3Sskrll   /* Relocations.  */
262a6b7db3Sskrll   START_RELOC_NUMBERS (elf_m32c_reloc_type)
272a6b7db3Sskrll      RELOC_NUMBER (R_M32C_NONE, 0)
282a6b7db3Sskrll      RELOC_NUMBER (R_M32C_16, 1)
292a6b7db3Sskrll      RELOC_NUMBER (R_M32C_24, 2)
302a6b7db3Sskrll      RELOC_NUMBER (R_M32C_32, 3)
312a6b7db3Sskrll      RELOC_NUMBER (R_M32C_8_PCREL, 4)
322a6b7db3Sskrll      RELOC_NUMBER (R_M32C_16_PCREL, 5)
332a6b7db3Sskrll 
342a6b7db3Sskrll     /* 8 bit unsigned address, used for dsp8[a0] etc */
352a6b7db3Sskrll      RELOC_NUMBER (R_M32C_8, 6)
362a6b7db3Sskrll     /* Bits 0..15 of an address, for SMOVF's A0, A1A0, etc. */
372a6b7db3Sskrll      RELOC_NUMBER (R_M32C_LO16, 7)
382a6b7db3Sskrll     /* Bits 16..23 of an address, for SMOVF's R1H etc. */
392a6b7db3Sskrll      RELOC_NUMBER (R_M32C_HI8, 8)
402a6b7db3Sskrll     /* Bits 16..31 of an address, for LDE's A1A0 etc. */
412a6b7db3Sskrll      RELOC_NUMBER (R_M32C_HI16, 9)
422a6b7db3Sskrll 
432a6b7db3Sskrll     /* These are relocs we need when relaxing.  */
442a6b7db3Sskrll     /* Marks various jump opcodes.  */
452a6b7db3Sskrll      RELOC_NUMBER (R_M32C_RL_JUMP, 10)
462a6b7db3Sskrll     /* Marks standard one-address form.  */
472a6b7db3Sskrll      RELOC_NUMBER (R_M32C_RL_1ADDR, 11)
482a6b7db3Sskrll     /* Marks standard two-address form.  */
492a6b7db3Sskrll      RELOC_NUMBER (R_M32C_RL_2ADDR, 12)
502a6b7db3Sskrll 
512a6b7db3Sskrll      END_RELOC_NUMBERS (R_M32C_max)
522a6b7db3Sskrll 
532a6b7db3Sskrll #define EF_M32C_CPU_M16C	0x00000075      /* default */
542a6b7db3Sskrll #define EF_M32C_CPU_M32C        0x00000078      /* m32c */
552a6b7db3Sskrll #define EF_M32C_CPU_MASK	0x0000007F	/* specific cpu bits */
562a6b7db3Sskrll #define EF_M32C_ALL_FLAGS	(EF_M32C_CPU_MASK)
572a6b7db3Sskrll 
582a6b7db3Sskrll /* Define the data & instruction memory discriminator.  In a linked
592a6b7db3Sskrll    executable, an symbol should be deemed to point to an instruction
602a6b7db3Sskrll    if ((address & M16C_INSN_MASK) == M16C_INSN_VALUE), and similarly
612a6b7db3Sskrll    for the data space.  See also `ld/emulparams/elf32m32c.sh'.  */
622a6b7db3Sskrll #define M32C_DATA_MASK   0xffc00000
632a6b7db3Sskrll #define M32C_DATA_VALUE  0x00000000
642a6b7db3Sskrll #define M32C_INSN_MASK   0xffc00000
652a6b7db3Sskrll #define M32C_INSN_VALUE  0x00400000
662a6b7db3Sskrll 
672a6b7db3Sskrll #endif /* _ELF_M32C_H */
68