Back to index

cell-binutils  2.17cvs20070401
elf32-sh64.h
Go to the documentation of this file.
00001 /* SH ELF support for BFD.
00002    Copyright 2003 Free Software Foundation, Inc.
00003 
00004    This file is part of BFD, the Binary File Descriptor library.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software Foundation,
00018    Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00019 
00020 #ifndef ELF32_SH64_H
00021 #define ELF32_SH64_H
00022 
00023 #define SH64_CRANGES_SECTION_NAME ".cranges"
00024 enum sh64_elf_cr_type {
00025   CRT_NONE = 0,
00026   CRT_DATA = 1,
00027   CRT_SH5_ISA16 = 2,
00028   CRT_SH5_ISA32 = 3
00029 };
00030 
00031 /* The official definition is this:
00032 
00033     typedef struct {
00034       Elf32_Addr cr_addr;
00035       Elf32_Word cr_size;
00036       Elf32_Half cr_type;
00037     } Elf32_CRange;
00038 
00039    but we have no use for that exact type.  Instead we use this struct for
00040    the internal representation.  */
00041 typedef struct {
00042   bfd_vma cr_addr;
00043   bfd_size_type cr_size;
00044   enum sh64_elf_cr_type cr_type;
00045 } sh64_elf_crange;
00046 
00047 #define SH64_CRANGE_SIZE (4 + 4 + 2)
00048 #define SH64_CRANGE_CR_ADDR_OFFSET 0
00049 #define SH64_CRANGE_CR_SIZE_OFFSET 4
00050 #define SH64_CRANGE_CR_TYPE_OFFSET (4 + 4)
00051 
00052 /* Get the contents type of an arbitrary address, or return CRT_NONE.  */
00053 extern enum sh64_elf_cr_type sh64_get_contents_type
00054   (asection *, bfd_vma, sh64_elf_crange *);
00055 
00056 /* Simpler interface.
00057    FIXME: This seems redundant now that we export the interface above.  */
00058 extern bfd_boolean sh64_address_is_shmedia
00059   (asection *, bfd_vma);
00060 
00061 extern int _bfd_sh64_crange_qsort_cmpb
00062   (const void *, const void *);
00063 extern int _bfd_sh64_crange_qsort_cmpl
00064   (const void *, const void *);
00065 extern int _bfd_sh64_crange_bsearch_cmpb
00066   (const void *, const void *);
00067 extern int _bfd_sh64_crange_bsearch_cmpl
00068   (const void *, const void *);
00069 
00070 struct sh64_section_data
00071 {
00072   flagword contents_flags;
00073 
00074   /* Only used in the cranges section, but we don't have an official
00075      backend-specific bfd field.  */
00076   bfd_size_type cranges_growth;
00077 };
00078 
00079 struct _sh64_elf_section_data
00080 {
00081   struct bfd_elf_section_data elf;
00082   struct sh64_section_data *sh64_info;
00083 };
00084 
00085 #define sh64_elf_section_data(sec) \
00086   ((struct _sh64_elf_section_data *) elf_section_data (sec))
00087 
00088 #endif /* ELF32_SH64_H */