[AArch64] Drop unused argument to elf_aarch64_create_or_find_stub_sec
[deliverable/binutils-gdb.git] / bfd / merge.c
index 180af267a219bcaf970e19f0d421f4a75b398899..5f45ba6e106cad4b7dd2b05d6c1413a0761aab9e 100644 (file)
@@ -1,6 +1,5 @@
 /* SEC_MERGE support.
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-   Free Software Foundation, Inc.
+   Copyright (C) 2001-2015 Free Software Foundation, Inc.
    Written by Jakub Jelinek <jakub@redhat.com>.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -307,9 +306,6 @@ sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry)
       len = -off & (entry->alignment - 1);
       if (len != 0)
        {
-         /* We should never have an entry with an alignment
-            greater than the section's alignment.  */
-         BFD_ASSERT (len <= (bfd_size_type) (1 << alignment_power));
          if (bfd_bwrite (pad, len, abfd) != len)
            goto err;
          off += len;
@@ -327,7 +323,6 @@ sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry)
   /* Trailing alignment needed?  */
   off = sec->size - off;
   if (off != 0
-      && alignment_power
       && bfd_bwrite (pad, off, abfd) != off)
     goto err;
 
@@ -352,6 +347,7 @@ _bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec,
   struct sec_merge_sec_info *secinfo;
   unsigned int align;
   bfd_size_type amt;
+  bfd_byte *contents;
 
   if ((abfd->flags & DYNAMIC) != 0
       || (sec->flags & SEC_MERGE) == 0)
@@ -436,8 +432,8 @@ _bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec,
   sec->rawsize = sec->size;
   if (sec->flags & SEC_STRINGS)
     memset (secinfo->contents + sec->size, 0, sec->entsize);
-  if (! bfd_get_section_contents (sec->owner, sec, secinfo->contents,
-                                 0, sec->size))
+  contents = secinfo->contents;
+  if (! bfd_get_full_section_contents (sec->owner, sec, &contents))
     goto error_return;
 
   return TRUE;
@@ -888,3 +884,17 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec,
   *psec = entry->secinfo->sec;
   return entry->u.index + (secinfo->contents + offset - p);
 }
+
+/* Tidy up when done.  */
+
+void
+_bfd_merge_sections_free (void *xsinfo)
+{
+  struct sec_merge_info *sinfo;
+
+  for (sinfo = (struct sec_merge_info *) xsinfo; sinfo; sinfo = sinfo->next)
+    {
+      bfd_hash_table_free (&sinfo->htab->table);
+      free (sinfo->htab);
+    }
+}
This page took 0.025245 seconds and 4 git commands to generate.