/* Matsushita 10300 specific support for 32-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
PARAMS ((reloc_howto_type *, bfd *, bfd *, asection *, bfd_byte *,
bfd_vma, bfd_vma, bfd_vma, struct bfd_link_info *,
asection *, int));
-static boolean mn10300_elf_relocate_section
+static bfd_boolean mn10300_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-static boolean mn10300_elf_relax_section
- PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
+static bfd_boolean mn10300_elf_relax_section
+ PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
static bfd_byte * mn10300_elf_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
- bfd_byte *, boolean, asymbol **));
-static unsigned long elf_mn10300_mach PARAMS ((flagword));
-
-void _bfd_mn10300_elf_final_write_processing PARAMS ((bfd *, boolean));
-boolean _bfd_mn10300_elf_object_p PARAMS ((bfd *));
-boolean _bfd_mn10300_elf_merge_private_bfd_data PARAMS ((bfd *,bfd *));
+ bfd_byte *, bfd_boolean, asymbol **));
+static unsigned long elf_mn10300_mach
+ PARAMS ((flagword));
+void _bfd_mn10300_elf_final_write_processing
+ PARAMS ((bfd *, bfd_boolean));
+bfd_boolean _bfd_mn10300_elf_object_p
+ PARAMS ((bfd *));
+bfd_boolean _bfd_mn10300_elf_merge_private_bfd_data
+ PARAMS ((bfd *,bfd *));
struct elf32_mn10300_link_hash_entry {
/* The basic elf link hash table entry. */
#define elf32_mn10300_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \
(info)))
static struct bfd_hash_entry *elf32_mn10300_link_hash_newfunc
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void mn10300_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
-static boolean mn10300_elf_check_relocs
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
+static bfd_boolean mn10300_elf_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
static asection *mn10300_elf_gc_mark_hook
PARAMS ((asection *, struct bfd_link_info *info, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
-static boolean mn10300_elf_relax_delete_bytes
+static bfd_boolean mn10300_elf_relax_delete_bytes
PARAMS ((bfd *, asection *, bfd_vma, int));
-static boolean mn10300_elf_symbol_address_p
-PARAMS ((bfd *, asection *, Elf_Internal_Sym *, bfd_vma));
-static boolean elf32_mn10300_finish_hash_table_entry
+static bfd_boolean mn10300_elf_symbol_address_p
+ PARAMS ((bfd *, asection *, Elf_Internal_Sym *, bfd_vma));
+static bfd_boolean elf32_mn10300_finish_hash_table_entry
PARAMS ((struct bfd_hash_entry *, PTR));
static void compute_function_info
PARAMS ((bfd *, struct elf32_mn10300_link_hash_entry *,
0,
2,
16,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
bfd_elf_generic_reloc,
"R_MN10300_NONE",
- false,
+ FALSE,
0,
0,
- false),
+ FALSE),
/* Standard 32 bit reloc. */
HOWTO (R_MN10300_32,
0,
2,
32,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
bfd_elf_generic_reloc,
"R_MN10300_32",
- false,
+ FALSE,
0xffffffff,
0xffffffff,
- false),
+ FALSE),
/* Standard 16 bit reloc. */
HOWTO (R_MN10300_16,
0,
1,
16,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
bfd_elf_generic_reloc,
"R_MN10300_16",
- false,
+ FALSE,
0xffff,
0xffff,
- false),
+ FALSE),
/* Standard 8 bit reloc. */
HOWTO (R_MN10300_8,
0,
0,
8,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
bfd_elf_generic_reloc,
"R_MN10300_8",
- false,
+ FALSE,
0xff,
0xff,
- false),
+ FALSE),
/* Standard 32bit pc-relative reloc. */
HOWTO (R_MN10300_PCREL32,
0,
2,
32,
- true,
+ TRUE,
0,
complain_overflow_bitfield,
bfd_elf_generic_reloc,
"R_MN10300_PCREL32",
- false,
+ FALSE,
0xffffffff,
0xffffffff,
- true),
+ TRUE),
/* Standard 16bit pc-relative reloc. */
HOWTO (R_MN10300_PCREL16,
0,
1,
16,
- true,
+ TRUE,
0,
complain_overflow_bitfield,
bfd_elf_generic_reloc,
"R_MN10300_PCREL16",
- false,
+ FALSE,
0xffff,
0xffff,
- true),
+ TRUE),
/* Standard 8 pc-relative reloc. */
HOWTO (R_MN10300_PCREL8,
0,
0,
8,
- true,
+ TRUE,
0,
complain_overflow_bitfield,
bfd_elf_generic_reloc,
"R_MN10300_PCREL8",
- false,
+ FALSE,
0xff,
0xff,
- true),
+ TRUE),
/* GNU extension to record C++ vtable hierarchy */
HOWTO (R_MN10300_GNU_VTINHERIT, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_MN10300_GNU_VTINHERIT", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* GNU extension to record C++ vtable member usage */
HOWTO (R_MN10300_GNU_VTENTRY, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- false, /* pc_relative */
+ FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_MN10300_GNU_VTENTRY", /* name */
- false, /* partial_inplace */
+ FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
- false), /* pcrel_offset */
+ FALSE), /* pcrel_offset */
/* Standard 24 bit reloc. */
HOWTO (R_MN10300_24,
0,
2,
24,
- false,
+ FALSE,
0,
complain_overflow_bitfield,
bfd_elf_generic_reloc,
"R_MN10300_24",
- false,
+ FALSE,
0xffffff,
0xffffff,
- false),
+ FALSE),
};
struct mn10300_reloc_map {
mn10300_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
Since we don't do .gots or .plts, we just need to consider the
virtual table relocs for gc. */
-static boolean
+static bfd_boolean
mn10300_elf_check_relocs (abfd, info, sec, relocs)
bfd *abfd;
struct bfd_link_info *info;
const Elf_Internal_Rela *rel_end;
if (info->relocateable)
- return true;
+ return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
Reconstruct it for later use during GC. */
case R_MN10300_GNU_VTINHERIT:
if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return false;
+ return FALSE;
break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_MN10300_GNU_VTENTRY:
if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return false;
+ return FALSE;
break;
}
}
- return true;
+ return TRUE;
}
/* Return the section that should be marked against GC for a given
}
\f
/* Relocate an MN10300 ELF section. */
-static boolean
+static bfd_boolean
mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
bfd *output_bfd;
Elf_Internal_Rela *rel, *relend;
if (info->relocateable)
- return true;
+ return TRUE;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = (struct elf32_mn10300_link_hash_entry **)
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.root.string, input_bfd,
- input_section, rel->r_offset, true)))
- return false;
+ input_section, rel->r_offset, TRUE)))
+ return FALSE;
relocation = 0;
}
}
if (! ((*info->callbacks->reloc_overflow)
(info, name, howto->name, (bfd_vma) 0,
input_bfd, input_section, rel->r_offset)))
- return false;
+ return FALSE;
break;
case bfd_reloc_undefined:
if (! ((*info->callbacks->undefined_symbol)
(info, name, input_bfd, input_section,
- rel->r_offset, true)))
- return false;
+ rel->r_offset, TRUE)))
+ return FALSE;
break;
case bfd_reloc_outofrange:
if (!((*info->callbacks->warning)
(info, msg, name, input_bfd, input_section,
rel->r_offset)))
- return false;
+ return FALSE;
break;
}
}
}
- return true;
+ return TRUE;
}
/* Finish initializing one hash table entry. */
-static boolean
+static bfd_boolean
elf32_mn10300_finish_hash_table_entry (gen_entry, in_args)
struct bfd_hash_entry *gen_entry;
PTR in_args ATTRIBUTE_UNUSED;
/* If we already know we want to convert "call" to "calls" for calls
to this symbol, then return now. */
if (entry->flags == MN10300_CONVERT_CALL_TO_CALLS)
- return true;
+ return TRUE;
/* If there are no named calls to this symbol, or there's nothing we
can move from the function itself into the "call" instruction, then
/* Make a note that we should convert "call" instructions to "calls"
instructions for calls to this symbol. */
entry->flags |= MN10300_CONVERT_CALL_TO_CALLS;
- return true;
+ return TRUE;
}
/* We may be able to move some instructions from the function itself into
entry->flags |= MN10300_CONVERT_CALL_TO_CALLS;
/* This routine never fails. */
- return true;
+ return TRUE;
}
/* This function handles relaxing for the mn10300.
We don't handle imm16->imm8 or d16->d8 as they're very rare
and somewhat more difficult to support. */
-static boolean
+static bfd_boolean
mn10300_elf_relax_section (abfd, sec, link_info, again)
bfd *abfd;
asection *sec;
struct bfd_link_info *link_info;
- boolean *again;
+ bfd_boolean *again;
{
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *internal_relocs = NULL;
asection *section = sec;
/* Assume nothing changes. */
- *again = false;
+ *again = FALSE;
/* We need a pointer to the mn10300 specific hash table. */
hash_table = elf32_mn10300_hash_table (link_info);
{
/* Get a copy of the native relocations. */
- internal_relocs = (_bfd_elf32_link_read_relocs
+ internal_relocs = (_bfd_elf_link_read_relocs
(input_bfd, section, (PTR) NULL,
(Elf_Internal_Rela *) NULL,
link_info->keep_memory));
elftab = &hash_table->static_hash_table->root;
hash = ((struct elf32_mn10300_link_hash_entry *)
elf_link_hash_lookup (elftab, sym_name,
- true, true, false));
+ TRUE, TRUE, FALSE));
free (new_name);
}
else
elftab = &hash_table->static_hash_table->root;
hash = ((struct elf32_mn10300_link_hash_entry *)
elf_link_hash_lookup (elftab, sym_name,
- true, true, false));
+ TRUE, TRUE, FALSE));
free (new_name);
compute_function_info (input_bfd, hash,
isym->st_value, contents);
if (section->reloc_count != 0)
{
/* Get a copy of the native relocations. */
- internal_relocs = (_bfd_elf32_link_read_relocs
+ internal_relocs = (_bfd_elf_link_read_relocs
(input_bfd, section, (PTR) NULL,
(Elf_Internal_Rela *) NULL,
link_info->keep_memory));
elftab = &hash_table->static_hash_table->root;
sym_hash = ((struct elf32_mn10300_link_hash_entry *)
elf_link_hash_lookup (elftab, sym_name,
- false, false, false));
+ FALSE, FALSE, FALSE));
free (new_name);
if (sym_hash == NULL)
/* Something changed. Not strictly necessary, but
may lead to more relaxing opportunities. */
- *again = true;
+ *again = TRUE;
}
}
/* Something changed. Not strictly necessary, but
may lead to more relaxing opportunities. */
- *again = true;
+ *again = TRUE;
}
}
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0
|| (sec->flags & SEC_CODE) == 0)
- return true;
+ return TRUE;
/* If this is the first time we have been called for this section,
initialize the cooked size. */
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
/* Get a copy of the native relocations. */
- internal_relocs = (_bfd_elf32_link_read_relocs
+ internal_relocs = (_bfd_elf_link_read_relocs
(abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
link_info->keep_memory));
if (internal_relocs == NULL)
}
}
- /* Read this BFD's symbols if we haven't done so already. */
+ /* Read this BFD's symbols if we haven't done so already. */
if (isymbuf == NULL && symtab_hdr->sh_info != 0)
{
isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
h = (struct elf32_mn10300_link_hash_entry *)
elf_link_hash_lookup (&hash_table->static_hash_table->root,
- sym_name, false, false, false);
+ sym_name, FALSE, FALSE, FALSE);
free (new_name);
}
else
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
}
}
else if (h)
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
}
}
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
}
}
else if (h)
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
}
}
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
}
/* Try to turn a 24 immediate, displacement or absolute address
/* That will change things, so, we should relax
again. Note that this is not required, and it
may be slow. */
- *again = true;
+ *again = TRUE;
break;
}
}
/* That will change things, so, we should relax
again. Note that this is not required, and it
may be slow. */
- *again = true;
+ *again = TRUE;
break;
}
}
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
break;
}
else if ((code & 0xf0) == 0x80
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
break;
/* mov am,(abs32) -> mov am,(abs16)
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
break;
}
else if ((code & 0xf0) < 0xf0)
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
break;
/* mov (abs32),an -> mov (abs16),an
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
break;
}
else if (code == 0xfe)
/* That will change things, so, we should relax again.
Note that this is not required, and it may be slow. */
- *again = true;
+ *again = TRUE;
break;
}
}
&& elf_section_data (sec)->relocs != internal_relocs)
free (internal_relocs);
- return true;
+ return TRUE;
error_return:
if (isymbuf != NULL
&& elf_section_data (section)->relocs != internal_relocs)
free (internal_relocs);
- return false;
+ return FALSE;
}
/* Compute the stack size and movm arguments for the function
/* Delete some bytes from a section while relaxing. */
-static boolean
+static bfd_boolean
mn10300_elf_relax_delete_bytes (abfd, sec, addr, count)
bfd *abfd;
asection *sec;
}
}
- return true;
+ return TRUE;
}
-/* Return true if a symbol exists at the given address, else return
- false. */
-static boolean
+/* Return TRUE if a symbol exists at the given address, else return
+ FALSE. */
+static bfd_boolean
mn10300_elf_symbol_address_p (abfd, sec, isym, addr)
bfd *abfd;
asection *sec;
{
if (isym->st_shndx == sec_shndx
&& isym->st_value == addr)
- return true;
+ return TRUE;
}
symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
|| sym_hash->root.type == bfd_link_hash_defweak)
&& sym_hash->root.u.def.section == sec
&& sym_hash->root.u.def.value == addr)
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
/* This is a version of bfd_generic_get_relocated_section_contents
struct bfd_link_info *link_info;
struct bfd_link_order *link_order;
bfd_byte *data;
- boolean relocateable;
+ bfd_boolean relocateable;
asymbol **symbols;
{
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Sym *isym, *isymend;
bfd_size_type amt;
- internal_relocs = (_bfd_elf32_link_read_relocs
+ internal_relocs = (_bfd_elf_link_read_relocs
(input_bfd, input_section, (PTR) NULL,
- (Elf_Internal_Rela *) NULL, false));
+ (Elf_Internal_Rela *) NULL, FALSE));
if (internal_relocs == NULL)
goto error_return;
{
ret->direct_calls = 0;
ret->stack_size = 0;
+ ret->movm_args = 0;
ret->movm_stack_size = 0;
ret->flags = 0;
- ret->movm_args = 0;
}
return (struct bfd_hash_entry *) ret;
void
_bfd_mn10300_elf_final_write_processing (abfd, linker)
bfd *abfd;
- boolean linker ATTRIBUTE_UNUSED;
+ bfd_boolean linker ATTRIBUTE_UNUSED;
{
unsigned long val;
elf_elfheader (abfd)->e_flags |= val;
}
-boolean
+bfd_boolean
_bfd_mn10300_elf_object_p (abfd)
bfd *abfd;
{
bfd_default_set_arch_mach (abfd, bfd_arch_mn10300,
elf_mn10300_mach (elf_elfheader (abfd)->e_flags));
- return true;
+ return TRUE;
}
/* Merge backend specific data from an object file to the output
object file when linking. */
-boolean
+bfd_boolean
_bfd_mn10300_elf_merge_private_bfd_data (ibfd, obfd)
bfd *ibfd;
bfd *obfd;
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
- return true;
+ return TRUE;
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
&& bfd_get_mach (obfd) < bfd_get_mach (ibfd))
{
if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
bfd_get_mach (ibfd)))
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
#define TARGET_LITTLE_SYM bfd_elf32_mn10300_vec