OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [bfd/] [elf32-m68hc1x.h] - Blame information for rev 166

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 khays
/* Motorola 68HC11/68HC12-specific support for 32-bit ELF
2 166 khays
   Copyright 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2012
3 14 khays
   Free Software Foundation, Inc.
4
   Contributed by Stephane Carrez (stcarrez@nerim.fr)
5
 
6
   This file is part of BFD, the Binary File Descriptor library.
7
 
8
   This program is free software; you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation; either version 3 of the License, or
11
   (at your option) any later version.
12
 
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
 
18
   You should have received a copy of the GNU General Public License
19
   along with this program; if not, write to the Free Software
20
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21
   MA 02110-1301, USA.  */
22
 
23
#ifndef _ELF32_M68HC1X_H
24
#define _ELF32_M68HC1X_H
25
 
26
#include "elf-bfd.h"
27
#include "bfdlink.h"
28
#include "elf/m68hc11.h"
29
 
30
/* Name of symbols exported by HC11/HC12 linker when there is a memory
31
   bank window.  */
32
#define BFD_M68HC11_BANK_START_NAME   "__bank_start"
33
#define BFD_M68HC11_BANK_SIZE_NAME    "__bank_size"
34
#define BFD_M68HC11_BANK_VIRTUAL_NAME "__bank_virtual"
35
 
36
/* Set and control ELF flags in ELF header.  */
37
extern bfd_boolean _bfd_m68hc11_elf_merge_private_bfd_data (bfd*,bfd*);
38
extern bfd_boolean _bfd_m68hc11_elf_set_private_flags (bfd*,flagword);
39
extern bfd_boolean _bfd_m68hc11_elf_print_private_bfd_data (bfd*, void*);
40
 
41
/* This hash entry is used to record a trampoline that must be generated
42
   to call a far function using a normal calling convention ('jsr').
43
   The trampoline is used when a pointer to a far function is used.
44
   It takes care of installing the proper memory bank as well as creating
45
   the 'call/rtc' calling convention.  */
46
struct elf32_m68hc11_stub_hash_entry
47
{
48
  /* Base hash table entry structure.  */
49
  struct bfd_hash_entry root;
50
 
51
  /* The stub section.  */
52
  asection *stub_sec;
53
 
54
  /* Offset within stub_sec of the beginning of this stub.  */
55
  bfd_vma stub_offset;
56
 
57
  /* Given the symbol's value and its section we can determine its final
58
     value when building the stubs (so the stub knows where to jump.  */
59
  bfd_vma target_value;
60
  asection *target_section;
61
};
62
 
63
/* Placeholder for the parameters to compute memory page and physical address.
64
   The following formulas are used:
65
 
66
   sym > bank_virtual =>
67
     %addr(sym) = (((sym - bank_virtual) & bank_mask) + bank_physical
68
     %page(sym) = (((sym - bank_virtual) >> bank_shift) % 256
69
 
70
   sym < bank_virtual =>
71
     %addr(sym) = sym
72
     %page(sym) = 0
73
 
74
 
75
   These parameters are obtained from the symbol table by looking
76
   at the following:
77
 
78
   __bank_start         Symbol marking the start of memory bank window
79
                        (bank_physical)
80
   __bank_virtual       Logical address of symbols for which the transformation
81
                        must be computed
82
   __bank_page_size     Size in bytes of page size (this is *NOT* the memory
83
                        bank window size and the window size is always
84
                        less or equal to the page size)
85
 
86
   For 68HC12, the window is at 0x8000 and the page size is 16K (full window).
87
   For 68HC11 this is board specific (implemented by external hardware).  */
88
 
89
struct m68hc11_page_info
90
{
91
  bfd_vma bank_virtual;
92
  bfd_vma bank_physical;
93
  bfd_vma bank_physical_end;
94
  bfd_vma bank_mask;
95
  bfd_vma bank_size;
96
  int bank_shift;
97
  int bank_param_initialized;
98
  bfd_vma trampoline_addr;
99
};
100
 
101
struct m68hc11_elf_link_hash_table
102
{
103
  struct elf_link_hash_table root;
104
  struct m68hc11_page_info pinfo;
105
 
106
  /* The stub hash table.  */
107
  struct bfd_hash_table* stub_hash_table;
108
 
109
  /* Linker stub bfd.  */
110
  bfd *stub_bfd;
111
 
112
  asection* stub_section;
113
  asection* tramp_section;
114
 
115
  /* Linker call-backs.  */
116
  asection * (*add_stub_section) (const char *, asection *);
117
 
118
  /* Assorted information used by elf32_hppa_size_stubs.  */
119
  unsigned int bfd_count;
120
  int top_index;
121
  asection **input_list;
122
 
123
  /* Small local sym cache.  */
124
  struct sym_cache sym_cache;
125
 
126
  bfd_boolean (* size_one_stub)  (struct bfd_hash_entry*, void*);
127
  bfd_boolean (* build_one_stub) (struct bfd_hash_entry*, void*);
128
};
129
 
130
/* Get the Sparc64 ELF linker hash table from a link_info structure.  */
131
 
132
#define m68hc11_elf_hash_table(p) \
133
  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
134
  == M68HC11_ELF_DATA ? ((struct m68hc11_elf_link_hash_table *) ((p)->hash)) : NULL)
135
 
136
/* Create a 68HC11/68HC12 ELF linker hash table.  */
137
 
138
extern struct m68hc11_elf_link_hash_table* m68hc11_elf_hash_table_create
139
  (bfd*);
140
extern void m68hc11_elf_bfd_link_hash_table_free (struct bfd_link_hash_table*);
141
 
142
extern void m68hc11_elf_get_bank_parameters (struct bfd_link_info*);
143
 
144
/* Return 1 if the address is in banked memory.
145
   This can be applied to a virtual address and to a physical address.  */
146
extern int m68hc11_addr_is_banked (struct m68hc11_page_info*, bfd_vma);
147
 
148
/* Return the physical address seen by the processor, taking
149
   into account banked memory.  */
150
extern bfd_vma m68hc11_phys_addr (struct m68hc11_page_info*, bfd_vma);
151
 
152
/* Return the page number corresponding to an address in banked memory.  */
153
extern bfd_vma m68hc11_phys_page (struct m68hc11_page_info*, bfd_vma);
154
 
155
bfd_reloc_status_type m68hc11_elf_ignore_reloc
156
  (bfd *abfd, arelent *reloc_entry,
157
   asymbol *symbol, void *data, asection *input_section,
158
   bfd *output_bfd, char **error_message);
159
bfd_reloc_status_type m68hc11_elf_special_reloc
160
  (bfd *abfd, arelent *reloc_entry,
161
    asymbol *symbol, void *data, asection *input_section,
162
    bfd *output_bfd, char **error_message);
163
 
164
bfd_boolean elf32_m68hc11_check_relocs
165
  (bfd * abfd, struct bfd_link_info * info,
166
   asection * sec, const Elf_Internal_Rela * relocs);
167
bfd_boolean elf32_m68hc11_relocate_section
168
  (bfd *output_bfd, struct bfd_link_info *info,
169
   bfd *input_bfd, asection *input_section,
170
   bfd_byte *contents, Elf_Internal_Rela *relocs,
171
   Elf_Internal_Sym *local_syms, asection **local_sections);
172
 
173
bfd_boolean elf32_m68hc11_add_symbol_hook
174
  (bfd *abfd, struct bfd_link_info *info,
175
   Elf_Internal_Sym *sym, const char **namep,
176
   flagword *flagsp, asection **secp,
177
   bfd_vma *valp);
178
 
179 166 khays
void elf32_m68hc11_merge_symbol_attribute
180
  (struct elf_link_hash_entry *, const Elf_Internal_Sym *,
181
   bfd_boolean, bfd_boolean);
182
 
183 14 khays
/* Tweak the OSABI field of the elf header.  */
184
 
185
extern void elf32_m68hc11_post_process_headers (bfd*, struct bfd_link_info*);
186
 
187
int elf32_m68hc11_setup_section_lists (bfd *, struct bfd_link_info *);
188
 
189
bfd_boolean elf32_m68hc11_size_stubs
190
  (bfd *, bfd *, struct bfd_link_info *,
191
   asection * (*) (const char *, asection *));
192
 
193
bfd_boolean elf32_m68hc11_build_stubs (bfd* abfd, struct bfd_link_info *);
194
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.