/* Motorola 68k series support for 32-bit ELF
- Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
- Free Software Foundation, Inc.
+ Copyright (C) 1993-2014 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
return ret;
}
+/* Destroy an m68k ELF linker hash table. */
+
+static void
+elf_m68k_link_hash_table_free (bfd *obfd)
+{
+ struct elf_m68k_link_hash_table *htab;
+
+ htab = (struct elf_m68k_link_hash_table *) obfd->link.hash;
+
+ if (htab->multi_got_.bfd2got != NULL)
+ {
+ htab_delete (htab->multi_got_.bfd2got);
+ htab->multi_got_.bfd2got = NULL;
+ }
+ _bfd_elf_link_hash_table_free (obfd);
+}
+
/* Create an m68k ELF linker hash table. */
static struct bfd_link_hash_table *
free (ret);
return NULL;
}
+ ret->root.root.hash_table_free = elf_m68k_link_hash_table_free;
ret->multi_got_.global_symndx = 1;
return &ret->root.root;
}
-/* Destruct local data. */
-
-static void
-elf_m68k_link_hash_table_free (struct bfd_link_hash_table *_htab)
-{
- struct elf_m68k_link_hash_table *htab;
-
- htab = (struct elf_m68k_link_hash_table *) _htab;
-
- if (htab->multi_got_.bfd2got != NULL)
- {
- htab_delete (htab->multi_got_.bfd2got);
- htab->multi_got_.bfd2got = NULL;
- }
- _bfd_elf_link_hash_table_free (_htab);
-}
-
/* Set the right machine number. */
static bfd_boolean
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ /* PR15323, ref flags aren't set for references in the same
+ object. */
+ h->root.non_ir_ref = 1;
}
switch (ELF32_R_TYPE (rel->r_info))
#define add_dynamic_entry(TAG, VAL) \
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (!info->shared)
+ if (info->executable)
{
if (!add_dynamic_entry (DT_DEBUG, 0))
return FALSE;
}
else
{
- bfd_boolean warned;
+ bfd_boolean warned, ignored;
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
- unresolved_reloc, warned);
+ unresolved_reloc, warned, ignored);
}
if (sec != NULL && discarded_section (sec))
}
static enum elf_reloc_type_class
-elf32_m68k_reloc_type_class (const Elf_Internal_Rela *rela)
+elf32_m68k_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const asection *rel_sec ATTRIBUTE_UNUSED,
+ const Elf_Internal_Rela *rela)
{
switch ((int) ELF32_R_TYPE (rela->r_info))
{
case 154: /* Linux/m68k */
/* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+ elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
/* pr_pid */
- elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 22);
+ elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 22);
/* pr_reg */
offset = 70;
return FALSE;
case 124: /* Linux/m68k elf_prpsinfo. */
- elf_tdata (abfd)->core_pid
+ elf_tdata (abfd)->core->pid
= bfd_get_32 (abfd, note->descdata + 12);
- elf_tdata (abfd)->core_program
+ elf_tdata (abfd)->core->program
= _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
- elf_tdata (abfd)->core_command
+ elf_tdata (abfd)->core->command
= _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
}
onto the end of the args in some (at least one anyway)
implementations, so strip it off if it exists. */
{
- char *command = elf_tdata (abfd)->core_command;
+ char *command = elf_tdata (abfd)->core->command;
int n = strlen (command);
if (n > 0 && command[n - 1] == ' ')
return TRUE;
}
-#define TARGET_BIG_SYM bfd_elf32_m68k_vec
+/* Hook called by the linker routine which adds symbols from an object
+ file. */
+
+static bfd_boolean
+elf_m68k_add_symbol_hook (bfd *abfd,
+ struct bfd_link_info *info,
+ Elf_Internal_Sym *sym,
+ const char **namep ATTRIBUTE_UNUSED,
+ flagword *flagsp ATTRIBUTE_UNUSED,
+ asection **secp ATTRIBUTE_UNUSED,
+ bfd_vma *valp ATTRIBUTE_UNUSED)
+{
+ if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
+ || ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
+ && (abfd->flags & DYNAMIC) == 0
+ && bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
+ elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE;
+
+ return TRUE;
+}
+
+#define TARGET_BIG_SYM m68k_elf32_vec
#define TARGET_BIG_NAME "elf32-m68k"
#define ELF_MACHINE_CODE EM_68K
#define ELF_MAXPAGESIZE 0x2000
_bfd_elf_create_dynamic_sections
#define bfd_elf32_bfd_link_hash_table_create \
elf_m68k_link_hash_table_create
-/* ??? Should it be this macro or bfd_elfNN_bfd_link_hash_table_create? */
-#define bfd_elf32_bfd_link_hash_table_free \
- elf_m68k_link_hash_table_free
#define bfd_elf32_bfd_final_link bfd_elf_final_link
#define elf_backend_check_relocs elf_m68k_check_relocs
#define elf_backend_object_p elf32_m68k_object_p
#define elf_backend_grok_prstatus elf_m68k_grok_prstatus
#define elf_backend_grok_psinfo elf_m68k_grok_psinfo
+#define elf_backend_add_symbol_hook elf_m68k_add_symbol_hook
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1