1 | /* SH ELF support for BFD.
|
---|
2 | Copyright 2003 Free Software Foundation, Inc.
|
---|
3 |
|
---|
4 | This file is part of BFD, the Binary File Descriptor library.
|
---|
5 |
|
---|
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.
|
---|
10 |
|
---|
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.
|
---|
15 |
|
---|
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. */
|
---|
19 |
|
---|
20 | #ifndef ELF32_SH64_H
|
---|
21 | #define ELF32_SH64_H
|
---|
22 |
|
---|
23 | #define SH64_CRANGES_SECTION_NAME ".cranges"
|
---|
24 | enum sh64_elf_cr_type {
|
---|
25 | CRT_NONE = 0,
|
---|
26 | CRT_DATA = 1,
|
---|
27 | CRT_SH5_ISA16 = 2,
|
---|
28 | CRT_SH5_ISA32 = 3
|
---|
29 | };
|
---|
30 |
|
---|
31 | /* The official definition is this:
|
---|
32 |
|
---|
33 | typedef struct {
|
---|
34 | Elf32_Addr cr_addr;
|
---|
35 | Elf32_Word cr_size;
|
---|
36 | Elf32_Half cr_type;
|
---|
37 | } Elf32_CRange;
|
---|
38 |
|
---|
39 | but we have no use for that exact type. Instead we use this struct for
|
---|
40 | the internal representation. */
|
---|
41 | typedef struct {
|
---|
42 | bfd_vma cr_addr;
|
---|
43 | bfd_size_type cr_size;
|
---|
44 | enum sh64_elf_cr_type cr_type;
|
---|
45 | } sh64_elf_crange;
|
---|
46 |
|
---|
47 | #define SH64_CRANGE_SIZE (4 + 4 + 2)
|
---|
48 | #define SH64_CRANGE_CR_ADDR_OFFSET 0
|
---|
49 | #define SH64_CRANGE_CR_SIZE_OFFSET 4
|
---|
50 | #define SH64_CRANGE_CR_TYPE_OFFSET (4 + 4)
|
---|
51 |
|
---|
52 | /* Get the contents type of an arbitrary address, or return CRT_NONE. */
|
---|
53 | extern enum sh64_elf_cr_type sh64_get_contents_type
|
---|
54 | PARAMS ((asection *, bfd_vma, sh64_elf_crange *));
|
---|
55 |
|
---|
56 | /* Simpler interface.
|
---|
57 | FIXME: This seems redundant now that we export the interface above. */
|
---|
58 | extern bfd_boolean sh64_address_is_shmedia PARAMS ((asection *, bfd_vma));
|
---|
59 |
|
---|
60 | extern int _bfd_sh64_crange_qsort_cmpb PARAMS ((const void *, const void *));
|
---|
61 | extern int _bfd_sh64_crange_qsort_cmpl PARAMS ((const void *, const void *));
|
---|
62 | extern int _bfd_sh64_crange_bsearch_cmpb PARAMS ((const void *, const void *));
|
---|
63 | extern int _bfd_sh64_crange_bsearch_cmpl PARAMS ((const void *, const void *));
|
---|
64 |
|
---|
65 | struct sh64_section_data
|
---|
66 | {
|
---|
67 | flagword contents_flags;
|
---|
68 |
|
---|
69 | /* Only used in the cranges section, but we don't have an official
|
---|
70 | backend-specific bfd field. */
|
---|
71 | bfd_size_type cranges_growth;
|
---|
72 | };
|
---|
73 |
|
---|
74 | struct _sh64_elf_section_data
|
---|
75 | {
|
---|
76 | struct bfd_elf_section_data elf;
|
---|
77 | struct sh64_section_data *sh64_info;
|
---|
78 | };
|
---|
79 |
|
---|
80 | #define sh64_elf_section_data(sec) \
|
---|
81 | ((struct _sh64_elf_section_data *) elf_section_data (sec))
|
---|
82 |
|
---|
83 | #endif /* ELF32_SH64_H */
|
---|