]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Fix handling of gaps between sections when writing files in libelf.
authorLubomir Rintel <lkundrak@v3.sk>
Wed, 22 Jul 2009 04:04:47 +0000 (21:04 -0700)
committerUlrich Drepper <drepper@redhat.com>
Wed, 22 Jul 2009 04:04:47 +0000 (21:04 -0700)
libelf/ChangeLog
libelf/elf32_updatefile.c

index ec6514b8527390cb02de2408c81c9da56a05bbee..d6f341512662103985cf21ac64826064e3a1dc02 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-21  Ulrich Drepper  <drepper@redhat.com>
+
+       * elf32_updatefile.c (__elfXX_updatemmap): Fix handling of gaps between
+       sections.  Patch by Lubomir Rintel <lkundrak@v3.sk>.
+
 2009-07-08  Roland McGrath  <roland@redhat.com>
 
        * libelfP.h (struct Elf): Remove unused ar.has_index field.
index a4d83a1c6762a79fbcf68647bc3a6dffff18424b..0539f03d0b3ef247ce968f29b2c80ee45eaf26b8 100644 (file)
@@ -336,10 +336,13 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf, int change_bo, size_t shnum)
 
                /* If there is a gap, fill it.  */
                if (scn_start + dl->data.d.d_off > last_position
-                   && ((previous_scn_changed && dl->data.d.d_off == 0)
+                   && (dl->data.d.d_off == 0
                        || ((scn->flags | dl->flags | elf->flags)
                            & ELF_F_DIRTY) != 0))
-                 fill_mmap (dl->data.d.d_off);
+                 {
+                   fill_mmap (dl->data.d.d_off);
+                   last_position = scn_start + dl->data.d.d_off;
+                 }
 
                if ((scn->flags | dl->flags | elf->flags) & ELF_F_DIRTY)
                  {