diff options
author | Roland McGrath <[email protected]> | 2007-08-13 22:58:36 +0000 |
---|---|---|
committer | Roland McGrath <[email protected]> | 2007-08-13 22:58:36 +0000 |
commit | 099dd52727f2ce1a2c73cde82af8cd5e06368aec (patch) | |
tree | 65df96e401bdf9cc978a9ff655dd9819b9ac1f8b | |
parent | d82217264c4ac9108dbda1502a545ea25f6d22fe (diff) |
missed testdata files
-rw-r--r-- | libdwfl/ChangeLog | 12 | ||||
-rw-r--r-- | libdwfl/dwfl_module_addrsym.c | 3 | ||||
-rw-r--r-- | libdwfl/elf-from-memory.c | 8 | ||||
-rw-r--r-- | libdwfl/linux-kernel-modules.c | 4 | ||||
-rw-r--r-- | libelf/ChangeLog | 5 | ||||
-rw-r--r-- | libelf/elf32_updatefile.c | 17 | ||||
-rw-r--r-- | src/ChangeLog | 8 | ||||
-rw-r--r-- | src/elflint.c | 11 | ||||
-rw-r--r-- | tests/ChangeLog | 8 | ||||
-rw-r--r-- | tests/Makefile.am | 7 | ||||
-rwxr-xr-x | tests/run-strip-test7.sh | 5 | ||||
-rw-r--r-- | tests/testfile39.bz2 | bin | 0 -> 2992 bytes | |||
-rw-r--r-- | tests/testfile40.bz2 | bin | 0 -> 2302 bytes | |||
-rw-r--r-- | tests/testfile40.debug.bz2 | bin | 0 -> 1398 bytes |
14 files changed, 75 insertions, 13 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 38f86a7d..a5177aca 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,15 @@ +2007-08-13 Roland McGrath <[email protected]> + + * dwfl_module_addrsym.c: Add dead initializer for stupid compiler. + +2007-08-12 Roland McGrath <[email protected]> + + * 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 <[email protected]> * dwfl_module_addrsym.c: Don't use STT_SECTION, STT_FILE symbols and diff --git a/libdwfl/dwfl_module_addrsym.c b/libdwfl/dwfl_module_addrsym.c index 63eca774..52dbb3d8 100644 --- a/libdwfl/dwfl_module_addrsym.c +++ b/libdwfl/dwfl_module_addrsym.c @@ -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; diff --git a/libdwfl/elf-from-memory.c b/libdwfl/elf-from-memory.c index a292210a..c0e7c46d 100644 --- a/libdwfl/elf-from-memory.c +++ b/libdwfl/elf-from-memory.c @@ -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; } diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c index 98957521..26f185f3 100644 --- a/libdwfl/linux-kernel-modules.c +++ b/libdwfl/linux-kernel-modules.c @@ -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]); diff --git a/libelf/ChangeLog b/libelf/ChangeLog index 37b60730..a26728cd 100644 --- a/libelf/ChangeLog +++ b/libelf/ChangeLog @@ -1,3 +1,8 @@ +2007-08-12 Roland McGrath <[email protected]> + + * elf32_updatefile.c (compare_sections): Sort secondarily on sh_size, + and only tertiarily on index. + 2007-07-09 Roland McGrath <[email protected]> * elf.h: Update from glibc. diff --git a/libelf/elf32_updatefile.c b/libelf/elf32_updatefile.c index 68253651..e94de831 100644 --- a/libelf/elf32_updatefile.c +++ b/libelf/elf32_updatefile.c @@ -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 <[email protected]>, 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 diff --git a/src/ChangeLog b/src/ChangeLog index 3e708378..77c98381 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2007-08-12 Roland McGrath <[email protected]> + + * 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 <[email protected]> * elflint.c (check_note): Accept NT_GNU_HWCAP, NT_GNU_BUILD_ID. diff --git a/src/elflint.c b/src/elflint.c index e8787d01..37936b1f 100644 --- a/src/elflint.c +++ b/src/elflint.c @@ -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"), diff --git a/tests/ChangeLog b/tests/ChangeLog index 6ac60077..cc7e0727 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,11 @@ +2007-08-12 Roland McGrath <[email protected]> + + * 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 <[email protected]> * dwfl-bug-report.c: Fix header inclusion. diff --git a/tests/Makefile.am b/tests/Makefile.am index 040351f9..decefe77 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 00000000..c65cd050 --- /dev/null +++ b/tests/run-strip-test7.sh @@ -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 Binary files differnew file mode 100644 index 00000000..42d0fbce --- /dev/null +++ b/tests/testfile39.bz2 diff --git a/tests/testfile40.bz2 b/tests/testfile40.bz2 Binary files differnew file mode 100644 index 00000000..ad41985c --- /dev/null +++ b/tests/testfile40.bz2 diff --git a/tests/testfile40.debug.bz2 b/tests/testfile40.debug.bz2 Binary files differnew file mode 100644 index 00000000..2eec4d7a --- /dev/null +++ b/tests/testfile40.debug.bz2 |