1 /* Freescale XGATE-specific support for 32-bit ELF
2 Copyright (C) 2012-2016 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_merge_private_bfd_data (bfd
*,bfd
*);
33 extern bfd_boolean
_bfd_xgate_elf_set_private_flags (bfd
*,flagword
);
34 extern bfd_boolean
_bfd_xgate_elf_print_private_bfd_data (bfd
*, void*);
36 struct elf32_xgate_stub_hash_entry
38 /* Base hash table entry structure. */
39 struct bfd_hash_entry root
;
41 /* The stub section. */
44 /* Offset within stub_sec of the beginning of this stub. */
47 /* Given the symbol's value and its section we can determine its final
48 value when building the stubs (so the stub knows where to jump. */
50 asection
*target_section
;
53 struct xgate_page_info
56 bfd_vma bank_physical
;
57 bfd_vma bank_physical_end
;
61 int bank_param_initialized
;
62 bfd_vma trampoline_addr
;
65 struct xgate_elf_link_hash_table
67 struct elf_link_hash_table root
;
68 struct xgate_page_info pinfo
;
70 /* The stub hash table. */
71 struct bfd_hash_table
* stub_hash_table
;
73 /* Linker stub bfd. */
76 asection
* stub_section
;
77 asection
* tramp_section
;
79 /* Linker call-backs. */
80 asection
* (*add_stub_section
) (const char *, asection
*);
82 /* Assorted information used by elf32_hppa_size_stubs. */
83 unsigned int bfd_count
;
85 asection
** input_list
;
87 /* Small local sym cache. */
88 struct sym_cache sym_cache
;
90 bfd_boolean (*size_one_stub
) (struct bfd_hash_entry
*, void*);
91 bfd_boolean (*build_one_stub
) (struct bfd_hash_entry
*, void*);
94 /* Get the XGate ELF linker hash table from a link_info structure. */
96 #define xgate_elf_hash_table(p) \
97 ((struct xgate_elf_link_hash_table *) ((p)->hash))
99 /* Create a XGATE ELF linker hash table. */
101 extern struct xgate_elf_link_hash_table
* xgate_elf_hash_table_create
104 extern void xgate_elf_get_bank_parameters (struct bfd_link_info
*);
106 /* Return 1 if the address is in banked memory.
107 This can be applied to a virtual address and to a physical address. */
108 extern int xgate_addr_is_banked (struct xgate_page_info
*, bfd_vma
);
110 /* Return the physical address seen by the processor, taking
111 into account banked memory. */
112 extern bfd_vma
xgate_phys_addr (struct xgate_page_info
*, bfd_vma
);
114 /* Return the page number corresponding to an address in banked memory. */
115 extern bfd_vma
xgate_phys_page (struct xgate_page_info
*, bfd_vma
);
117 bfd_reloc_status_type xgate_elf_ignore_reloc
118 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
119 bfd_reloc_status_type xgate_elf_special_reloc
120 (bfd
*, arelent
*, asymbol
*, void *, asection
*, bfd
*, char **);
122 bfd_boolean elf32_xgate_check_relocs
123 (bfd
*, struct bfd_link_info
*, asection
*, const Elf_Internal_Rela
*);
124 bfd_boolean elf32_xgate_relocate_section
125 (bfd
*, struct bfd_link_info
*, bfd
*, asection
*, bfd_byte
*,
126 Elf_Internal_Rela
*, Elf_Internal_Sym
*, asection
**);
128 bfd_boolean elf32_xgate_add_symbol_hook
129 (bfd
*, struct bfd_link_info
*, Elf_Internal_Sym
*, const char **,
130 flagword
*, asection
**, bfd_vma
*);
132 /* Tweak the OSABI field of the elf header. */
133 extern void elf32_xgate_post_process_headers (bfd
*, struct bfd_link_info
*);
135 int elf32_xgate_setup_section_lists (bfd
*, struct bfd_link_info
*);
137 bfd_boolean elf32_xgate_size_stubs
138 (bfd
*, bfd
*, struct bfd_link_info
*,
139 asection
* (*) (const char *, asection
*));
141 bfd_boolean
elf32_xgate_build_stubs (bfd
* abfd
, struct bfd_link_info
*);
143 #endif /* _ELF32_XGATE_H */