xref: /netbsd/external/gpl3/gdb/dist/include/elf/m68hc11.h (revision 1424dfb3)
1c5dff60aSchristos /* m68hc11 & m68hc12 ELF support for BFD.
2*1424dfb3Schristos    Copyright (C) 1999-2020 Free Software Foundation, Inc.
3c5dff60aSchristos 
4c5dff60aSchristos    This file is part of BFD, the Binary File Descriptor library.
5c5dff60aSchristos 
6c5dff60aSchristos    This program is free software; you can redistribute it and/or modify
7c5dff60aSchristos    it under the terms of the GNU General Public License as published by
8c5dff60aSchristos    the Free Software Foundation; either version 3 of the License, or
9c5dff60aSchristos    (at your option) any later version.
10c5dff60aSchristos 
11c5dff60aSchristos    This program is distributed in the hope that it will be useful,
12c5dff60aSchristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
13c5dff60aSchristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14c5dff60aSchristos    GNU General Public License for more details.
15c5dff60aSchristos 
16c5dff60aSchristos    You should have received a copy of the GNU General Public License
17c5dff60aSchristos    along with this program; if not, write to the Free Software Foundation,
18c5dff60aSchristos    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
19c5dff60aSchristos 
20c5dff60aSchristos #ifndef _ELF_M68HC11_H
21c5dff60aSchristos #define _ELF_M68HC11_H
22c5dff60aSchristos 
23c5dff60aSchristos #include "elf/reloc-macros.h"
24c5dff60aSchristos 
25c5dff60aSchristos /* Relocation types.  */
26c5dff60aSchristos START_RELOC_NUMBERS (elf_m68hc11_reloc_type)
27c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_NONE, 0)
28c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_8, 1)
29c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_HI8, 2)
30c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_LO8, 3)
31c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_PCREL_8, 4)
32c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_16, 5)
33c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_32, 6)
34c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_3B, 7)
35c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_PCREL_16, 8)
36c5dff60aSchristos 
37c5dff60aSchristos      /* These are GNU extensions to enable C++ vtable garbage collection.  */
38c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_GNU_VTINHERIT, 9)
39c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_GNU_VTENTRY, 10)
40c5dff60aSchristos 
41c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_24, 11)
42c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_LO16, 12)
43c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_PAGE, 13)
44c5dff60aSchristos 
4548596154Schristos   RELOC_NUMBER (R_M68HC12_16B, 15)
4648596154Schristos   RELOC_NUMBER (R_M68HC12_PCREL_9, 16)
4748596154Schristos   RELOC_NUMBER (R_M68HC12_PCREL_10, 17)
4848596154Schristos   RELOC_NUMBER (R_M68HC12_HI8XG, 18)
4948596154Schristos   RELOC_NUMBER (R_M68HC12_LO8XG, 19)
5048596154Schristos 
51c5dff60aSchristos      /* GNU extension for linker relaxation.
52c5dff60aSchristos         Mark beginning of a jump instruction (any form).  */
53c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_RL_JUMP, 20)
54c5dff60aSchristos 
55c5dff60aSchristos      /* Mark beginning of Gcc relaxation group instruction.  */
56c5dff60aSchristos   RELOC_NUMBER (R_M68HC11_RL_GROUP, 21)
57c5dff60aSchristos END_RELOC_NUMBERS (R_M68HC11_max)
58c5dff60aSchristos 
59c5dff60aSchristos /* Processor specific flags for the ELF header e_flags field.  */
60c5dff60aSchristos 
61c5dff60aSchristos /* ABI identification.  */
62c5dff60aSchristos #define EF_M68HC11_ABI  0x00000000F
63c5dff60aSchristos 
64c5dff60aSchristos /* Integers are 32-bit long.  */
65c5dff60aSchristos #define E_M68HC11_I32   0x000000001
66c5dff60aSchristos 
67c5dff60aSchristos /* Doubles are 64-bit long.  */
68c5dff60aSchristos #define E_M68HC11_F64   0x000000002
69c5dff60aSchristos 
70c5dff60aSchristos /* Uses 68HC12 memory banks.  */
71c5dff60aSchristos #define E_M68HC12_BANKS 0x000000004
72c5dff60aSchristos 
7348596154Schristos /* XGATE ram offsetting.  */
7448596154Schristos #define E_M68HC11_XGATE_RAMOFFSET     0x000000100
7548596154Schristos 
7648596154Schristos /* Suppress warnings */
7748596154Schristos #define E_M68HC11_NO_BANK_WARNING     0x000000200
7848596154Schristos 
79c5dff60aSchristos #define EF_M68HC11_MACH_MASK 0xF0
80c5dff60aSchristos #define EF_M68HC11_GENERIC   0x00 /* Generic 68HC12/backward compatibility.  */
81c5dff60aSchristos #define EF_M68HC12_MACH      0x10 /* 68HC12 microcontroller.  */
82c5dff60aSchristos #define EF_M68HCS12_MACH     0x20 /* 68HCS12 microcontroller.  */
83c5dff60aSchristos #define EF_M68HC11_MACH(mach) ((mach) & EF_M68HC11_MACH_MASK)
84c5dff60aSchristos 
85c5dff60aSchristos /* True if we can merge machines.  A generic HC12 can work on any proc
86c5dff60aSchristos    but once we have specific code, merge is not possible.  */
87c5dff60aSchristos #define EF_M68HC11_CAN_MERGE_MACH(mach1, mach2) \
88c5dff60aSchristos   ((EF_M68HC11_MACH (mach1) == EF_M68HC11_MACH (mach2)) \
89c5dff60aSchristos    || (EF_M68HC11_MACH (mach1) == EF_M68HC11_GENERIC) \
90c5dff60aSchristos    || (EF_M68HC11_MACH (mach2) == EF_M68HC11_GENERIC))
91c5dff60aSchristos 
92c5dff60aSchristos #define EF_M68HC11_MERGE_MACH(mach1, mach2) \
93c5dff60aSchristos   (((EF_M68HC11_MACH (mach1) == EF_M68HC11_MACH (mach2)) \
94c5dff60aSchristos     || (EF_M68HC11_MACH (mach1) == EF_M68HC11_GENERIC)) ? \
95c5dff60aSchristos       EF_M68HC11_MACH (mach2) : EF_M68HC11_MACH (mach1))
96c5dff60aSchristos 
97c5dff60aSchristos 
98c5dff60aSchristos /* Special values for the st_other field in the symbol table.  These
99c5dff60aSchristos    are used for 68HC12 to identify far functions (must be called with
100c5dff60aSchristos    'call' and returns with 'rtc').  */
101c5dff60aSchristos #define STO_M68HC12_FAR          0x80
102c5dff60aSchristos 
103c5dff60aSchristos /* Identify interrupt handlers.  This is used by the debugger to
104c5dff60aSchristos    correctly compute the stack frame.  */
105c5dff60aSchristos #define STO_M68HC12_INTERRUPT    0x40
106c5dff60aSchristos 
107c5dff60aSchristos #endif
108