PR 21564, Section start in binary output file incorrect
authorAlan Modra <amodra@gmail.com>
Sun, 11 Jun 2017 04:04:13 +0000 (13:34 +0930)
committerAlan Modra <amodra@gmail.com>
Sun, 11 Jun 2017 04:15:18 +0000 (13:45 +0930)
PR 21564
* binary.c (binary_set_section_contents): Scale lma by octets
per byte to set filepos.

bfd/ChangeLog
bfd/binary.c

index d899df6cae61126b019b4a659cbd2c5a1d7fbbef..a0c2681fa28b62d8efcd423f4c9fcce9ccc58c0f 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-11  Joe Zbiciak  <joe.zbiciak@leftturnonly.info>
+
+       PR 21564
+       * binary.c (binary_set_section_contents): Scale lma by octets
+       per byte to set filepos.
+
 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
 
        * elf32-arc.c (elf_arc_check_relocs): Fixed conditions to generate
index ff52f1423b3fbf47c6b0211f6d96e47231c6a04d..0a811cf2d223b96ed1fac2245e904909e74e081d 100644 (file)
@@ -230,6 +230,7 @@ binary_set_section_contents (bfd *abfd,
 
   if (! abfd->output_has_begun)
     {
+      unsigned int opb;
       bfd_boolean found_low;
       bfd_vma low;
       asection *s;
@@ -250,9 +251,10 @@ binary_set_section_contents (bfd *abfd,
            found_low = TRUE;
          }
 
+      opb = bfd_octets_per_byte (abfd);
       for (s = abfd->sections; s != NULL; s = s->next)
        {
-         s->filepos = s->lma - low;
+         s->filepos = (s->lma - low) * opb;
 
          /* Skip following warning check for sections that will not
             occupy file space.  */
This page took 0.0279700000000001 seconds and 4 git commands to generate.