]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
missed testdata files
authorRoland McGrath <roland@redhat.com>
Mon, 13 Aug 2007 22:58:36 +0000 (22:58 +0000)
committerRoland McGrath <roland@redhat.com>
Mon, 13 Aug 2007 22:58:36 +0000 (22:58 +0000)
14 files changed:
libdwfl/ChangeLog
libdwfl/dwfl_module_addrsym.c
libdwfl/elf-from-memory.c
libdwfl/linux-kernel-modules.c
libelf/ChangeLog
libelf/elf32_updatefile.c
src/ChangeLog
src/elflint.c
tests/ChangeLog
tests/Makefile.am
tests/run-strip-test7.sh [new file with mode: 0755]
tests/testfile39.bz2 [new file with mode: 0644]
tests/testfile40.bz2 [new file with mode: 0644]
tests/testfile40.debug.bz2 [new file with mode: 0644]

index 38f86a7d5de1a9008874ec2b24f036e2312afdda..a5177aca5a3d70c6fa681f8518ade860e022f13f 100644 (file)
@@ -1,3 +1,15 @@
+2007-08-13  Roland McGrath  <roland@redhat.com>
+
+       * dwfl_module_addrsym.c: Add dead initializer for stupid compiler.
+
+2007-08-12  Roland McGrath  <roland@redhat.com>
+
+       * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Don't use
+       FTS_LOGICAL.
+
+       * elf-from-memory.c (elf_from_remote_memory): Don't reset LOADBASE on
+       a second phdr if it happens to match EHDR_VMA exactly.
+
 2007-08-08  Roland McGrath  <roland@redhat.com>
 
        * dwfl_module_addrsym.c: Don't use STT_SECTION, STT_FILE symbols and
index 63eca77457d03652df4cfc736c5792a2fc06ae28..52dbb3d88896b135ac2a93bf64cbfc56307d2562 100644 (file)
@@ -104,9 +104,8 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr,
 
   /* Keep track of an eligible symbol with st_size == 0 as a fallback.  */
   const char *sizeless_name = NULL;
-  GElf_Sym sizeless_sym;
+  GElf_Sym sizeless_sym = { 0, 0, 0, 0, 0, SHN_UNDEF };
   GElf_Word sizeless_shndx = SHN_UNDEF;
-  sizeless_sym.st_value = 0;
 
   /* Keep track of the lowest address a relevant sizeless symbol could have.  */
   GElf_Addr min_label = addr;
index a292210ae4c9a2d67d36a1b0aad3dc6b2bc5b0a9..c0e7c46d7769c6f78ecad46a8e94f17071645696 100644 (file)
@@ -213,6 +213,7 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
   size_t contents_size = 0;
   GElf_Off segments_end = 0;
   GElf_Addr loadbase = ehdr_vma;
+  bool found_base = false;
   switch (ehdr.e32.e_ident[EI_CLASS])
     {
       inline void handle_segment (GElf_Addr vaddr, GElf_Off offset,
@@ -223,8 +224,11 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
          if (segment_end > (GElf_Off) contents_size)
            contents_size = segment_end;
 
-         if ((offset & -align) == 0 && loadbase == ehdr_vma)
-           loadbase = ehdr_vma - (vaddr & -align);
+         if (!found_base && (offset & -align) == 0)
+           {
+             loadbase = ehdr_vma - (vaddr & -align);
+             found_base = true;
+           }
 
          segments_end = offset + filesz;
        }
index 98957521b4ca074af175609499fd7df751be49a0..26f185f325828cd4caa31932c83033019554e569 100644 (file)
@@ -215,7 +215,7 @@ dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release,
            return errno;
        }
 
-      FTS *fts = fts_open (modulesdir, FTS_LOGICAL | FTS_NOSTAT, NULL);
+      FTS *fts = fts_open (modulesdir, FTS_NOSTAT, NULL);
       if (modulesdir[0] == (char *) release)
        modulesdir[0] = NULL;
       if (fts == NULL)
@@ -403,7 +403,7 @@ dwfl_linux_kernel_find_elf (Dwfl_Module *mod __attribute__ ((unused)),
   if (asprintf (&modulesdir[0], MODULEDIRFMT, release) < 0)
     return -1;
 
-  FTS *fts = fts_open (modulesdir, FTS_LOGICAL | FTS_NOSTAT, NULL);
+  FTS *fts = fts_open (modulesdir, FTS_NOSTAT, NULL);
   if (fts == NULL)
     {
       free (modulesdir[0]);
index 37b60730f7512eeea785cdde3d7fe391cd325826..a26728cdff767172cc4bd34ef64737ed60576b71 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-12  Roland McGrath  <roland@redhat.com>
+
+       * elf32_updatefile.c (compare_sections): Sort secondarily on sh_size,
+       and only tertiarily on index.
+
 2007-07-09  Roland McGrath  <roland@redhat.com>
 
        * elf.h: Update from glibc.
index 682536515017aedfd6c74d5aaa492aade8f16fd5..e94de8318a560b01acd506c47c4d15a2ea991a8d 100644 (file)
@@ -1,5 +1,5 @@
 /* Write changed data structures.
-   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc.
+   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2000.
 
@@ -85,6 +85,14 @@ compare_sections (const void *a, const void *b)
       > (*scnb)->shdr.ELFW(e,LIBELFBITS)->sh_offset)
     return 1;
 
+  if ((*scna)->shdr.ELFW(e,LIBELFBITS)->sh_size
+      < (*scnb)->shdr.ELFW(e,LIBELFBITS)->sh_size)
+    return -1;
+
+  if ((*scna)->shdr.ELFW(e,LIBELFBITS)->sh_size
+      > (*scnb)->shdr.ELFW(e,LIBELFBITS)->sh_size)
+    return 1;
+
   if ((*scna)->index < (*scnb)->index)
     return -1;
 
@@ -97,7 +105,10 @@ compare_sections (const void *a, const void *b)
 
 /* Insert the sections in the list into the provided array and sort
    them according to their start offsets.  For sections with equal
-   start offsets the section index is used.  */
+   start offsets, the size is used; for sections with equal start
+   offsets and sizes, the section index is used.  Sorting by size
+   ensures that zero-length sections are processed first, which
+   is what we want since they do not advance our file writing position.  */
 static void
 sort_sections (Elf_Scn **scns, Elf_ScnList *list)
 {
@@ -684,7 +695,7 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf, int change_bo, size_t shnum)
                    sizeof (ElfW2(LIBELFBITS,Shdr)));
 
          shdr_flags |= scn->shdr_flags;
-         scn->shdr_flags  &= ~ELF_F_DIRTY;
+         scn->shdr_flags &= ~ELF_F_DIRTY;
        }
 
       /* Fill the gap between last section and section header table if
index 3e708378646e634300f7e64912638e0a9c2396e3..77c9838100e875faa06bb00ee8365aa11265f1a8 100644 (file)
@@ -1,3 +1,11 @@
+2007-08-12  Roland McGrath  <roland@redhat.com>
+
+       * elflint.c (check_note): Accept type 0 with name "Linux".
+
+       * elflint.c (special_sections): Accept SHF_ALLOC for ".note".
+
+       * elflint.c (section_flags_string): Return "none" for 0, not "".
+
 2007-08-11  Roland McGrath  <roland@redhat.com>
 
        * elflint.c (check_note): Accept NT_GNU_HWCAP, NT_GNU_BUILD_ID.
index e8787d0111f82a693e01103bf9c85ee6f0470325..37936b1f00d27320d0a881de9f1a7edc512168c5 100644 (file)
@@ -2461,6 +2461,9 @@ section [%2d] '%s' is contained in more than one section group\n"),
 static const char *
 section_flags_string (GElf_Word flags, char *buf, size_t len)
 {
+  if (flags == 0)
+    return "none";
+
   static const struct
   {
     GElf_Word flag;
@@ -3102,7 +3105,7 @@ static const struct
     { ".init_array", 12, SHT_INIT_ARRAY, exact, SHF_ALLOC | SHF_WRITE, 0 },
     { ".interp", 8, SHT_PROGBITS, atleast, 0, SHF_ALLOC }, // XXX more tests?
     { ".line", 6, SHT_PROGBITS, exact, 0, 0 },
-    { ".note", 6, SHT_NOTE, exact, 0, 0 },
+    { ".note", 6, SHT_NOTE, atleast, 0, SHF_ALLOC },
     { ".plt", 5, SHT_PROGBITS, unused, 0, 0 }, // XXX more tests
     { ".preinit_array", 15, SHT_PREINIT_ARRAY, exact, SHF_ALLOC | SHF_WRITE, 0 },
     { ".rela", 5, SHT_RELA, atleast, 0, SHF_ALLOC }, // XXX more tests
@@ -3700,6 +3703,12 @@ phdr[%d]: unknown core file note type %" PRIu64 " at offset %" PRIu64 "\n"),
            /* Known type.  */
            break;
 
+         case 0:
+           /* Linux vDSOs use a type 0 note for the kernel version word.  */
+           if (namesz == sizeof "Linux"
+               && !memcmp (notemem + idx + 3 * align, "Linux", sizeof "Linux"))
+             break;
+
          default:
            ERROR (gettext ("\
 phdr[%d]: unknown object file note type %" PRIu64 " at offset %" PRIu64 "\n"),
index 6ac600776b85986284214f12ab5e9cabea926ac2..cc7e0727995519f08be024e869232f4ff3357be9 100644 (file)
@@ -1,3 +1,11 @@
+2007-08-12  Roland McGrath  <roland@redhat.com>
+
+       * run-strip-test7.sh: New file.
+       * testfile39.bz2: New data file.
+       * testfile40.bz2: New data file.
+       * testfile40.debug.bz2: New data file.
+       * Makefile.am (TESTS, EXTRA_DIST): Add them.
+
 2007-08-09  Roland McGrath  <roland@redhat.com>
 
        * dwfl-bug-report.c: Fix header inclusion.
index 040351f914ccb213ab449dba6512a834c37f1093..decefe77e47f36a5a98dd3129a51ca4a7d5ef5ef 100644 (file)
@@ -71,7 +71,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
        run-show-abbrev.sh run-line2addr.sh hash \
        newscn run-strip-test.sh run-strip-test2.sh \
        run-strip-test3.sh run-strip-test4.sh run-strip-test5.sh \
-       run-strip-test6.sh run-unstrip-test.sh run-unstrip-test2.sh \
+       run-strip-test6.sh run-strip-test7.sh \
+       run-unstrip-test.sh run-unstrip-test2.sh \
        run-ecp-test.sh run-ecp-test2.sh \
        run-elflint-test.sh run-elflint-self.sh run-ranlib-test.sh \
        run-ranlib-test2.sh run-ranlib-test3.sh run-ranlib-test4.sh \
@@ -105,7 +106,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
             testfile13.bz2 run-strip-test3.sh run-allfcts.sh \
             run-line2addr.sh run-elflint-test.sh testfile14.bz2 \
             run-strip-test4.sh run-strip-test5.sh run-strip-test6.sh \
-            run-unstrip-test.sh run-unstrip-test2.sh \
+            run-strip-test7.sh run-unstrip-test.sh run-unstrip-test2.sh \
             run-elflint-self.sh run-ranlib-test.sh run-ranlib-test2.sh \
             run-ranlib-test3.sh run-ranlib-test4.sh \
             run-addrscopes.sh run-strings-test.sh run-funcscopes.sh \
@@ -126,7 +127,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
             testfile34.bz2 testfile35.bz2 testfile35.debug.bz2 \
             testfile36.bz2 testfile36.debug.bz2 \
             testfile37.bz2 testfile37.debug.bz2 \
-            testfile38.bz2
+            testfile38.bz2 testfile39.bz2 testfile40.bz2 testfile40.debug.bz2
 
 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir) \
                              bindir=$(DESTDIR)$(bindir) \
diff --git a/tests/run-strip-test7.sh b/tests/run-strip-test7.sh
new file mode 100755 (executable)
index 0000000..c65cd05
--- /dev/null
@@ -0,0 +1,5 @@
+original=testfile39
+stripped=testfile40
+debugfile=testfile40.debug
+
+. $srcdir/run-strip-test.sh
diff --git a/tests/testfile39.bz2 b/tests/testfile39.bz2
new file mode 100644 (file)
index 0000000..42d0fbc
Binary files /dev/null and b/tests/testfile39.bz2 differ
diff --git a/tests/testfile40.bz2 b/tests/testfile40.bz2
new file mode 100644 (file)
index 0000000..ad41985
Binary files /dev/null and b/tests/testfile40.bz2 differ
diff --git a/tests/testfile40.debug.bz2 b/tests/testfile40.debug.bz2
new file mode 100644 (file)
index 0000000..2eec4d7
Binary files /dev/null and b/tests/testfile40.debug.bz2 differ