1
1
/* Matsushita 10300 specific support for 32-bit ELF
2
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
2
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3
3
Free Software Foundation, Inc.
5
5
This file is part of BFD, the Binary File Descriptor library.
85
85
to the target when it's valid and profitable to do so. */
86
86
unsigned char movm_args;
88
/* For funtion symbols, the amount of stack space that would be allocated
88
/* For function symbols, the amount of stack space that would be allocated
89
89
by the movm instruction. This is redundant with movm_args, but we
90
90
add it to the hash table to avoid computing it over and over. */
91
91
unsigned char movm_stack_size;
605
606
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
607
struct elf_link_hash_entry *h = NULL;
608
609
if (! (_bfd_generic_link_add_one_symbol
609
610
(info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s,
610
611
(bfd_vma) 0, (const char *) NULL, FALSE,
611
get_elf_backend_data (abfd)->collect,
612
(struct bfd_link_hash_entry **) &h)))
612
get_elf_backend_data (abfd)->collect, &bh)))
614
h = (struct elf_link_hash_entry *) bh;
614
615
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
615
616
h->type = STT_OBJECT;
618
&& ! _bfd_elf_link_record_dynamic_symbol (info, h))
619
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
638
639
(or .got.plt) section. We don't do this in the linker script
639
640
because we don't want to define the symbol if we are not creating
640
641
a global offset table. */
642
643
if (!(_bfd_generic_link_add_one_symbol
643
644
(info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
644
645
bed->got_symbol_offset, (const char *) NULL, FALSE,
645
bed->collect, (struct bfd_link_hash_entry **) &h)))
648
h = (struct elf_link_hash_entry *) bh;
647
649
h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
648
650
h->type = STT_OBJECT;
651
&& ! _bfd_elf_link_record_dynamic_symbol (info, h))
653
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
654
656
elf_hash_table (info)->hgot = h;
768
770
/* This relocation describes the C++ object vtable hierarchy.
769
771
Reconstruct it for later use during GC. */
770
772
case R_MN10300_GNU_VTINHERIT:
771
if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
773
if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
775
777
/* This relocation describes which C++ vtable entries are actually
776
778
used. Record for later use during GC. */
777
779
case R_MN10300_GNU_VTENTRY:
778
if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
780
if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
781
783
case R_MN10300_GOT32:
1535
1537
asection **local_sections;
1537
1539
Elf_Internal_Shdr *symtab_hdr;
1538
struct elf32_mn10300_link_hash_entry **sym_hashes;
1540
struct elf_link_hash_entry **sym_hashes;
1539
1541
Elf_Internal_Rela *rel, *relend;
1541
1543
if (info->relocatable)
1544
1546
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
1545
sym_hashes = (struct elf32_mn10300_link_hash_entry **)
1546
(elf_sym_hashes (input_bfd));
1547
sym_hashes = elf_sym_hashes (input_bfd);
1549
1550
relend = relocs + input_section->reloc_count;
1575
1576
sym = local_syms + r_symndx;
1576
1577
sec = local_sections[r_symndx];
1577
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
1578
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
1582
1583
bfd_boolean warned;
1583
1584
struct elf_link_hash_entry *hh;
1585
RELOC_FOR_GLOBAL_SYMBOL (hh, (struct elf_link_hash_entry *) sym_hashes,
1586
r_symndx, symtab_hdr, relocation,
1587
sec, unresolved_reloc, info,
1586
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
1587
r_symndx, symtab_hdr, sym_hashes,
1588
hh, sec, relocation,
1589
unresolved_reloc, warned);
1590
1591
h = (struct elf32_mn10300_link_hash_entry *) hh;
1741
1742
byte_count += 2;
1743
1744
/* Count the insn to allocate stack space too. */
1744
if (entry->stack_size > 0 && entry->stack_size <= 128)
1746
else if (entry->stack_size > 0 && entry->stack_size < 256)
1745
if (entry->stack_size > 0)
1747
if (entry->stack_size <= 128)
1749
1753
/* If using "call" will result in larger code, then turn all
1750
the associated "call" instructions into "calls" instrutions. */
1754
the associated "call" instructions into "calls" instructions. */
1751
1755
if (byte_count < entry->direct_calls)
1752
1756
entry->flags |= MN10300_CONVERT_CALL_TO_CALLS;
1758
1762
/* This function handles relaxing for the mn10300.
1760
There's quite a few relaxing opportunites available on the mn10300:
1764
There are quite a few relaxing opportunities available on the mn10300:
1762
1766
* calls:32 -> calls:16 2 bytes
1763
1767
* call:32 -> call:16 2 bytes
2236
2240
if (sym_hash->movm_args)
2239
if (sym_hash->stack_size && sym_hash->stack_size <= 128)
2241
else if (sym_hash->stack_size
2242
&& sym_hash->stack_size < 256)
2243
if (sym_hash->stack_size > 0)
2245
if (sym_hash->stack_size <= 128)
2245
2251
/* Note that we've deleted prologue bytes for this
2288
2294
if (sym_hash->movm_args)
2291
if (sym_hash->stack_size && sym_hash->stack_size <= 128)
2293
else if (sym_hash->stack_size
2294
&& sym_hash->stack_size < 256)
2297
if (sym_hash->stack_size > 0)
2299
if (sym_hash->stack_size <= 128)
2297
2305
/* Note that we've deleted prologue bytes for this
4006
4014
/* Return offset of the GOT id in PLT0 entry. */
4007
4015
#define elf_mn10300_plt0_gotid_offset(info) 9
4009
/* Return offset of the tempoline in PLT entry */
4017
/* Return offset of the temporary in PLT entry */
4010
4018
#define elf_mn10300_plt_temp_offset(info) 8
4012
4020
/* Return offset of the symbol in PLT entry. */
4483
4491
in by the dynamic linker and used by the debugger. */
4484
4492
if (! info->shared)
4486
if (! bfd_elf32_add_dynamic_entry (info, DT_DEBUG, 0))
4494
if (!_bfd_elf_add_dynamic_entry (info, DT_DEBUG, 0))
4492
if (! bfd_elf32_add_dynamic_entry (info, DT_PLTGOT, 0)
4493
|| ! bfd_elf32_add_dynamic_entry (info, DT_PLTRELSZ, 0)
4494
|| ! bfd_elf32_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
4495
|| ! bfd_elf32_add_dynamic_entry (info, DT_JMPREL, 0))
4500
if (!_bfd_elf_add_dynamic_entry (info, DT_PLTGOT, 0)
4501
|| !_bfd_elf_add_dynamic_entry (info, DT_PLTRELSZ, 0)
4502
|| !_bfd_elf_add_dynamic_entry (info, DT_PLTREL, DT_RELA)
4503
|| !_bfd_elf_add_dynamic_entry (info, DT_JMPREL, 0))
4501
if (! bfd_elf32_add_dynamic_entry (info, DT_RELA, 0)
4502
|| ! bfd_elf32_add_dynamic_entry (info, DT_RELASZ, 0)
4503
|| ! bfd_elf32_add_dynamic_entry (info, DT_RELAENT,
4504
sizeof (Elf32_External_Rela)))
4509
if (!_bfd_elf_add_dynamic_entry (info, DT_RELA, 0)
4510
|| !_bfd_elf_add_dynamic_entry (info, DT_RELASZ, 0)
4511
|| !_bfd_elf_add_dynamic_entry (info, DT_RELAENT,
4512
sizeof (Elf32_External_Rela)))
4510
if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
4518
if (!_bfd_elf_add_dynamic_entry (info, DT_TEXTREL, 0))
4874
4882
#define elf_backend_plt_readonly 1
4875
4883
#define elf_backend_want_plt_sym 0
4876
4884
#define elf_backend_got_header_size 12
4877
#define elf_backend_plt_header_size PLT0_ENTRY_SIZE
4879
4886
#include "elf32-target.h"