+2010-06-14 Roland McGrath <roland@redhat.com>
+
+ * unstrip.c (copy_elided_sections): Make sure all sections' data have
+ been read in before we write anything out.
+
2010-06-04 Roland McGrath <roland@redhat.com>
* unstrip.c (update_shdr): New function.
GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
ELF_CHECK (shdr != NULL, _("cannot get section header: %s"));
+ /* We must make sure we have read in the data of all sections
+ beforehand and marked them to be written out. When we're
+ modifying the existing file in place, we might overwrite
+ this part of the file before we get to handling the section. */
+
+ ELF_CHECK (elf_flagdata (elf_getdata (scn, NULL),
+ ELF_C_SET, ELF_F_DIRTY),
+ _("cannot read section data: %s"));
+
if (skip_reloc
&& (shdr->sh_type == SHT_REL || shdr->sh_type == SHT_RELA))
continue;
placed[i] = true;
}
- } while (skip_reloc);
+ }
+ while (skip_reloc);
if (stripped_ehdr->e_phnum > 0)
ELF_CHECK (gelf_newphdr (unstripped, stripped_ehdr->e_phnum),
+2010-06-04 Roland McGrath <roland@redhat.com>
+
+ * run-unstrip-test.sh: Also test modifying the file in place.
+
2010-04-22 Roland McGrath <roland@redhat.com>
* addrcfi.c (handle_cfi): Fix function name in error message.
#! /bin/sh
-# Copyright (C) 2007 Red Hat, Inc.
+# Copyright (C) 2007-2010 Red Hat, Inc.
# This file is part of Red Hat elfutils.
#
# Red Hat elfutils is free software; you can redistribute it and/or modify
debugfile=${debugfile:-${stripped}.debug}
testfiles $original $stripped $debugfile
-tempfiles testfile.unstrip
+tempfiles testfile.unstrip testfile.inplace
# These are old reference output from run-test-strip6.sh, when
# strip left the .debug file with unchanged sh_size in
testrun ../src/unstrip -o testfile.unstrip $stripped $debugfile
testrun ../src/elfcmp --hash-inexact $original testfile.unstrip
+
+# Also test modifying the file in place.
+
+rm -f testfile.inplace
+cp $debugfile testfile.inplace
+chmod 644 testfile.inplace
+testrun ../src/unstrip $stripped testfile.inplace
+
+testrun ../src/elfcmp --hash-inexact $original testfile.inplace