Fix for GNUstep build failure during dumping.
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Fri, 9 Dec 2011 12:33:20 +0000 (21:33 +0900)
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Fri, 9 Dec 2011 12:33:20 +0000 (21:33 +0900)
* unexelf.c (unexec) [NS_IMPL_GNUSTEP]: Take account of the case
that where the value of an _OBJC_* symbol points to is in the .bss
section (Bug#10240).

src/ChangeLog
src/unexelf.c

index c533b93..44f80ae 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-09  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
+
+       * unexelf.c (unexec) [NS_IMPL_GNUSTEP]: Take account of the case
+       that where the value of an _OBJC_* symbol points to is in the .bss
+       section (Bug#10240).
+
 2011-12-08  Kazuhiro Ito  <kzhr@d1.dion.ne.jp>  (tiny change)
 
        * coding.c (encode_coding_ccl): Check (charbuf < charbuf_end)
index 04c029f..1715c36 100644 (file)
@@ -1219,9 +1219,15 @@ temacs:
              nn = symp->st_shndx;
              if (nn > old_bss_index)
                nn--;
-             old = ((symp->st_value - NEW_SECTION_H (symp->st_shndx).sh_addr)
-                    + OLD_SECTION_H (nn).sh_offset + old_base);
-             memcpy (new, old, symp->st_size);
+             if (nn == old_bss_index)
+               memset (new, 0, symp->st_size);
+             else
+               {
+                 old = ((symp->st_value
+                         - NEW_SECTION_H (symp->st_shndx).sh_addr)
+                        + OLD_SECTION_H (nn).sh_offset + old_base);
+                 memcpy (new, old, symp->st_size);
+               }
            }
 #endif
        }