2003-04-21 21:22:14 +08:00
|
|
|
/* Motorola 68HC11/68HC12-specific support for 32-bit ELF
|
* elflink.c (_bfd_elf_gc_mark_hook): New function.
* elf-bfd.h (_bfd_elf_gc_mark_hook): Declare.
* elfxx-target.h (elf_backend_gc_mark_hook): Default to above.
* elf-m10300.c (mn10300_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
* elf32-arm.c (elf32_arm_gc_mark_hook): Likewise.
* elf32-cris.c (cris_elf_gc_mark_hook): Likewise.
* elf32-hppa.c (elf32_hppa_gc_mark_hook): Likewise.
* elf32-i386.c (elf_i386_gc_mark_hook): Likewise.
* elf32-m32r.c (m32r_elf_gc_mark_hook): Likewise.
* elf32-m68k.c (elf_m68k_gc_mark_hook): Likewise.
* elf32-mcore.c (mcore_elf_gc_mark_hook): Likewise.
* elf32-ppc.c (ppc_elf_gc_mark_hook): Likewise.
* elf32-s390.c (elf_s390_gc_mark_hook): Likewise.
* elf32-score.c (_bfd_score_elf_gc_mark_hook): Likewise.
* elf32-sh.c (sh_elf_gc_mark_hook): Likewise.
* elf32-vax.c (elf_vax_gc_mark_hook): Likewise.
* elf32-xtensa.c (elf_xtensa_gc_mark_hook): Likewise.
* elf64-mmix.c (mmix_elf_gc_mark_hook): Likewise.
* elf64-s390.c (elf_s390_gc_mark_hook): Likewise.
* elf64-x86-64.c (elf64_x86_64_gc_mark_hook): Likewise.
* elfxx-mips.c (_bfd_mips_elf_gc_mark_hook): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_gc_mark_hook): Likewise.
* elf32-bfin.c (bfin_gc_mark_hook): Likewise.
(bfinfdpic_gc_sweep_hook): Delete.
(elf_backend_gc_sweep_hook): Don't define for elf32-bfinfdpic.
* elf32-d10v.c (elf32_d10v_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
(elf32_d10v_gc_sweep_hook): Delete.
(elf_backend_gc_sweep_hook): Don't define.
* elf32-fr30.c (fr30_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
(fr30_elf_gc_sweep_hook): Delete.
(elf_backend_gc_sweep_hook): Don't define.
* elf32-frv.c (elf32_frv_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
(elf32_frv_gc_sweep_hook): Delete.
(elf_backend_gc_sweep_hook): Don't define.
* elf32-iq2000.c (iq2000_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
(iq2000_elf_gc_sweep_hook): Delete.
(elf_backend_gc_sweep_hook): Don't define.
* elf32-openrisc.c (openrisc_elf_gc_mark_hook): Use
_bfd_elf_gc_mark_hook.
(openrisc_elf_gc_sweep_hook): Delete.
(elf_backend_gc_sweep_hook): Don't define.
* elf32-v850.c (v850_elf_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
(v850_elf_gc_sweep_hook): Delete.
(elf_backend_gc_sweep_hook): Don't define.
* elf32-xstormy16.c (xstormy16_elf_gc_mark_hook): Use
_bfd_elf_gc_mark_hook.
(xstormy16_elf_gc_sweep_hook): Delete.
(elf_backend_gc_sweep_hook): Don't define.
* elf64-sh64.c (sh_elf64_gc_mark_hook): Use _bfd_elf_gc_mark_hook.
(sh_elf64_gc_sweep_hook): Delete.
(elf_backend_gc_sweep_hook): Don't define.
* elf32-avr.c (elf32_avr_gc_mark_hook): Delete.
(elf32_avr_gc_sweep_hook): Delete.
(elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
* elf32-cr16c.c (elf32_cr16c_gc_mark_hook): Delete.
(elf32_cr16c_gc_sweep_hook): Delete.
(elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
* elf32-crx.c (elf32_crx_gc_mark_hook): Delete.
(elf32_crx_gc_sweep_hook): Delete.
(elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
* elf32-h8300.c (elf32_h8_gc_mark_hook): Delete.
(elf32_h8_gc_sweep_hook): Delete.
(elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
* elf32-ip2k.c (ip2k_elf_gc_mark_hook): Delete.
(ip2k_elf_gc_sweep_hook): Delete.
(elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
* elf32-m32c.c (m32c_elf_gc_mark_hook, m32c_elf_gc_sweep_hook): Delete.
(elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
* elf32-m68hc11.c (elf_backend_gc_mark_hook): Don't define.
(elf_backend_gc_sweep_hook): Don't define.
* elf32-m68hc12.c (elf_backend_gc_mark_hook): Don't define.
(elf_backend_gc_sweep_hook): Don't define.
* elf32-m68hc1x.c (elf32_m68hc11_gc_mark_hook): Delete.
(elf32_m68hc11_gc_sweep_hook): Delete.
* elf32-m68hc1x.h (elf32_m68hc11_gc_mark_hook): Delete.
(elf32_m68hc11_gc_sweep_hook): Delete.
* elf32-msp430.c (elf32_msp430_gc_mark_hook): Delete.
(elf32_msp430_gc_sweep_hook): Delete.
(elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
* elf32-mt.c (mt_elf_gc_mark_hook, mt_elf_gc_sweep_hook): Delete.
(elf_backend_gc_mark_hook, elf_backend_gc_mark_hook): Don't define.
2006-09-28 21:27:33 +08:00
|
|
|
Copyright 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
2003-04-21 21:22:14 +08:00
|
|
|
Contributed by Stephane Carrez (stcarrez@nerim.fr)
|
|
|
|
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-05-04 23:53:43 +08:00
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
2003-04-21 21:22:14 +08:00
|
|
|
|
|
|
|
#ifndef _ELF32_M68HC1X_H
|
|
|
|
#define _ELF32_M68HC1X_H
|
|
|
|
|
|
|
|
#include "elf-bfd.h"
|
|
|
|
#include "bfdlink.h"
|
|
|
|
#include "elf/m68hc11.h"
|
|
|
|
|
|
|
|
/* Name of symbols exported by HC11/HC12 linker when there is a memory
|
|
|
|
bank window. */
|
|
|
|
#define BFD_M68HC11_BANK_START_NAME "__bank_start"
|
|
|
|
#define BFD_M68HC11_BANK_SIZE_NAME "__bank_size"
|
|
|
|
#define BFD_M68HC11_BANK_VIRTUAL_NAME "__bank_virtual"
|
|
|
|
|
|
|
|
/* Set and control ELF flags in ELF header. */
|
2003-10-05 05:02:53 +08:00
|
|
|
extern bfd_boolean _bfd_m68hc11_elf_merge_private_bfd_data (bfd*,bfd*);
|
|
|
|
extern bfd_boolean _bfd_m68hc11_elf_set_private_flags (bfd*,flagword);
|
|
|
|
extern bfd_boolean _bfd_m68hc11_elf_print_private_bfd_data (bfd*, void*);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
|
|
|
/* This hash entry is used to record a trampoline that must be generated
|
|
|
|
to call a far function using a normal calling convention ('jsr').
|
|
|
|
The trampoline is used when a pointer to a far function is used.
|
|
|
|
It takes care of installing the proper memory bank as well as creating
|
|
|
|
the 'call/rtc' calling convention. */
|
|
|
|
struct elf32_m68hc11_stub_hash_entry {
|
|
|
|
|
|
|
|
/* Base hash table entry structure. */
|
|
|
|
struct bfd_hash_entry root;
|
|
|
|
|
|
|
|
/* The stub section. */
|
|
|
|
asection *stub_sec;
|
|
|
|
|
|
|
|
/* Offset within stub_sec of the beginning of this stub. */
|
|
|
|
bfd_vma stub_offset;
|
|
|
|
|
|
|
|
/* Given the symbol's value and its section we can determine its final
|
|
|
|
value when building the stubs (so the stub knows where to jump. */
|
|
|
|
bfd_vma target_value;
|
|
|
|
asection *target_section;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Placeholder for the parameters to compute memory page and physical address.
|
|
|
|
The following formulas are used:
|
|
|
|
|
|
|
|
sym > bank_virtual =>
|
|
|
|
%addr(sym) = (((sym - bank_virtual) & bank_mask) + bank_physical
|
|
|
|
%page(sym) = (((sym - bank_virtual) >> bank_shift) % 256
|
|
|
|
|
|
|
|
sym < bank_virtual =>
|
|
|
|
%addr(sym) = sym
|
|
|
|
%page(sym) = 0
|
|
|
|
|
|
|
|
|
|
|
|
These parameters are obtained from the symbol table by looking
|
|
|
|
at the following:
|
|
|
|
|
|
|
|
__bank_start Symbol marking the start of memory bank window
|
|
|
|
(bank_physical)
|
|
|
|
__bank_virtual Logical address of symbols for which the transformation
|
|
|
|
must be computed
|
|
|
|
__bank_page_size Size in bytes of page size (this is *NOT* the memory
|
|
|
|
bank window size and the window size is always
|
|
|
|
less or equal to the page size)
|
|
|
|
|
|
|
|
For 68HC12, the window is at 0x8000 and the page size is 16K (full window).
|
|
|
|
For 68HC11 this is board specific (implemented by external hardware).
|
|
|
|
|
|
|
|
*/
|
|
|
|
struct m68hc11_page_info
|
|
|
|
{
|
|
|
|
bfd_vma bank_virtual;
|
|
|
|
bfd_vma bank_physical;
|
|
|
|
bfd_vma bank_physical_end;
|
|
|
|
bfd_vma bank_mask;
|
|
|
|
bfd_vma bank_size;
|
|
|
|
int bank_shift;
|
|
|
|
int bank_param_initialized;
|
|
|
|
bfd_vma trampoline_addr;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct m68hc11_elf_link_hash_table
|
|
|
|
{
|
|
|
|
struct elf_link_hash_table root;
|
|
|
|
struct m68hc11_page_info pinfo;
|
|
|
|
|
|
|
|
/* The stub hash table. */
|
|
|
|
struct bfd_hash_table* stub_hash_table;
|
|
|
|
|
|
|
|
/* Linker stub bfd. */
|
|
|
|
bfd *stub_bfd;
|
|
|
|
|
|
|
|
asection* stub_section;
|
|
|
|
asection* tramp_section;
|
|
|
|
|
|
|
|
/* Linker call-backs. */
|
|
|
|
asection * (*add_stub_section) PARAMS ((const char *, asection *));
|
|
|
|
|
|
|
|
/* Assorted information used by elf32_hppa_size_stubs. */
|
|
|
|
unsigned int bfd_count;
|
|
|
|
int top_index;
|
|
|
|
asection **input_list;
|
|
|
|
|
|
|
|
/* Small local sym to section mapping cache. */
|
|
|
|
struct sym_sec_cache sym_sec;
|
|
|
|
|
2003-10-05 05:02:53 +08:00
|
|
|
bfd_boolean (* size_one_stub) PARAMS((struct bfd_hash_entry*, void*));
|
|
|
|
bfd_boolean (* build_one_stub) PARAMS((struct bfd_hash_entry*, void*));
|
2003-04-21 21:22:14 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Get the Sparc64 ELF linker hash table from a link_info structure. */
|
|
|
|
|
|
|
|
#define m68hc11_elf_hash_table(p) \
|
|
|
|
((struct m68hc11_elf_link_hash_table *) ((p)->hash))
|
|
|
|
|
|
|
|
/* Create a 68HC11/68HC12 ELF linker hash table. */
|
|
|
|
|
|
|
|
extern struct m68hc11_elf_link_hash_table* m68hc11_elf_hash_table_create
|
2003-10-05 05:02:53 +08:00
|
|
|
(bfd*);
|
|
|
|
extern void m68hc11_elf_bfd_link_hash_table_free (struct bfd_link_hash_table*);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
2003-10-05 05:02:53 +08:00
|
|
|
extern void m68hc11_elf_get_bank_parameters (struct bfd_link_info*);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
|
|
|
/* Return 1 if the address is in banked memory.
|
|
|
|
This can be applied to a virtual address and to a physical address. */
|
2003-10-05 05:02:53 +08:00
|
|
|
extern int m68hc11_addr_is_banked (struct m68hc11_page_info*, bfd_vma);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
|
|
|
/* Return the physical address seen by the processor, taking
|
|
|
|
into account banked memory. */
|
2003-10-05 05:02:53 +08:00
|
|
|
extern bfd_vma m68hc11_phys_addr (struct m68hc11_page_info*, bfd_vma);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
|
|
|
/* Return the page number corresponding to an address in banked memory. */
|
2003-10-05 05:02:53 +08:00
|
|
|
extern bfd_vma m68hc11_phys_page (struct m68hc11_page_info*, bfd_vma);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
|
|
|
bfd_reloc_status_type m68hc11_elf_ignore_reloc
|
2003-10-05 05:02:53 +08:00
|
|
|
(bfd *abfd, arelent *reloc_entry,
|
|
|
|
asymbol *symbol, void *data, asection *input_section,
|
|
|
|
bfd *output_bfd, char **error_message);
|
2003-04-21 21:22:14 +08:00
|
|
|
bfd_reloc_status_type m68hc11_elf_special_reloc
|
2003-10-05 05:02:53 +08:00
|
|
|
(bfd *abfd, arelent *reloc_entry,
|
|
|
|
asymbol *symbol, void *data, asection *input_section,
|
|
|
|
bfd *output_bfd, char **error_message);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
|
|
|
bfd_boolean elf32_m68hc11_check_relocs
|
2003-10-05 05:02:53 +08:00
|
|
|
(bfd * abfd, struct bfd_link_info * info,
|
|
|
|
asection * sec, const Elf_Internal_Rela * relocs);
|
2003-04-21 21:22:14 +08:00
|
|
|
bfd_boolean elf32_m68hc11_relocate_section
|
2003-10-05 05:02:53 +08:00
|
|
|
(bfd *output_bfd, struct bfd_link_info *info,
|
|
|
|
bfd *input_bfd, asection *input_section,
|
|
|
|
bfd_byte *contents, Elf_Internal_Rela *relocs,
|
|
|
|
Elf_Internal_Sym *local_syms, asection **local_sections);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
|
|
|
bfd_boolean elf32_m68hc11_add_symbol_hook
|
2003-10-05 05:02:53 +08:00
|
|
|
(bfd *abfd, struct bfd_link_info *info,
|
2004-03-26 14:13:40 +08:00
|
|
|
Elf_Internal_Sym *sym, const char **namep,
|
2003-10-05 05:02:53 +08:00
|
|
|
flagword *flagsp, asection **secp,
|
|
|
|
bfd_vma *valp);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
|
|
|
/* Tweak the OSABI field of the elf header. */
|
|
|
|
|
2003-10-05 05:02:53 +08:00
|
|
|
extern void elf32_m68hc11_post_process_headers (bfd*, struct bfd_link_info*);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
2003-10-05 05:02:53 +08:00
|
|
|
int elf32_m68hc11_setup_section_lists (bfd *, struct bfd_link_info *);
|
2003-04-21 21:22:14 +08:00
|
|
|
|
|
|
|
bfd_boolean elf32_m68hc11_size_stubs
|
2003-10-05 05:02:53 +08:00
|
|
|
(bfd *, bfd *, struct bfd_link_info *,
|
|
|
|
asection * (*) (const char *, asection *));
|
2003-04-21 21:22:14 +08:00
|
|
|
|
2003-10-05 05:02:53 +08:00
|
|
|
bfd_boolean elf32_m68hc11_build_stubs (bfd* abfd, struct bfd_link_info *);
|
2003-04-21 21:22:14 +08:00
|
|
|
#endif
|