/* SPU specific support for 32-bit ELF
- Copyright (C) 2006-2019 Free Software Foundation, Inc.
+ Copyright (C) 2006-2020 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
#include "elf/spu.h"
#include "elf32-spu.h"
+/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */
+#define OCTETS_PER_BYTE(ABFD, SEC) 1
+
/* We use RELA style relocs. Don't define USE_REL. */
static bfd_reloc_status_type spu_elf_rel9 (bfd *, arelent *, asymbol *,
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section))
return bfd_reloc_outofrange;
- octets = reloc_entry->address * bfd_octets_per_byte (abfd);
+ octets = reloc_entry->address * OCTETS_PER_BYTE (abfd, input_section);
/* Get symbol value. */
val = 0;
if (elf_section_data (isec)->relocs != internal_relocs)
free (internal_relocs);
error_ret_free_local:
- if (local_syms != NULL
- && (symtab_hdr->contents
- != (unsigned char *) local_syms))
+ if (symtab_hdr->contents != (unsigned char *) local_syms)
free (local_syms);
return FALSE;
}
continue;
}
- if (symtab_hdr->contents != NULL)
- {
- /* Don't use cached symbols since the generic ELF linker
- code only reads local symbols, and we need globals too. */
- free (symtab_hdr->contents);
- symtab_hdr->contents = NULL;
- }
+ /* Don't use cached symbols since the generic ELF linker
+ code only reads local symbols, and we need globals too. */
+ free (symtab_hdr->contents);
+ symtab_hdr->contents = NULL;
syms = bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, 0,
NULL, NULL, NULL);
symtab_hdr->contents = (void *) syms;
bfd *const *abfd1 = a;
bfd *const *abfd2 = b;
- return filename_cmp ((*abfd1)->filename, (*abfd2)->filename);
+ return filename_cmp (bfd_get_filename (*abfd1), bfd_get_filename (*abfd2));
}
static unsigned int
if (fprintf (script, " %s%c%s (%s)\n",
(sec->owner->my_archive != NULL
- ? sec->owner->my_archive->filename : ""),
+ ? bfd_get_filename (sec->owner->my_archive) : ""),
info->path_separator,
- sec->owner->filename,
+ bfd_get_filename (sec->owner),
sec->name) <= 0)
return -1;
if (sec->segment_mark)
sec = call_fun->sec;
if (fprintf (script, " %s%c%s (%s)\n",
(sec->owner->my_archive != NULL
- ? sec->owner->my_archive->filename : ""),
+ ? bfd_get_filename (sec->owner->my_archive) : ""),
info->path_separator,
- sec->owner->filename,
+ bfd_get_filename (sec->owner),
sec->name) <= 0)
return -1;
for (call = call_fun->call_list; call; call = call->next)
if (sec != NULL
&& fprintf (script, " %s%c%s (%s)\n",
(sec->owner->my_archive != NULL
- ? sec->owner->my_archive->filename : ""),
+ ? bfd_get_filename (sec->owner->my_archive) : ""),
info->path_separator,
- sec->owner->filename,
+ bfd_get_filename (sec->owner),
sec->name) <= 0)
return -1;
if (sec != NULL
&& fprintf (script, " %s%c%s (%s)\n",
(sec->owner->my_archive != NULL
- ? sec->owner->my_archive->filename : ""),
+ ? bfd_get_filename (sec->owner->my_archive) : ""),
info->path_separator,
- sec->owner->filename,
+ bfd_get_filename (sec->owner),
sec->name) <= 0)
return -1;
for (call = call_fun->call_list; call; call = call->next)
qsort (bfd_arr, bfd_count, sizeof (*bfd_arr), sort_bfds);
for (i = 1; i < bfd_count; ++i)
- if (filename_cmp (bfd_arr[i - 1]->filename, bfd_arr[i]->filename) == 0)
+ if (filename_cmp (bfd_get_filename (bfd_arr[i - 1]),
+ bfd_get_filename (bfd_arr[i])) == 0)
{
if (bfd_arr[i - 1]->my_archive == bfd_arr[i]->my_archive)
{
if (bfd_arr[i - 1]->my_archive && bfd_arr[i]->my_archive)
/* xgettext:c-format */
info->callbacks->einfo (_("%s duplicated in %s\n"),
- bfd_arr[i]->filename,
- bfd_arr[i]->my_archive->filename);
+ bfd_get_filename (bfd_arr[i]),
+ bfd_get_filename (bfd_arr[i]->my_archive));
else
info->callbacks->einfo (_("%s duplicated\n"),
- bfd_arr[i]->filename);
+ bfd_get_filename (bfd_arr[i]));
ok = FALSE;
}
}
&& !(r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64))
{
bfd_boolean err;
- err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
- || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT);
- (*info->callbacks->undefined_symbol) (info,
- h->root.root.string,
- input_bfd,
- input_section,
- rel->r_offset, err);
+
+ err = (info->unresolved_syms_in_objects == RM_DIAGNOSE
+ && !info->warn_unresolved_syms)
+ || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT;
+
+ info->callbacks->undefined_symbol
+ (info, h->root.root.string, input_bfd,
+ input_section, rel->r_offset, err);
}
sym_name = h->root.root.string;
}
/* Set ELF header e_type for plugins. */
-static void
-spu_elf_post_process_headers (bfd *abfd, struct bfd_link_info *info)
+static bfd_boolean
+spu_elf_init_file_header (bfd *abfd, struct bfd_link_info *info)
{
+ if (!_bfd_elf_init_file_header (abfd, info))
+ return FALSE;
+
if (spu_plugin)
{
Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
i_ehdrp->e_type = ET_DYN;
}
-
- _bfd_elf_post_process_headers (abfd, info);
+ return TRUE;
}
/* We may add an extra PT_LOAD segment for .toe. We also need extra
#define elf_backend_additional_program_headers spu_elf_additional_program_headers
#define elf_backend_modify_segment_map spu_elf_modify_segment_map
#define elf_backend_modify_headers spu_elf_modify_headers
-#define elf_backend_post_process_headers spu_elf_post_process_headers
+#define elf_backend_init_file_header spu_elf_init_file_header
#define elf_backend_fake_sections spu_elf_fake_sections
#define elf_backend_special_sections spu_elf_special_sections
#define bfd_elf32_bfd_final_link spu_elf_final_link