projects
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Indent labels
[binutils-gdb.git]
/
bfd
/
elf32-m68k.c
diff --git
a/bfd/elf32-m68k.c
b/bfd/elf32-m68k.c
index e8d9ed5ce1451e5b541891a7d11bc8dfa1d94f31..5b9d420ded80fd8f044bb0fc53414b34ad40b2a7 100644
(file)
--- a/
bfd/elf32-m68k.c
+++ b/
bfd/elf32-m68k.c
@@
-1,5
+1,5
@@
/* Motorola 68k series support for 32-bit ELF
/* Motorola 68k series support for 32-bit ELF
- Copyright (C) 1993-20
19
Free Software Foundation, Inc.
+ Copyright (C) 1993-20
20
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This file is part of BFD, the Binary File Descriptor library.
@@
-25,6
+25,8
@@
#include "elf-bfd.h"
#include "elf/m68k.h"
#include "opcode/m68k.h"
#include "elf-bfd.h"
#include "elf/m68k.h"
#include "opcode/m68k.h"
+#include "cpu-m68k.h"
+#include "elf32-m68k.h"
static bfd_boolean
elf_m68k_discard_copies (struct elf_link_hash_entry *, void *);
static bfd_boolean
elf_m68k_discard_copies (struct elf_link_hash_entry *, void *);
@@
-969,7
+971,7
@@
static struct bfd_link_hash_table *
elf_m68k_link_hash_table_create (bfd *abfd)
{
struct elf_m68k_link_hash_table *ret;
elf_m68k_link_hash_table_create (bfd *abfd)
{
struct elf_m68k_link_hash_table *ret;
-
bfd_size_type
amt = sizeof (struct elf_m68k_link_hash_table);
+
size_t
amt = sizeof (struct elf_m68k_link_hash_table);
ret = (struct elf_m68k_link_hash_table *) bfd_zmalloc (amt);
if (ret == (struct elf_m68k_link_hash_table *) NULL)
ret = (struct elf_m68k_link_hash_table *) bfd_zmalloc (amt);
if (ret == (struct elf_m68k_link_hash_table *) NULL)
@@
-1053,9
+1055,8
@@
elf32_m68k_object_p (bfd *abfd)
/* Somewhat reverse of elf32_m68k_object_p, this sets the e_flag
field based on the machine number. */
/* Somewhat reverse of elf32_m68k_object_p, this sets the e_flag
field based on the machine number. */
-static void
-elf_m68k_final_write_processing (bfd *abfd,
- bfd_boolean linker ATTRIBUTE_UNUSED)
+static bfd_boolean
+elf_m68k_final_write_processing (bfd *abfd)
{
int mach = bfd_get_mach (abfd);
unsigned long e_flags = elf_elfheader (abfd)->e_flags;
{
int mach = bfd_get_mach (abfd);
unsigned long e_flags = elf_elfheader (abfd)->e_flags;
@@
-1108,6
+1109,7
@@
elf_m68k_final_write_processing (bfd *abfd,
}
elf_elfheader (abfd)->e_flags = e_flags;
}
}
elf_elfheader (abfd)->e_flags = e_flags;
}
+ return _bfd_elf_final_write_processing (abfd);
}
/* Keep m68k-specific flags in the ELF header. */
}
/* Keep m68k-specific flags in the ELF header. */
@@
-1519,14
+1521,18
@@
elf_m68k_get_got_entry (struct elf_m68k_got *got,
}
entry_.key_ = *key;
}
entry_.key_ = *key;
- ptr = htab_find_slot (got->entries, &entry_, (howto != SEARCH
- ? INSERT : NO_INSERT));
+ ptr = htab_find_slot (got->entries, &entry_,
+ (howto == SEARCH || howto == MUST_FIND ? NO_INSERT
+ : INSERT));
if (ptr == NULL)
{
if (howto == SEARCH)
/* Entry not found. */
return NULL;
if (ptr == NULL)
{
if (howto == SEARCH)
/* Entry not found. */
return NULL;
+ if (howto == MUST_FIND)
+ abort ();
+
/* We're out of memory. */
bfd_set_error (bfd_error_no_memory);
return NULL;
/* We're out of memory. */
bfd_set_error (bfd_error_no_memory);
return NULL;
@@
-1535,7
+1541,10
@@
elf_m68k_get_got_entry (struct elf_m68k_got *got,
if (*ptr == NULL)
/* We didn't find the entry and we're asked to create a new one. */
{
if (*ptr == NULL)
/* We didn't find the entry and we're asked to create a new one. */
{
- BFD_ASSERT (howto != MUST_FIND && howto != SEARCH);
+ if (howto == MUST_FIND)
+ abort ();
+
+ BFD_ASSERT (howto != SEARCH);
entry = bfd_alloc (elf_hash_table (info)->dynobj, sizeof (*entry));
if (entry == NULL)
entry = bfd_alloc (elf_hash_table (info)->dynobj, sizeof (*entry));
if (entry == NULL)
@@
-1750,14
+1759,18
@@
elf_m68k_get_bfd2got_entry (struct elf_m68k_multi_got *multi_got,
}
entry_.bfd = abfd;
}
entry_.bfd = abfd;
- ptr = htab_find_slot (multi_got->bfd2got, &entry_, (howto != SEARCH
- ? INSERT : NO_INSERT));
+ ptr = htab_find_slot (multi_got->bfd2got, &entry_,
+ (howto == SEARCH || howto == MUST_FIND ? NO_INSERT
+ : INSERT));
if (ptr == NULL)
{
if (howto == SEARCH)
/* Entry not found. */
return NULL;
if (ptr == NULL)
{
if (howto == SEARCH)
/* Entry not found. */
return NULL;
+ if (howto == MUST_FIND)
+ abort ();
+
/* We're out of memory. */
bfd_set_error (bfd_error_no_memory);
return NULL;
/* We're out of memory. */
bfd_set_error (bfd_error_no_memory);
return NULL;
@@
-1766,7
+1779,10
@@
elf_m68k_get_bfd2got_entry (struct elf_m68k_multi_got *multi_got,
if (*ptr == NULL)
/* Entry was not found. Create new one. */
{
if (*ptr == NULL)
/* Entry was not found. Create new one. */
{
- BFD_ASSERT (howto != MUST_FIND && howto != SEARCH);
+ if (howto == MUST_FIND)
+ abort ();
+
+ BFD_ASSERT (howto != SEARCH);
entry = ((struct elf_m68k_bfd2got_entry *)
bfd_alloc (elf_hash_table (info)->dynobj, sizeof (*entry)));
entry = ((struct elf_m68k_bfd2got_entry *)
bfd_alloc (elf_hash_table (info)->dynobj, sizeof (*entry)));
@@
-3090,7
+3106,7
@@
elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */
/* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */
- name = bfd_
get_section_name (dynobj,
s);
+ name = bfd_
section_name (
s);
if (strcmp (name, ".plt") == 0)
{
if (strcmp (name, ".plt") == 0)
{
@@
-3562,12
+3578,9
@@
elf_m68k_relocate_section (bfd *output_bfd,
BFD_ASSERT (sgot != NULL);
if (got == NULL)
BFD_ASSERT (sgot != NULL);
if (got == NULL)
- {
- got = elf_m68k_get_bfd2got_entry (elf_m68k_multi_got (info),
- input_bfd, MUST_FIND,
- NULL)->got;
- BFD_ASSERT (got != NULL);
- }
+ got = elf_m68k_get_bfd2got_entry (elf_m68k_multi_got (info),
+ input_bfd, MUST_FIND,
+ NULL)->got;
/* Get GOT offset for this symbol. */
elf_m68k_init_got_entry_key (&key_, h, input_bfd, r_symndx,
/* Get GOT offset for this symbol. */
elf_m68k_init_got_entry_key (&key_, h, input_bfd, r_symndx,
@@
-3927,7
+3940,7
@@
elf_m68k_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0')
name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0')
- name = bfd_section_name (
input_bfd,
sec);
+ name = bfd_section_name (sec);
}
_bfd_error_handler
}
_bfd_error_handler
@@
-3962,7
+3975,7
@@
elf_m68k_relocate_section (bfd *output_bfd,
if (name == NULL)
return FALSE;
if (*name == '\0')
if (name == NULL)
return FALSE;
if (*name == '\0')
- name = bfd_section_name (
input_bfd,
sec);
+ name = bfd_section_name (sec);
}
if (r == bfd_reloc_overflow)
}
if (r == bfd_reloc_overflow)
@@
-4442,7
+4455,7
@@
bfd_m68k_elf32_create_embedded_relocs (bfd *abfd, struct bfd_link_info *info,
free (internal_relocs);
return TRUE;
free (internal_relocs);
return TRUE;
-error_return:
+
error_return:
if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
free (isymbuf);
if (internal_relocs != NULL
if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf)
free (isymbuf);
if (internal_relocs != NULL