|
|
|
@ -33,31 +33,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
|
|
|
bfd_hash_lookup ((table), (string), (create), (copy))) |
|
|
|
|
|
|
|
static struct elf32_m68hc11_stub_hash_entry* m68hc12_add_stub |
|
|
|
PARAMS((const char *stub_name, |
|
|
|
asection *section, |
|
|
|
struct m68hc11_elf_link_hash_table *htab)); |
|
|
|
(const char *stub_name, |
|
|
|
asection *section, |
|
|
|
struct m68hc11_elf_link_hash_table *htab); |
|
|
|
|
|
|
|
static struct bfd_hash_entry *stub_hash_newfunc |
|
|
|
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); |
|
|
|
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *); |
|
|
|
|
|
|
|
static void m68hc11_elf_set_symbol |
|
|
|
PARAMS ((bfd* abfd, struct bfd_link_info *info, |
|
|
|
const char* name, bfd_vma value, asection* sec)); |
|
|
|
static void m68hc11_elf_set_symbol (bfd* abfd, struct bfd_link_info *info, |
|
|
|
const char* name, bfd_vma value, |
|
|
|
asection* sec); |
|
|
|
|
|
|
|
static bfd_boolean m68hc11_elf_export_one_stub |
|
|
|
PARAMS((struct bfd_hash_entry *gen_entry, PTR in_arg)); |
|
|
|
(struct bfd_hash_entry *gen_entry, void *in_arg); |
|
|
|
|
|
|
|
static bfd_boolean m68hc11_get_relocation_value |
|
|
|
PARAMS ((bfd* abfd, |
|
|
|
struct bfd_link_info* info, |
|
|
|
asection **local_sections, |
|
|
|
Elf_Internal_Sym* local_syms, |
|
|
|
Elf_Internal_Rela* rel, |
|
|
|
const char** name, |
|
|
|
bfd_vma* relocation, |
|
|
|
bfd_boolean* is_far)); |
|
|
|
(bfd* abfd, |
|
|
|
struct bfd_link_info* info, |
|
|
|
asection **local_sections, |
|
|
|
Elf_Internal_Sym* local_syms, |
|
|
|
Elf_Internal_Rela* rel, |
|
|
|
const char** name, |
|
|
|
bfd_vma* relocation, |
|
|
|
bfd_boolean* is_far); |
|
|
|
|
|
|
|
static void scan_sections_for_abi PARAMS ((bfd*, asection*, PTR)); |
|
|
|
static void scan_sections_for_abi (bfd*, asection*, PTR); |
|
|
|
|
|
|
|
struct m68hc11_scan_param |
|
|
|
{ |
|
|
|
@ -69,8 +69,7 @@ struct m68hc11_scan_param |
|
|
|
/* Create a 68HC11/68HC12 ELF linker hash table. */ |
|
|
|
|
|
|
|
struct m68hc11_elf_link_hash_table* |
|
|
|
m68hc11_elf_hash_table_create (abfd) |
|
|
|
bfd *abfd; |
|
|
|
m68hc11_elf_hash_table_create (bfd *abfd) |
|
|
|
{ |
|
|
|
struct m68hc11_elf_link_hash_table *ret; |
|
|
|
bfd_size_type amt = sizeof (struct m68hc11_elf_link_hash_table); |
|
|
|
@ -109,8 +108,7 @@ m68hc11_elf_hash_table_create (abfd) |
|
|
|
/* Free the derived linker hash table. */ |
|
|
|
|
|
|
|
void |
|
|
|
m68hc11_elf_bfd_link_hash_table_free (hash) |
|
|
|
struct bfd_link_hash_table *hash; |
|
|
|
m68hc11_elf_bfd_link_hash_table_free (struct bfd_link_hash_table *hash) |
|
|
|
{ |
|
|
|
struct m68hc11_elf_link_hash_table *ret |
|
|
|
= (struct m68hc11_elf_link_hash_table *) hash; |
|
|
|
@ -125,10 +123,8 @@ m68hc11_elf_bfd_link_hash_table_free (hash) |
|
|
|
/* Initialize an entry in the stub hash table. */ |
|
|
|
|
|
|
|
static struct bfd_hash_entry * |
|
|
|
stub_hash_newfunc (entry, table, string) |
|
|
|
struct bfd_hash_entry *entry; |
|
|
|
struct bfd_hash_table *table; |
|
|
|
const char *string; |
|
|
|
stub_hash_newfunc (struct bfd_hash_entry *entry, struct bfd_hash_table *table, |
|
|
|
const char *string) |
|
|
|
{ |
|
|
|
/* Allocate the structure if it has not already been allocated by a
|
|
|
|
subclass. */ |
|
|
|
@ -161,10 +157,8 @@ stub_hash_newfunc (entry, table, string) |
|
|
|
stub entry are initialised. */ |
|
|
|
|
|
|
|
static struct elf32_m68hc11_stub_hash_entry * |
|
|
|
m68hc12_add_stub (stub_name, section, htab) |
|
|
|
const char *stub_name; |
|
|
|
asection *section; |
|
|
|
struct m68hc11_elf_link_hash_table *htab; |
|
|
|
m68hc12_add_stub (const char *stub_name, asection *section, |
|
|
|
struct m68hc11_elf_link_hash_table *htab) |
|
|
|
{ |
|
|
|
struct elf32_m68hc11_stub_hash_entry *stub_entry; |
|
|
|
|
|
|
|
@ -195,14 +189,12 @@ m68hc12_add_stub (stub_name, section, htab) |
|
|
|
the trampoline handler. */ |
|
|
|
|
|
|
|
bfd_boolean |
|
|
|
elf32_m68hc11_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) |
|
|
|
bfd *abfd; |
|
|
|
struct bfd_link_info *info; |
|
|
|
const Elf_Internal_Sym *sym; |
|
|
|
const char **namep ATTRIBUTE_UNUSED; |
|
|
|
flagword *flagsp ATTRIBUTE_UNUSED; |
|
|
|
asection **secp ATTRIBUTE_UNUSED; |
|
|
|
bfd_vma *valp ATTRIBUTE_UNUSED; |
|
|
|
elf32_m68hc11_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, |
|
|
|
const Elf_Internal_Sym *sym, |
|
|
|
const char **namep ATTRIBUTE_UNUSED, |
|
|
|
flagword *flagsp ATTRIBUTE_UNUSED, |
|
|
|
asection **secp ATTRIBUTE_UNUSED, |
|
|
|
bfd_vma *valp ATTRIBUTE_UNUSED) |
|
|
|
{ |
|
|
|
if (sym->st_other & STO_M68HC12_FAR) |
|
|
|
{ |
|
|
|
@ -234,9 +226,7 @@ elf32_m68hc11_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) |
|
|
|
0 when no stubs will be needed, and 1 on success. */ |
|
|
|
|
|
|
|
int |
|
|
|
elf32_m68hc11_setup_section_lists (output_bfd, info) |
|
|
|
bfd *output_bfd; |
|
|
|
struct bfd_link_info *info; |
|
|
|
elf32_m68hc11_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) |
|
|
|
{ |
|
|
|
bfd *input_bfd; |
|
|
|
unsigned int bfd_count; |
|
|
|
@ -326,11 +316,9 @@ elf32_m68hc11_setup_section_lists (output_bfd, info) |
|
|
|
instruction. */ |
|
|
|
|
|
|
|
bfd_boolean |
|
|
|
elf32_m68hc11_size_stubs (output_bfd, stub_bfd, info, add_stub_section) |
|
|
|
bfd *output_bfd; |
|
|
|
bfd *stub_bfd; |
|
|
|
struct bfd_link_info *info; |
|
|
|
asection * (*add_stub_section) PARAMS ((const char *, asection *)); |
|
|
|
elf32_m68hc11_size_stubs (bfd *output_bfd, bfd *stub_bfd, |
|
|
|
struct bfd_link_info *info, |
|
|
|
asection * (*add_stub_section) (const char*, asection*)) |
|
|
|
{ |
|
|
|
bfd *input_bfd; |
|
|
|
asection *section; |
|
|
|
@ -571,9 +559,7 @@ elf32_m68hc11_size_stubs (output_bfd, stub_bfd, info, add_stub_section) |
|
|
|
|
|
|
|
/* Export the trampoline addresses in the symbol table. */ |
|
|
|
static bfd_boolean |
|
|
|
m68hc11_elf_export_one_stub (gen_entry, in_arg) |
|
|
|
struct bfd_hash_entry *gen_entry; |
|
|
|
PTR in_arg; |
|
|
|
m68hc11_elf_export_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) |
|
|
|
{ |
|
|
|
struct bfd_link_info *info; |
|
|
|
struct m68hc11_elf_link_hash_table *htab; |
|
|
|
@ -603,12 +589,8 @@ m68hc11_elf_export_one_stub (gen_entry, in_arg) |
|
|
|
|
|
|
|
/* Export a symbol or set its value and section. */ |
|
|
|
static void |
|
|
|
m68hc11_elf_set_symbol (abfd, info, name, value, sec) |
|
|
|
bfd* abfd; |
|
|
|
struct bfd_link_info *info; |
|
|
|
const char* name; |
|
|
|
bfd_vma value; |
|
|
|
asection* sec; |
|
|
|
m68hc11_elf_set_symbol (bfd *abfd, struct bfd_link_info *info, |
|
|
|
const char *name, bfd_vma value, asection *sec) |
|
|
|
{ |
|
|
|
struct elf_link_hash_entry *h; |
|
|
|
|
|
|
|
@ -639,9 +621,7 @@ m68hc11_elf_set_symbol (abfd, info, name, value, sec) |
|
|
|
linker. */ |
|
|
|
|
|
|
|
bfd_boolean |
|
|
|
elf32_m68hc11_build_stubs (abfd, info) |
|
|
|
bfd* abfd; |
|
|
|
struct bfd_link_info *info; |
|
|
|
elf32_m68hc11_build_stubs (bfd *abfd, struct bfd_link_info *info) |
|
|
|
{ |
|
|
|
asection *stub_sec; |
|
|
|
struct bfd_hash_table *table; |
|
|
|
@ -694,8 +674,7 @@ elf32_m68hc11_build_stubs (abfd, info) |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
m68hc11_elf_get_bank_parameters (info) |
|
|
|
struct bfd_link_info *info; |
|
|
|
m68hc11_elf_get_bank_parameters (struct bfd_link_info *info) |
|
|
|
{ |
|
|
|
unsigned i; |
|
|
|
struct m68hc11_page_info *pinfo; |
|
|
|
@ -755,9 +734,7 @@ m68hc11_elf_get_bank_parameters (info) |
|
|
|
/* Return 1 if the address is in banked memory.
|
|
|
|
This can be applied to a virtual address and to a physical address. */ |
|
|
|
int |
|
|
|
m68hc11_addr_is_banked (pinfo, addr) |
|
|
|
struct m68hc11_page_info *pinfo; |
|
|
|
bfd_vma addr; |
|
|
|
m68hc11_addr_is_banked (struct m68hc11_page_info *pinfo, bfd_vma addr) |
|
|
|
{ |
|
|
|
if (addr >= pinfo->bank_virtual) |
|
|
|
return 1; |
|
|
|
@ -771,9 +748,7 @@ m68hc11_addr_is_banked (pinfo, addr) |
|
|
|
/* Return the physical address seen by the processor, taking
|
|
|
|
into account banked memory. */ |
|
|
|
bfd_vma |
|
|
|
m68hc11_phys_addr (pinfo, addr) |
|
|
|
struct m68hc11_page_info *pinfo; |
|
|
|
bfd_vma addr; |
|
|
|
m68hc11_phys_addr (struct m68hc11_page_info *pinfo, bfd_vma addr) |
|
|
|
{ |
|
|
|
if (addr < pinfo->bank_virtual) |
|
|
|
return addr; |
|
|
|
@ -787,9 +762,7 @@ m68hc11_phys_addr (pinfo, addr) |
|
|
|
|
|
|
|
/* Return the page number corresponding to an address in banked memory. */ |
|
|
|
bfd_vma |
|
|
|
m68hc11_phys_page (pinfo, addr) |
|
|
|
struct m68hc11_page_info *pinfo; |
|
|
|
bfd_vma addr; |
|
|
|
m68hc11_phys_page (struct m68hc11_page_info *pinfo, bfd_vma addr) |
|
|
|
{ |
|
|
|
if (addr < pinfo->bank_virtual) |
|
|
|
return 0; |
|
|
|
@ -805,15 +778,13 @@ m68hc11_phys_page (pinfo, addr) |
|
|
|
which the linker should otherwise ignore. */ |
|
|
|
|
|
|
|
bfd_reloc_status_type |
|
|
|
m68hc11_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, |
|
|
|
output_bfd, error_message) |
|
|
|
bfd *abfd ATTRIBUTE_UNUSED; |
|
|
|
arelent *reloc_entry; |
|
|
|
asymbol *symbol ATTRIBUTE_UNUSED; |
|
|
|
PTR data ATTRIBUTE_UNUSED; |
|
|
|
asection *input_section; |
|
|
|
bfd *output_bfd; |
|
|
|
char **error_message ATTRIBUTE_UNUSED; |
|
|
|
m68hc11_elf_ignore_reloc (bfd *abfd ATTRIBUTE_UNUSED, |
|
|
|
arelent *reloc_entry, |
|
|
|
asymbol *symbol ATTRIBUTE_UNUSED, |
|
|
|
void *data ATTRIBUTE_UNUSED, |
|
|
|
asection *input_section, |
|
|
|
bfd *output_bfd, |
|
|
|
char **error_message ATTRIBUTE_UNUSED) |
|
|
|
{ |
|
|
|
if (output_bfd != NULL) |
|
|
|
reloc_entry->address += input_section->output_offset; |
|
|
|
@ -821,15 +792,13 @@ m68hc11_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, |
|
|
|
} |
|
|
|
|
|
|
|
bfd_reloc_status_type |
|
|
|
m68hc11_elf_special_reloc (abfd, reloc_entry, symbol, data, input_section, |
|
|
|
output_bfd, error_message) |
|
|
|
bfd *abfd ATTRIBUTE_UNUSED; |
|
|
|
arelent *reloc_entry; |
|
|
|
asymbol *symbol; |
|
|
|
PTR data ATTRIBUTE_UNUSED; |
|
|
|
asection *input_section; |
|
|
|
bfd *output_bfd; |
|
|
|
char **error_message ATTRIBUTE_UNUSED; |
|
|
|
m68hc11_elf_special_reloc (bfd *abfd ATTRIBUTE_UNUSED, |
|
|
|
arelent *reloc_entry, |
|
|
|
asymbol *symbol, |
|
|
|
void *data ATTRIBUTE_UNUSED, |
|
|
|
asection *input_section, |
|
|
|
bfd *output_bfd, |
|
|
|
char **error_message ATTRIBUTE_UNUSED) |
|
|
|
{ |
|
|
|
if (output_bfd != (bfd *) NULL |
|
|
|
&& (symbol->flags & BSF_SECTION_SYM) == 0 |
|
|
|
@ -850,12 +819,11 @@ m68hc11_elf_special_reloc (abfd, reloc_entry, symbol, data, input_section, |
|
|
|
} |
|
|
|
|
|
|
|
asection * |
|
|
|
elf32_m68hc11_gc_mark_hook (sec, info, rel, h, sym) |
|
|
|
asection *sec; |
|
|
|
struct bfd_link_info *info ATTRIBUTE_UNUSED; |
|
|
|
Elf_Internal_Rela *rel; |
|
|
|
struct elf_link_hash_entry *h; |
|
|
|
Elf_Internal_Sym *sym; |
|
|
|
elf32_m68hc11_gc_mark_hook (asection *sec, |
|
|
|
struct bfd_link_info *info ATTRIBUTE_UNUSED, |
|
|
|
Elf_Internal_Rela *rel, |
|
|
|
struct elf_link_hash_entry *h, |
|
|
|
Elf_Internal_Sym *sym) |
|
|
|
{ |
|
|
|
if (h != NULL) |
|
|
|
{ |
|
|
|
@ -883,11 +851,10 @@ elf32_m68hc11_gc_mark_hook (sec, info, rel, h, sym) |
|
|
|
} |
|
|
|
|
|
|
|
bfd_boolean |
|
|
|
elf32_m68hc11_gc_sweep_hook (abfd, info, sec, relocs) |
|
|
|
bfd *abfd ATTRIBUTE_UNUSED; |
|
|
|
struct bfd_link_info *info ATTRIBUTE_UNUSED; |
|
|
|
asection *sec ATTRIBUTE_UNUSED; |
|
|
|
const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED; |
|
|
|
elf32_m68hc11_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED, |
|
|
|
struct bfd_link_info *info ATTRIBUTE_UNUSED, |
|
|
|
asection *sec ATTRIBUTE_UNUSED, |
|
|
|
const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED) |
|
|
|
{ |
|
|
|
/* We don't use got and plt entries for 68hc11/68hc12. */ |
|
|
|
return TRUE; |
|
|
|
@ -898,11 +865,8 @@ elf32_m68hc11_gc_sweep_hook (abfd, info, sec, relocs) |
|
|
|
virtual table relocs for gc. */ |
|
|
|
|
|
|
|
bfd_boolean |
|
|
|
elf32_m68hc11_check_relocs (abfd, info, sec, relocs) |
|
|
|
bfd * abfd; |
|
|
|
struct bfd_link_info * info; |
|
|
|
asection * sec; |
|
|
|
const Elf_Internal_Rela * relocs; |
|
|
|
elf32_m68hc11_check_relocs (bfd *abfd, struct bfd_link_info *info, |
|
|
|
asection *sec, const Elf_Internal_Rela *relocs) |
|
|
|
{ |
|
|
|
Elf_Internal_Shdr * symtab_hdr; |
|
|
|
struct elf_link_hash_entry ** sym_hashes; |
|
|
|
@ -955,17 +919,12 @@ elf32_m68hc11_check_relocs (abfd, info, sec, relocs) |
|
|
|
} |
|
|
|
|
|
|
|
static bfd_boolean |
|
|
|
m68hc11_get_relocation_value (abfd, info, local_sections, local_syms, |
|
|
|
rel, name, |
|
|
|
relocation, is_far) |
|
|
|
bfd *abfd; |
|
|
|
struct bfd_link_info *info; |
|
|
|
asection **local_sections; |
|
|
|
Elf_Internal_Sym* local_syms; |
|
|
|
Elf_Internal_Rela* rel; |
|
|
|
const char** name; |
|
|
|
bfd_vma* relocation; |
|
|
|
bfd_boolean* is_far; |
|
|
|
m68hc11_get_relocation_value (bfd *abfd, struct bfd_link_info *info, |
|
|
|
asection **local_sections, |
|
|
|
Elf_Internal_Sym *local_syms, |
|
|
|
Elf_Internal_Rela *rel, |
|
|
|
const char **name, |
|
|
|
bfd_vma *relocation, bfd_boolean *is_far) |
|
|
|
{ |
|
|
|
Elf_Internal_Shdr *symtab_hdr; |
|
|
|
struct elf_link_hash_entry **sym_hashes; |
|
|
|
@ -1056,16 +1015,12 @@ m68hc11_get_relocation_value (abfd, info, local_sections, local_syms, |
|
|
|
|
|
|
|
/* Relocate a 68hc11/68hc12 ELF section. */ |
|
|
|
bfd_boolean |
|
|
|
elf32_m68hc11_relocate_section (output_bfd, info, input_bfd, input_section, |
|
|
|
contents, relocs, local_syms, local_sections) |
|
|
|
bfd *output_bfd ATTRIBUTE_UNUSED; |
|
|
|
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; |
|
|
|
elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, |
|
|
|
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) |
|
|
|
{ |
|
|
|
Elf_Internal_Shdr *symtab_hdr; |
|
|
|
struct elf_link_hash_entry **sym_hashes; |
|
|
|
@ -1289,9 +1244,7 @@ elf32_m68hc11_relocate_section (output_bfd, info, input_bfd, input_section, |
|
|
|
/* Set and control ELF flags in ELF header. */ |
|
|
|
|
|
|
|
bfd_boolean |
|
|
|
_bfd_m68hc11_elf_set_private_flags (abfd, flags) |
|
|
|
bfd *abfd; |
|
|
|
flagword flags; |
|
|
|
_bfd_m68hc11_elf_set_private_flags (bfd *abfd, flagword flags) |
|
|
|
{ |
|
|
|
BFD_ASSERT (!elf_flags_init (abfd) |
|
|
|
|| elf_elfheader (abfd)->e_flags == flags); |
|
|
|
@ -1305,9 +1258,7 @@ _bfd_m68hc11_elf_set_private_flags (abfd, flags) |
|
|
|
object file when linking. */ |
|
|
|
|
|
|
|
bfd_boolean |
|
|
|
_bfd_m68hc11_elf_merge_private_bfd_data (ibfd, obfd) |
|
|
|
bfd *ibfd; |
|
|
|
bfd *obfd; |
|
|
|
_bfd_m68hc11_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) |
|
|
|
{ |
|
|
|
flagword old_flags; |
|
|
|
flagword new_flags; |
|
|
|
@ -1398,9 +1349,7 @@ _bfd_m68hc11_elf_merge_private_bfd_data (ibfd, obfd) |
|
|
|
} |
|
|
|
|
|
|
|
bfd_boolean |
|
|
|
_bfd_m68hc11_elf_print_private_bfd_data (abfd, ptr) |
|
|
|
bfd *abfd; |
|
|
|
PTR ptr; |
|
|
|
_bfd_m68hc11_elf_print_private_bfd_data (bfd *abfd, void *ptr) |
|
|
|
{ |
|
|
|
FILE *file = (FILE *) ptr; |
|
|
|
|
|
|
|
@ -1439,10 +1388,8 @@ _bfd_m68hc11_elf_print_private_bfd_data (abfd, ptr) |
|
|
|
return TRUE; |
|
|
|
} |
|
|
|
|
|
|
|
static void scan_sections_for_abi (abfd, asect, arg) |
|
|
|
bfd* abfd ATTRIBUTE_UNUSED; |
|
|
|
asection* asect; |
|
|
|
PTR arg; |
|
|
|
static void scan_sections_for_abi (bfd *abfd ATTRIBUTE_UNUSED, |
|
|
|
asection *asect, void *arg) |
|
|
|
{ |
|
|
|
struct m68hc11_scan_param* p = (struct m68hc11_scan_param*) arg; |
|
|
|
|
|
|
|
@ -1453,9 +1400,7 @@ static void scan_sections_for_abi (abfd, asect, arg) |
|
|
|
/* Tweak the OSABI field of the elf header. */ |
|
|
|
|
|
|
|
void |
|
|
|
elf32_m68hc11_post_process_headers (abfd, link_info) |
|
|
|
bfd *abfd; |
|
|
|
struct bfd_link_info *link_info; |
|
|
|
elf32_m68hc11_post_process_headers (bfd *abfd, struct bfd_link_info *link_info) |
|
|
|
{ |
|
|
|
struct m68hc11_scan_param param; |
|
|
|
|
|
|
|
|