1 /* Freescale XGATE-specific support for 32-bit ELF
2 Copyright (C) 2012-2017 Free Software Foundation, Inc.
4 Contributed by Sean Keys (skeys@ipdatasys.com)
5 (Heavily copied from the HC11 port by Stephane Carrez (stcarrez@nerim.fr))
7 This file is part of BFD, the Binary File Descriptor library.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
22 MA 02110-1301, USA. */
24 #ifndef _ELF32_XGATE_H
25 #define _ELF32_XGATE_H
29 #include "elf/xgate.h"
31 /* Set and control ELF flags in ELF header. */
32 extern bfd_boolean
_bfd_xgate_elf_set_private_flags (bfd
*,flagword
);
33 extern bfd_boolean
_bfd_xgate_elf_print_private_bfd_data (bfd
*, void*);
35 struct elf32_xgate_stub_hash_entry
37 /* Base hash table entry structure. */
38 struct bfd_hash_entry root
;
40 /* The stub section. */
43 /* Offset within stub_sec of the beginning of this stub. */
46 /* Given the symbol's value and its section we can determine its final
47 value when building the stubs (so the stub knows where to jump. */
49 asection
*target_section
;
52 struct xgate_page_info
55 bfd_vma bank_physical
;
56 bfd_vma bank_physical_end
;
60 int bank_param_initialized
;
61 bfd_vma trampoline_addr
;
64 struct xgate_elf_link_hash_table
66 struct elf_link_hash_table root
;
67 struct xgate_page_info pinfo
;
69 /* The stub hash table. */
70 struct bfd_hash_table
* stub_hash_table
;
72 /* Linker stub bfd. */
75 asection
* stub_section
;
76 asection
* tramp_section
;
78 /* Linker call-backs. */
79 asection
* (*add_stub_section
) (const char *, asection
*);
81 /* Assorted information used by elf32_hppa_size_stubs. */
82 unsigned int bfd_count
;
84 asection
** input_list
;
86 /* Small local sym cache. */
87 struct sym_cache sym_cache
;
89 bfd_boolean (*size_one_stub
) (struct bfd_hash_entry
*, void*);
90 bfd_boolean (*build_one_stub
) (struct bfd_hash_entry
*, void*);
93 /* Get the XGate ELF linker hash table from a link_info structure. */
95 #define xgate_elf_hash_table(p) \
96 ((struct xgate_elf_link_hash_table *) ((p)->hash))
98 /* Create a XGATE ELF linker hash table. */
100 extern struct xgate_elf_link_hash_table
* xgate_elf_hash_table_create
103 extern void xgate_elf_get_bank_parameters (struct bfd_link_info
*);
105 /* Return 1 if the address is in banked memory.
106 This can be applied to a virtual address and to a physical address. */
107 extern int xgate_addr_is_banked (struct xgate_page_info
*, bfd_vma
);
109 /* Return the physical address seen by the processor, taking
110 into account banked memory. */
111 extern bfd_vma
xgate_phys_addr (struct xgate_page_info
*, bfd_vma
);
113 /* Return the page number corresponding to an address in banked memory. */
114 extern bfd_vma
xgate_phys_page (struct xgate_page_info
*, bfd_vma
);
116 bfd_reloc_status_type xgate_elf_ignore_reloc
117 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
118 bfd_reloc_status_type xgate_elf_special_reloc
119 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
121 bfd_boolean elf32_xgate_check_relocs
122 (bfd
*, struct bfd_link_info
*, asection
*, const Elf_Internal_Rela
*);
123 bfd_boolean elf32_xgate_relocate_section
124 (bfd
*, struct bfd_link_info
*, bfd
*, asection
*, bfd_byte
*,
125 Elf_Internal_Rela
*, Elf_Internal_Sym
*, asection
**);
127 bfd_boolean elf32_xgate_add_symbol_hook
128 (bfd
*, struct bfd_link_info
*, Elf_Internal_Sym
*, const char **,
129 flagword
*, asection
**, bfd_vma
*);
131 /* Tweak the OSABI field of the elf header. */
132 extern void elf32_xgate_post_process_headers (bfd
*, struct bfd_link_info
*);
134 int elf32_xgate_setup_section_lists (bfd
*, struct bfd_link_info
*);
136 bfd_boolean elf32_xgate_size_stubs
137 (bfd
*, bfd
*, struct bfd_link_info
*,
138 asection
* (*) (const char *, asection
*));
140 bfd_boolean
elf32_xgate_build_stubs (bfd
* abfd
, struct bfd_link_info
*);
142 #endif /* _ELF32_XGATE_H */