177298Sobrien/* m68hc11 & m68hc12 ELF support for BFD.
2130561Sobrien   Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
377298Sobrien
477298Sobrien   This file is part of BFD, the Binary File Descriptor library.
577298Sobrien
677298Sobrien   This program is free software; you can redistribute it and/or modify
777298Sobrien   it under the terms of the GNU General Public License as published by
877298Sobrien   the Free Software Foundation; either version 2 of the License, or
977298Sobrien   (at your option) any later version.
1077298Sobrien
1177298Sobrien   This program is distributed in the hope that it will be useful,
1277298Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1377298Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1477298Sobrien   GNU General Public License for more details.
1577298Sobrien
1677298Sobrien   You should have received a copy of the GNU General Public License
1777298Sobrien   along with this program; if not, write to the Free Software Foundation,
18218822Sdim   Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
1977298Sobrien
2077298Sobrien#ifndef _ELF_M68HC11_H
2177298Sobrien#define _ELF_M68HC11_H
2277298Sobrien
2377298Sobrien#include "elf/reloc-macros.h"
2477298Sobrien
2577298Sobrien/* Relocation types.  */
2677298SobrienSTART_RELOC_NUMBERS (elf_m68hc11_reloc_type)
2777298Sobrien  RELOC_NUMBER (R_M68HC11_NONE, 0)
2877298Sobrien  RELOC_NUMBER (R_M68HC11_8, 1)
2977298Sobrien  RELOC_NUMBER (R_M68HC11_HI8, 2)
3077298Sobrien  RELOC_NUMBER (R_M68HC11_LO8, 3)
3177298Sobrien  RELOC_NUMBER (R_M68HC11_PCREL_8, 4)
3277298Sobrien  RELOC_NUMBER (R_M68HC11_16, 5)
3377298Sobrien  RELOC_NUMBER (R_M68HC11_32, 6)
3477298Sobrien  RELOC_NUMBER (R_M68HC11_3B, 7)
3577298Sobrien  RELOC_NUMBER (R_M68HC11_PCREL_16, 8)
3677298Sobrien
3777298Sobrien     /* These are GNU extensions to enable C++ vtable garbage collection.  */
3877298Sobrien  RELOC_NUMBER (R_M68HC11_GNU_VTINHERIT, 9)
3977298Sobrien  RELOC_NUMBER (R_M68HC11_GNU_VTENTRY, 10)
40130561Sobrien
41130561Sobrien  RELOC_NUMBER (R_M68HC11_24, 11)
42130561Sobrien  RELOC_NUMBER (R_M68HC11_LO16, 12)
43130561Sobrien  RELOC_NUMBER (R_M68HC11_PAGE, 13)
44130561Sobrien
45130561Sobrien     /* GNU extension for linker relaxation.
46130561Sobrien        Mark beginning of a jump instruction (any form).  */
47130561Sobrien  RELOC_NUMBER (R_M68HC11_RL_JUMP, 20)
48130561Sobrien
49130561Sobrien     /* Mark beginning of Gcc relaxation group instruction.  */
50130561Sobrien  RELOC_NUMBER (R_M68HC11_RL_GROUP, 21)
5177298SobrienEND_RELOC_NUMBERS (R_M68HC11_max)
5277298Sobrien
53130561Sobrien/* Processor specific flags for the ELF header e_flags field.  */
54130561Sobrien
55130561Sobrien/* ABI identification.  */
56130561Sobrien#define EF_M68HC11_ABI  0x00000000F
57130561Sobrien
58130561Sobrien/* Integers are 32-bit long.  */
59130561Sobrien#define E_M68HC11_I32   0x000000001
60130561Sobrien
61130561Sobrien/* Doubles are 64-bit long.  */
62130561Sobrien#define E_M68HC11_F64   0x000000002
63130561Sobrien
64130561Sobrien/* Uses 68HC12 memory banks.  */
65130561Sobrien#define E_M68HC12_BANKS 0x000000004
66130561Sobrien
67130561Sobrien#define EF_M68HC11_MACH_MASK 0xF0
68130561Sobrien#define EF_M68HC11_GENERIC   0x00 /* Generic 68HC12/backward compatibility.  */
69130561Sobrien#define EF_M68HC12_MACH      0x10 /* 68HC12 microcontroller.  */
70130561Sobrien#define EF_M68HCS12_MACH     0x20 /* 68HCS12 microcontroller.  */
71130561Sobrien#define EF_M68HC11_MACH(mach) ((mach) & EF_M68HC11_MACH_MASK)
72130561Sobrien
73130561Sobrien/* True if we can merge machines.  A generic HC12 can work on any proc
74130561Sobrien   but once we have specific code, merge is not possible.  */
75130561Sobrien#define EF_M68HC11_CAN_MERGE_MACH(mach1, mach2) \
76130561Sobrien  ((EF_M68HC11_MACH (mach1) == EF_M68HC11_MACH (mach2)) \
77130561Sobrien   || (EF_M68HC11_MACH (mach1) == EF_M68HC11_GENERIC) \
78130561Sobrien   || (EF_M68HC11_MACH (mach2) == EF_M68HC11_GENERIC))
79130561Sobrien
80130561Sobrien#define EF_M68HC11_MERGE_MACH(mach1, mach2) \
81130561Sobrien  (((EF_M68HC11_MACH (mach1) == EF_M68HC11_MACH (mach2)) \
82130561Sobrien    || (EF_M68HC11_MACH (mach1) == EF_M68HC11_GENERIC)) ? \
83130561Sobrien      EF_M68HC11_MACH (mach2) : EF_M68HC11_MACH (mach1))
84130561Sobrien
85130561Sobrien
86130561Sobrien/* Special values for the st_other field in the symbol table.  These
87130561Sobrien   are used for 68HC12 to identify far functions (must be called with
88130561Sobrien   'call' and returns with 'rtc').  */
89130561Sobrien#define STO_M68HC12_FAR 0x80
90130561Sobrien
91130561Sobrien/* Identify interrupt handlers.  This is used by the debugger to
92130561Sobrien   correctly compute the stack frame.  */
93130561Sobrien#define STO_M68HC12_INTERRUPT 0x40
94130561Sobrien
9577298Sobrien#endif
96