/* Intel 80386/80486-specific support for 32-bit ELF
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
+ Copyright (C) 1993-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
}
static reloc_howto_type *
-elf_i386_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, unsigned r_type)
+elf_i386_rtype_to_howto (unsigned r_type)
{
unsigned int indx;
{
unsigned int r_type = ELF32_R_TYPE (dst->r_info);
- if ((cache_ptr->howto = elf_i386_rtype_to_howto (abfd, r_type)) == NULL)
+ if ((cache_ptr->howto = elf_i386_rtype_to_howto (r_type)) == NULL)
{
/* xgettext:c-format */
_bfd_error_handler (_("%pB: unsupported relocation type %#x"),
reloc_howto_type *from, *to;
const char *name;
- from = elf_i386_rtype_to_howto (abfd, from_type);
- to = elf_i386_rtype_to_howto (abfd, to_type);
+ from = elf_i386_rtype_to_howto (from_type);
+ to = elf_i386_rtype_to_howto (to_type);
if (h)
name = h->root.root.string;
}
else
{
- nop = link_info->call_nop_byte;
- if (link_info->call_nop_as_suffix)
+ nop = htab->params->call_nop_byte;
+ if (htab->params->call_nop_as_suffix)
{
nop_offset = roff + 3;
irel->r_offset -= 1;
/* It is referenced by a non-shared object. */
h->ref_regular = 1;
-
- if (h->type == STT_GNU_IFUNC)
- elf_tdata (info->output_bfd)->has_gnu_symbols
- |= elf_gnu_symbol_ifunc;
}
if (r_type == R_386_GOT32X
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_386_GNU_VTENTRY:
- BFD_ASSERT (h != NULL);
- if (h != NULL
- && !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
+ if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_offset))
goto error_return;
break;
{
const char *name;
- name = bfd_get_section_name (abfd, sec);
+ name = bfd_section_name (sec);
/* This is an ugly, but unfortunately necessary hack that is
needed when producing EFI binaries on x86. It tells
if (htab == NULL)
return FALSE;
- BFD_ASSERT (is_x86_elf (input_bfd, htab));
+ if (!is_x86_elf (input_bfd, htab))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return FALSE;
+ }
symtab_hdr = &elf_symtab_hdr (input_bfd);
sym_hashes = elf_sym_hashes (input_bfd);
continue;
}
- if ((indx = r_type) >= R_386_standard
- && ((indx = r_type - R_386_ext_offset) - R_386_standard
- >= R_386_ext - R_386_standard)
- && ((indx = r_type - R_386_tls_offset) - R_386_ext
- >= R_386_ext2 - R_386_ext))
+ howto = elf_i386_rtype_to_howto (r_type);
+ if (howto == NULL)
return _bfd_unrecognized_reloc (input_bfd, input_section, r_type);
- howto = elf_howto_table + indx;
-
r_symndx = ELF32_R_SYM (rel->r_info);
h = NULL;
sym = NULL;
if (sec != NULL && discarded_section (sec))
{
_bfd_clear_contents (howto, input_bfd, input_section,
- contents + rel->r_offset);
+ contents, rel->r_offset);
wrel->r_offset = rel->r_offset;
wrel->r_info = 0;
wrel->r_addend = 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)
"FreeBSD" label in the ELF header. So we put this label on all
executables and (for simplicity) also all other object files. */
-static void
-elf_i386_fbsd_post_process_headers (bfd *abfd, struct bfd_link_info *info)
+static bfd_boolean
+elf_i386_fbsd_init_file_header (bfd *abfd, struct bfd_link_info *info)
{
- _bfd_elf_post_process_headers (abfd, info);
+ if (!_bfd_elf_init_file_header (abfd, info))
+ return FALSE;
#ifdef OLD_FREEBSD_ABI_LABEL
{
memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
}
#endif
+ return TRUE;
}
-#undef elf_backend_post_process_headers
-#define elf_backend_post_process_headers elf_i386_fbsd_post_process_headers
+#undef elf_backend_init_file_header
+#define elf_backend_init_file_header elf_i386_fbsd_init_file_header
#undef elf32_bed
#define elf32_bed elf32_i386_fbsd_bed
#include "elf32-target.h"
+#undef elf_backend_init_file_header
+
/* Solaris 2. */
#undef TARGET_LITTLE_SYM
#undef elf_backend_arch_data
#define elf_backend_arch_data &elf_i386_solaris_arch_bed
-#undef elf_backend_post_process_headers
-
/* Restore default: we cannot use ELFOSABI_SOLARIS, otherwise ELFOSABI_NONE
objects won't be recognized. */
#undef ELF_OSABI
#undef ELF_OSABI
#undef elf_backend_want_plt_sym
#define elf_backend_want_plt_sym 0
-#undef elf_backend_post_process_headers
#undef elf_backend_static_tls_alignment
/* NaCl uses substantially different PLT entries for the same effects. */
#define elf_backend_object_p elf32_i386_nacl_elf_object_p
#undef elf_backend_modify_segment_map
#define elf_backend_modify_segment_map nacl_modify_segment_map
-#undef elf_backend_modify_program_headers
-#define elf_backend_modify_program_headers nacl_modify_program_headers
+#undef elf_backend_modify_headers
+#define elf_backend_modify_headers nacl_modify_headers
#undef elf_backend_final_write_processing
#define elf_backend_final_write_processing nacl_final_write_processing
/* Restore defaults. */
#undef elf_backend_object_p
#undef elf_backend_modify_segment_map
-#undef elf_backend_modify_program_headers
+#undef elf_backend_modify_headers
#undef elf_backend_final_write_processing
/* VxWorks support. */