Clear HAS_RELOC if there are no relocations
[deliverable/binutils-gdb.git] / bfd / bfd.c
index 846ab58ac1a2d8d9aac9164f9ed20754b35d73cd..58c27c9d480a1fe82a33fbcf7510644152473e1f 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1,5 +1,5 @@
 /* Generic BFD library interface and support routines.
-   Copyright (C) 1990-2015 Free Software Foundation, Inc.
+   Copyright (C) 1990-2016 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -1090,11 +1090,11 @@ _bfd_abort (const char *file, int line, const char *fn)
 {
   if (fn != NULL)
     (*_bfd_error_handler)
-      (_("BFD %s internal error, aborting at %s line %d in %s\n"),
+      (_("BFD %s internal error, aborting at %s:%d in %s\n"),
        BFD_VERSION_STRING, file, line, fn);
   else
     (*_bfd_error_handler)
-      (_("BFD %s internal error, aborting at %s line %d\n"),
+      (_("BFD %s internal error, aborting at %s:%d\n"),
        BFD_VERSION_STRING, file, line);
   (*_bfd_error_handler) (_("Please report this bug.\n"));
   _exit (EXIT_FAILURE);
@@ -2000,7 +2000,8 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
                {
                  Elf64_External_Chdr *echdr
                    = (Elf64_External_Chdr *) contents;
-                 bfd_put_64 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type);
+                 bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type);
+                 bfd_put_32 (abfd, 0, &echdr->ch_reserved);
                  bfd_put_64 (abfd, sec->size, &echdr->ch_size);
                  bfd_put_64 (abfd, 1 << sec->alignment_power,
                              &echdr->ch_addralign);
@@ -2061,7 +2062,7 @@ bfd_check_compression_header (bfd *abfd, bfd_byte *contents,
       else
        {
          Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) contents;
-         chdr.ch_type = bfd_get_64 (abfd, &echdr->ch_type);
+         chdr.ch_type = bfd_get_32 (abfd, &echdr->ch_type);
          chdr.ch_size = bfd_get_64 (abfd, &echdr->ch_size);
          chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign);
        }
@@ -2165,19 +2166,20 @@ FUNCTION
 
 SYNOPSIS
        bfd_boolean bfd_convert_section_contents
-         (bfd *ibfd, asection *isec, bfd *obfd, bfd_byte **ptr);
+         (bfd *ibfd, asection *isec, bfd *obfd,
+          bfd_byte **ptr, bfd_size_type *ptr_size);
 
 DESCRIPTION
        Convert the contents, stored in @var{*ptr}, of the section
        @var{isec} in input BFD @var{ibfd} to output BFD @var{obfd}
        if needed.  The original buffer pointed to by @var{*ptr} may
        be freed and @var{*ptr} is returned with memory malloc'd by this
-       function.
+       function, and the new size written to @var{ptr_size}.
 */
 
 bfd_boolean
 bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
-                             bfd_byte **ptr)
+                             bfd_byte **ptr, bfd_size_type *ptr_size)
 {
   bfd_byte *contents;
   bfd_size_type ihdr_size, ohdr_size, size;
@@ -2222,7 +2224,7 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
   else
     {
       Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) contents;
-      chdr.ch_type = bfd_get_64 (ibfd, &echdr->ch_type);
+      chdr.ch_type = bfd_get_32 (ibfd, &echdr->ch_type);
       chdr.ch_size = bfd_get_64 (ibfd, &echdr->ch_size);
       chdr.ch_addralign = bfd_get_64 (ibfd, &echdr->ch_addralign);
 
@@ -2249,7 +2251,8 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
   else
     {
       Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) contents;
-      bfd_put_64 (obfd, ELFCOMPRESS_ZLIB, &echdr->ch_type);
+      bfd_put_32 (obfd, ELFCOMPRESS_ZLIB, &echdr->ch_type);
+      bfd_put_32 (obfd, 0, &echdr->ch_reserved);
       bfd_put_64 (obfd, chdr.ch_size, &echdr->ch_size);
       bfd_put_64 (obfd, chdr.ch_addralign, &echdr->ch_addralign);
     }
@@ -2264,5 +2267,6 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
       *ptr = contents;
     }
 
+  *ptr_size = size;
   return TRUE;
 }
This page took 0.027765 seconds and 4 git commands to generate.