/* BFD back-end for PDP-11 a.out binaries.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 2001-2015 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
#define TABLE_SIZE(TABLE) (sizeof(TABLE)/sizeof(TABLE[0]))
-static bfd_boolean aout_link_check_archive_element (bfd *, struct bfd_link_info *, bfd_boolean *);
+static bfd_boolean aout_link_check_archive_element (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, const char *, bfd_boolean *);
static bfd_boolean aout_link_add_object_symbols (bfd *, struct bfd_link_info *);
static bfd_boolean aout_link_add_symbols (bfd *, struct bfd_link_info *);
static bfd_boolean aout_link_write_symbols (struct aout_final_link_info *, bfd *);
if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0
|| !NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))
|| bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0
- || !NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))
+ || !NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd)))
return FALSE;
}
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
|| bfd_bwrite (location, count, abfd) != count)
return FALSE;
+
+ /* If necessary, pad the section to its aligned size. */
+ if ((section == obj_datasec (abfd)
+ || section == obj_textsec (abfd))
+ && count < section->size
+ && (bfd_seek (abfd, section->filepos + offset + section->size - 1, SEEK_SET) != 0
+ || bfd_bwrite ("", 1, abfd) != 1))
+ return FALSE;
}
return TRUE;
count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
+ /* PR 17512: file: 011f5a08. */
+ if (count == 0)
+ {
+ obj_aout_external_syms (abfd) = NULL;
+ obj_aout_external_sym_count (abfd) = count;
+ return TRUE;
+ }
+
#ifdef USE_MMAP
if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd),
exec_hdr (abfd)->a_syms,
bfd_boolean
NAME (aout, find_nearest_line) (bfd *abfd,
- asection *section,
asymbol **symbols,
+ asection *section,
bfd_vma offset,
const char **filename_ptr,
const char **functionname_ptr,
- unsigned int *line_ptr)
+ unsigned int *line_ptr,
+ unsigned int *discriminator_ptr)
{
/* Run down the file looking for the filename, function and linenumber. */
asymbol **p;
*filename_ptr = abfd->filename;
*functionname_ptr = 0;
*line_ptr = 0;
+ if (discriminator_ptr)
+ *discriminator_ptr = 0;
if (symbols != NULL)
{
struct aout_link_hash_table *ret;
bfd_size_type amt = sizeof (struct aout_link_hash_table);
- ret = bfd_alloc (abfd, amt);
+ ret = bfd_malloc (amt);
if (ret == NULL)
return NULL;
if (! NAME (aout, link_hash_table_init) (ret, abfd,
static bfd_boolean
aout_link_check_archive_element (bfd *abfd,
struct bfd_link_info *info,
+ struct bfd_link_hash_entry *h ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
bfd_boolean *pneeded)
{
bfd *oldbfd;
size = bfd_get_reloc_size (howto);
buf = bfd_zmalloc (size);
- if (buf == NULL)
+ if (buf == NULL && size != 0)
return FALSE;
r = MY_relocate_contents (howto, flaginfo->output_bfd,
pr->addend, buf);
/* Do the final link step. This is called on the output BFD. The
INFO structure should point to a list of BFDs linked through the
- link_next field which can be used to find each BFD which takes part
+ link.next field which can be used to find each BFD which takes part
in the output. Also, each section in ABFD should point to a list
of bfd_link_order structures which list all the input sections for
the output section. */
max_contents_size = 0;
max_relocs_size = 0;
max_sym_count = 0;
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
{
size_t sz;
We use the output_has_begun field of the input BFDs to see
whether we have already handled it. */
- for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
sub->output_has_begun = FALSE;
/* Mark all sections which are to be included in the link. This