/* Morpho Technologies MT specific support for 32-bit ELF
- Copyright (C) 2001-2019 Free Software Foundation, Inc.
+ Copyright (C) 2001-2021 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
static reloc_howto_type * mt_reloc_type_lookup
(bfd *, bfd_reloc_code_real_type);
-static bfd_boolean mt_info_to_howto_rela
+static bool mt_info_to_howto_rela
(bfd *, arelent *, Elf_Internal_Rela *);
static bfd_reloc_status_type mt_elf_relocate_hi16
(reloc_howto_type *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, bfd_vma);
-static bfd_boolean mt_elf_relocate_section
+static int mt_elf_relocate_section
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
0, /* rightshift */
3, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
- FALSE, /* pc_relative */
+ false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MT_NONE", /* name */
- FALSE, /* partial_inplace */
+ false, /* partial_inplace */
0 , /* src_mask */
0, /* dst_mask */
- FALSE), /* pcrel_offset */
+ false), /* pcrel_offset */
/* A 16 bit absolute relocation. */
HOWTO (R_MT_16, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- FALSE, /* pc_relative */
+ false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MT_16", /* name */
- FALSE, /* partial_inplace */
+ false, /* partial_inplace */
0 , /* src_mask */
0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ false), /* pcrel_offset */
/* A 32 bit absolute relocation. */
HOWTO (R_MT_32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- FALSE, /* pc_relative */
+ false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MT_32", /* name */
- FALSE, /* partial_inplace */
+ false, /* partial_inplace */
0 , /* src_mask */
0xffffffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ false), /* pcrel_offset */
/* A 32 bit pc-relative relocation. */
HOWTO (R_MT_32_PCREL, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
- TRUE, /* pc_relative */
+ true, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MT_32_PCREL", /* name */
- FALSE, /* partial_inplace */
+ false, /* partial_inplace */
0 , /* src_mask */
0xffffffff, /* dst_mask */
- TRUE), /* pcrel_offset */
+ true), /* pcrel_offset */
/* A 16 bit pc-relative relocation. */
HOWTO (R_MT_PC16, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- TRUE, /* pc_relative */
+ true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MT_PC16", /* name */
- FALSE, /* partial_inplace */
+ false, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
- TRUE), /* pcrel_offset */
+ true), /* pcrel_offset */
/* high 16 bits of symbol value. */
HOWTO (R_MT_HI16, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- FALSE, /* pc_relative */
+ false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MT_HI16", /* name */
- FALSE, /* partial_inplace */
+ false, /* partial_inplace */
0xffff0000, /* src_mask */
0xffff0000, /* dst_mask */
- FALSE), /* pcrel_offset */
+ false), /* pcrel_offset */
/* Low 16 bits of symbol value. */
HOWTO (R_MT_LO16, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
- FALSE, /* pc_relative */
+ false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_MT_LO16", /* name */
- FALSE, /* partial_inplace */
+ false, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
- FALSE), /* pcrel_offset */
+ false), /* pcrel_offset */
};
/* Map BFD reloc types to MT ELF reloc types. */
/* Set the howto pointer for a MT ELF reloc. */
-static bfd_boolean
-mt_info_to_howto_rela (bfd * abfd,
- arelent * cache_ptr,
- Elf_Internal_Rela * dst)
+static bool
+mt_info_to_howto_rela (bfd *abfd,
+ arelent *cache_ptr,
+ Elf_Internal_Rela *dst)
{
unsigned int r_type;
_bfd_error_handler (_("%pB: unsupported relocation type %#x"),
abfd, r_type);
bfd_set_error (bfd_error_bad_value);
- return FALSE;
+ return false;
}
cache_ptr->howto = & mt_elf_howto_table [r_type];
- return TRUE;
+ return true;
}
/* Perform a single relocation. By default we use the standard BFD
section, which means that the addend must be adjusted
accordingly. */
-static bfd_boolean
+static int
mt_elf_relocate_section
(bfd * output_bfd ATTRIBUTE_UNUSED,
struct bfd_link_info * info,
}
else
{
- bfd_boolean unresolved_reloc;
- bfd_boolean warned, ignored;
+ bool unresolved_reloc;
+ bool warned, ignored;
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
case bfd_reloc_undefined:
(*info->callbacks->undefined_symbol)
- (info, name, input_bfd, input_section, rel->r_offset, TRUE);
+ (info, name, input_bfd, input_section, rel->r_offset, true);
break;
case bfd_reloc_outofrange:
}
}
- return TRUE;
+ return true;
}
/* Look through the relocs for a section during the first phase.
Since we don't do .gots or .plts, we just need to consider the
virtual table relocs for gc. */
-static bfd_boolean
-mt_elf_check_relocs
- (bfd * abfd,
- struct bfd_link_info * info,
- asection * sec,
- const Elf_Internal_Rela * relocs)
+static bool
+mt_elf_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;
- const Elf_Internal_Rela * rel;
- const Elf_Internal_Rela * rel_end;
+ Elf_Internal_Shdr *symtab_hdr;
+ struct elf_link_hash_entry **sym_hashes;
+ const Elf_Internal_Rela *rel;
+ const Elf_Internal_Rela *rel_end;
if (bfd_link_relocatable (info))
- return TRUE;
+ return true;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
}
}
- return TRUE;
+ return true;
}
/* Return the MACH for an e_flags value. */
return bfd_mach_ms1;
}
-static bfd_boolean
-mt_elf_object_p (bfd * abfd)
+static bool
+mt_elf_object_p (bfd *abfd)
{
bfd_default_set_arch_mach (abfd, bfd_arch_mt, elf32_mt_machine (abfd));
- return TRUE;
+ return true;
}
/* Function to set the ELF flag bits. */
-static bfd_boolean
-mt_elf_set_private_flags (bfd * abfd,
- flagword flags)
+static bool
+mt_elf_set_private_flags (bfd *abfd, flagword flags)
{
elf_elfheader (abfd)->e_flags = flags;
- elf_flags_init (abfd) = TRUE;
- return TRUE;
+ elf_flags_init (abfd) = true;
+ return true;
}
/* Merge backend specific data from an object file to the output
object file when linking. */
-static bfd_boolean
+static bool
mt_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
{
bfd *obfd = info->output_bfd;
- flagword old_flags, new_flags;
- bfd_boolean ok = TRUE;
+ flagword old_flags, new_flags;
+ bool ok = true;
/* Check if we have the same endianness. */
if (!_bfd_generic_verify_endian_match (ibfd, info))
- return FALSE;
+ return false;
/* If they're not both mt, then merging is meaningless, so just
don't do it. */
if (strcmp (ibfd->arch_info->arch_name, "mt") != 0)
- return TRUE;
+ return true;
if (strcmp (obfd->arch_info->arch_name, "mt") != 0)
- return TRUE;
+ return true;
new_flags = elf_elfheader (ibfd)->e_flags;
old_flags = elf_elfheader (obfd)->e_flags;
if (!elf_flags_init (obfd))
{
old_flags = new_flags;
- elf_flags_init (obfd) = TRUE;
+ elf_flags_init (obfd) = true;
}
else if ((new_flags & EF_MT_CPU_MASK) != (old_flags & EF_MT_CPU_MASK))
{
/* CPU has changed. This is invalid, because MRISC, MRISC2 and
MS2 are not subsets of each other. */
- ok = FALSE;
+ ok = false;
}
if (ok)
return ok;
}
-static bfd_boolean
-mt_elf_print_private_bfd_data (bfd * abfd, void * ptr)
+static bool
+mt_elf_print_private_bfd_data (bfd *abfd, void *ptr)
{
- FILE * file = (FILE *) ptr;
+ FILE *file = (FILE *) ptr;
flagword flags;
BFD_ASSERT (abfd != NULL && ptr != NULL);
fputc ('\n', file);
- return TRUE;
+ return true;
}
\f