unstrip: Allow prelinked, but non-split .bss section.
authorMark Wielaard <mjw@redhat.com>
Mon, 26 May 2014 20:35:30 +0000 (22:35 +0200)
committerMark Wielaard <mjw@redhat.com>
Tue, 27 May 2014 20:00:46 +0000 (22:00 +0200)
If the section sh_size of the original and undo section are equal then
match them and don't set split_bss. This is also what prelink's
undo_sections allows.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
src/ChangeLog
src/unstrip.c

index 4067583..4062fc7 100644 (file)
@@ -1,5 +1,10 @@
 2014-05-26  Mark Wielaard  <mjw@redhat.com>
 
+       * unstrip.c (find_alloc_sections_prelink): Allow non-split .bss
+       section when sh_size of the original and undo .bss section are equal.
+
+2014-05-26  Mark Wielaard  <mjw@redhat.com>
+
        * unstrip.c (options): Add --force, -F.
        (struct arg_info): Add bool force.
        (parse_opt): Handle 'F', set force.
index 65bb251..f6af450 100644 (file)
@@ -1125,10 +1125,11 @@ find_alloc_sections_prelink (Elf *debug, Elf_Data *debug_shstrtab,
                      && (sec->shdr.sh_type == undo_sec->shdr.sh_type
                          || (sec->shdr.sh_type == SHT_PROGBITS
                              && undo_sec->shdr.sh_type == SHT_NOBITS))
-                     && sec->shdr.sh_size < undo_sec->shdr.sh_size
+                     && sec->shdr.sh_size <= undo_sec->shdr.sh_size
                      && (!strcmp (sec->name, ".bss")
                          || !strcmp (sec->name, ".sbss"))
-                     && (split_bss = sec) > sections)))
+                     && (sec->shdr.sh_size == undo_sec->shdr.sh_size
+                         || (split_bss = sec) > sections))))
            {
              sec->outscn = undo_sec->outscn;
              undo_sec = NULL;