2000-05-29 Philip Blundell <philb@gnu.org>
[binutils.git] / include / elf / sh.h
blob2b132c1cb3b8a68e5780f007a7220ef51f828b9b
1 /* SH ELF support for BFD.
2 Copyright (C) 1998, 2000 Free Software Foundation, Inc.
4 This file is part of BFD, the Binary File Descriptor library.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 #ifndef _ELF_SH_H
21 #define _ELF_SH_H
23 /* Processor specific flags for the ELF header e_flags field. */
25 #define EF_SH_MACH_MASK 0x1f
26 #define EF_SH_UNKNOWN 0 /* For backwards compatibility. */
27 #define EF_SH1 1
28 #define EF_SH2 2
29 #define EF_SH3 3
30 #define EF_SH_HAS_DSP(flags) ((flags) & 4)
31 #define EF_SH_DSP 4
32 #define EF_SH3_DSP 5
33 #define EF_SH_HAS_FP(flags) ((flags) & 8)
34 #define EF_SH3E 8
35 #define EF_SH4 9
37 #define EF_SH_MERGE_MACH(mach1, mach2) \
38 (((((mach1) == EF_SH3 || (mach1) == EF_SH_UNKNOWN) && (mach2) == EF_SH_DSP) \
39 || ((mach1) == EF_SH_DSP \
40 && ((mach2) == EF_SH3 || (mach2) == EF_SH_UNKNOWN))) \
41 ? EF_SH3_DSP \
42 : (((mach1) < EF_SH3 && (mach2) == EF_SH_UNKNOWN) \
43 || ((mach2) < EF_SH3 && (mach1) == EF_SH_UNKNOWN)) \
44 ? EF_SH3 \
45 : (((mach1) == EF_SH3E && (mach2) == EF_SH_UNKNOWN) \
46 || ((mach2) == EF_SH3E && (mach1) == EF_SH_UNKNOWN)) \
47 ? EF_SH4 \
48 : ((mach1) > (mach2) ? (mach1) : (mach2)))
50 #include "elf/reloc-macros.h"
52 /* Relocations. */
53 /* Relocations 25ff are GNU extensions.
54 25..33 are used for relaxation and use the same constants as COFF uses. */
55 START_RELOC_NUMBERS (elf_sh_reloc_type)
56 RELOC_NUMBER (R_SH_NONE, 0)
57 RELOC_NUMBER (R_SH_DIR32, 1)
58 RELOC_NUMBER (R_SH_REL32, 2)
59 RELOC_NUMBER (R_SH_DIR8WPN, 3)
60 RELOC_NUMBER (R_SH_IND12W, 4)
61 RELOC_NUMBER (R_SH_DIR8WPL, 5)
62 RELOC_NUMBER (R_SH_DIR8WPZ, 6)
63 RELOC_NUMBER (R_SH_DIR8BP, 7)
64 RELOC_NUMBER (R_SH_DIR8W, 8)
65 RELOC_NUMBER (R_SH_DIR8L, 9)
66 FAKE_RELOC (R_SH_FIRST_INVALID_RELOC, 10)
67 FAKE_RELOC (R_SH_LAST_INVALID_RELOC, 24)
68 RELOC_NUMBER (R_SH_SWITCH16, 25)
69 RELOC_NUMBER (R_SH_SWITCH32, 26)
70 RELOC_NUMBER (R_SH_USES, 27)
71 RELOC_NUMBER (R_SH_COUNT, 28)
72 RELOC_NUMBER (R_SH_ALIGN, 29)
73 RELOC_NUMBER (R_SH_CODE, 30)
74 RELOC_NUMBER (R_SH_DATA, 31)
75 RELOC_NUMBER (R_SH_LABEL, 32)
76 RELOC_NUMBER (R_SH_SWITCH8, 33)
77 RELOC_NUMBER (R_SH_GNU_VTINHERIT, 34)
78 RELOC_NUMBER (R_SH_GNU_VTENTRY, 35)
79 RELOC_NUMBER (R_SH_LOOP_START, 36)
80 RELOC_NUMBER (R_SH_LOOP_END, 37)
81 EMPTY_RELOC (R_SH_max)
82 END_RELOC_NUMBERS
84 #endif