/* BFD back-end for ALPHA Extended-Coff files.
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
- Free Software Foundation, Inc.
+ Copyright (C) 1993-2017 Free Software Foundation, Inc.
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
Ian Lance Taylor <ian@cygnus.com>.
return TRUE;
if (ALPHA_ECOFF_COMPRESSEDMAG (*internal_f))
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: Cannot handle compressed Alpha binaries.\n"
" Use compiler flags, or objZ, to generate uncompressed binaries."),
abfd);
{
if (intern->r_type > ALPHA_R_GPVALUE)
{
- (*_bfd_error_handler)
+ /* xgettext:c-format */
+ _bfd_error_handler
(_("%B: unknown/unsupported relocation type %d"),
abfd, intern->r_type);
bfd_set_error (bfd_error_bad_value);
switch (r)
{
case bfd_reloc_undefined:
- if (! ((*link_info->callbacks->undefined_symbol)
- (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
- input_bfd, input_section, rel->address, TRUE)))
- goto error_return;
+ (*link_info->callbacks->undefined_symbol)
+ (link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
+ input_bfd, input_section, rel->address, TRUE);
break;
case bfd_reloc_dangerous:
- if (! ((*link_info->callbacks->reloc_dangerous)
- (link_info, err, input_bfd, input_section,
- rel->address)))
- goto error_return;
+ (*link_info->callbacks->reloc_dangerous)
+ (link_info, err, input_bfd, input_section, rel->address);
break;
case bfd_reloc_overflow:
- if (! ((*link_info->callbacks->reloc_overflow)
- (link_info, NULL,
- bfd_asymbol_name (*rel->sym_ptr_ptr),
- rel->howto->name, rel->addend, input_bfd,
- input_section, rel->address)))
- goto error_return;
+ (*link_info->callbacks->reloc_overflow)
+ (link_info, NULL, bfd_asymbol_name (*rel->sym_ptr_ptr),
+ rel->howto->name, rel->addend, input_bfd,
+ input_section, rel->address);
break;
case bfd_reloc_outofrange:
default:
unsigned long r_symndx;
bfd_vma relocation;
- BFD_ASSERT (info->relocatable);
+ BFD_ASSERT (bfd_link_relocatable (info));
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
lita_sec = symndx_to_section[RELOC_SECTION_LITA];
gp = _bfd_get_gp_value (output_bfd);
- if (! info->relocatable && lita_sec != NULL)
+ if (! bfd_link_relocatable (info) && lita_sec != NULL)
{
struct ecoff_section_tdata *lita_sec_data;
switch (r_type)
{
case ALPHA_R_GPRELHIGH:
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: unsupported relocation: ALPHA_R_GPRELHIGH"),
input_bfd);
bfd_set_error (bfd_error_bad_value);
continue;
case ALPHA_R_GPRELLOW:
- (*_bfd_error_handler)
+ _bfd_error_handler
(_("%B: unsupported relocation: ALPHA_R_GPRELLOW"),
input_bfd);
bfd_set_error (bfd_error_bad_value);
continue;
default:
- (*_bfd_error_handler)
+ _bfd_error_handler
+ /* xgettext:c-format */
(_("%B: unknown relocation type %d"),
input_bfd, (int) r_type);
bfd_set_error (bfd_error_bad_value);
not otherwise used for anything. For some reason, the
address of the relocation does not appear to include the
section VMA, unlike the other relocation types. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr,
ext_rel->r_vaddr);
adjust_addrp = FALSE;
if (h == (struct ecoff_link_hash_entry *) NULL)
abort ();
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
{
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
do not have a meaningful number for the
location within the section that is being
relocated. */
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, (bfd_vma) 0, TRUE)))
- return FALSE;
+ (*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd,
+ input_section, (bfd_vma) 0, TRUE);
addend = 0;
}
}
/* This symbol is not being written out. Pass
the address as 0, as with undefined_symbol,
above. */
- if (! ((*info->callbacks->unattached_reloc)
- (info, h->root.root.string, input_bfd,
- input_section, (bfd_vma) 0)))
- return FALSE;
+ (*info->callbacks->unattached_reloc)
+ (info, h->root.root.string,
+ input_bfd, input_section, (bfd_vma) 0);
}
addend = alpha_convert_external_reloc (output_bfd, info,
addend += r_vaddr;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* Adjust r_vaddr by the addend. */
H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr);
/* Store a value from the reloc stack into a bitfield. If
we are generating relocatable output, all we do is
adjust the address of the reloc. */
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
{
bfd_vma mask;
bfd_vma val;
abort ();
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* We are generating relocatable output, and must
convert the existing reloc. */
&& h->indx == -1)
{
/* This symbol is not being written out. */
- if (! ((*info->callbacks->unattached_reloc)
- (info, h->root.root.string, input_bfd,
- input_section, r_vaddr - input_section->vma)))
- return FALSE;
+ (*info->callbacks->unattached_reloc)
+ (info, h->root.root.string, input_bfd,
+ input_section, r_vaddr - input_section->vma);
}
relocation = alpha_convert_external_reloc (output_bfd,
}
else
{
- if (! ((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section,
- r_vaddr - input_section->vma, TRUE)))
- return FALSE;
+ (*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd, input_section,
+ r_vaddr - input_section->vma, TRUE);
relocation = 0;
}
}
else
name = bfd_section_name (input_bfd,
symndx_to_section[r_symndx]);
- if (! ((*info->callbacks->reloc_overflow)
- (info, NULL, name,
- alpha_howto_table[r_type].name,
- (bfd_vma) 0, input_bfd, input_section,
- r_vaddr - input_section->vma)))
- return FALSE;
+ (*info->callbacks->reloc_overflow)
+ (info, NULL, name, alpha_howto_table[r_type].name,
+ (bfd_vma) 0, input_bfd, input_section,
+ r_vaddr - input_section->vma);
}
break;
}
}
}
- if (info->relocatable && adjust_addrp)
+ if (bfd_link_relocatable (info) && adjust_addrp)
{
/* Change the address of the relocation. */
H_PUT_64 (input_bfd,
if (gp_usedp && gp_undefined)
{
- if (! ((*info->callbacks->reloc_dangerous)
- (info, _("GP relative relocation used when GP not defined"),
- input_bfd, input_section, r_vaddr - input_section->vma)))
- return FALSE;
+ (*info->callbacks->reloc_dangerous)
+ (info, _("GP relative relocation used when GP not defined"),
+ input_bfd, input_section, r_vaddr - input_section->vma);
/* Only give the error once per link. */
gp = 4;
_bfd_set_gp_value (output_bfd, gp);
static bfd *
alpha_ecoff_openr_next_archived_file (bfd *archive, bfd *last_file)
{
- file_ptr filestart;
+ ufile_ptr filestart;
if (last_file == NULL)
filestart = bfd_ardata (archive)->first_file_filepos;
BSD-4.4-style element with a long odd size. */
filestart = last_file->proxy_origin + size;
filestart += filestart % 2;
+ if (filestart < last_file->proxy_origin)
+ {
+ /* Prevent looping. See PR19256. */
+ bfd_set_error (bfd_error_malformed_archive);
+ return NULL;
+ }
}
return alpha_ecoff_get_elt_at_filepos (archive, filestart);
alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
alpha_ecoff_swap_scnhdr_out,
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE,
- ECOFF_NO_LONG_SECTION_NAMES, 4, FALSE, 2,
+ ECOFF_NO_LONG_SECTION_NAMES, 4, FALSE, 2, 32768,
alpha_ecoff_swap_filehdr_in, alpha_ecoff_swap_aouthdr_in,
alpha_ecoff_swap_scnhdr_in, NULL,
alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
#define _bfd_ecoff_section_already_linked \
_bfd_coff_section_already_linked
#define _bfd_ecoff_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define _bfd_ecoff_bfd_define_start_stop bfd_generic_define_start_stop
+#define _bfd_ecoff_bfd_link_check_relocs _bfd_generic_link_check_relocs
+
+/* Installing internal relocations in a section is also generic. */
+#define _bfd_ecoff_set_reloc _bfd_generic_set_reloc
-const bfd_target ecoffalpha_little_vec =
+const bfd_target alpha_ecoff_le_vec =
{
"ecoff-littlealpha", /* name */
bfd_target_ecoff_flavour,