From a7b828dfceceac825b4e1a2cc939739f5de5a577 Mon Sep 17 00:00:00 2001 From: roland Date: Sun, 11 Nov 2007 23:16:59 +0000 Subject: [PATCH] New upstream version 0.131 --- elfutils-0.130-fixes.patch | 352 ------------------------------------- elfutils-portability.patch | 27 +-- elfutils.spec | 16 +- 3 files changed, 24 insertions(+), 371 deletions(-) delete mode 100644 elfutils-0.130-fixes.patch diff --git a/elfutils-0.130-fixes.patch b/elfutils-0.130-fixes.patch deleted file mode 100644 index 072f8ee..0000000 --- a/elfutils-0.130-fixes.patch +++ /dev/null @@ -1,352 +0,0 @@ -libdwfl/ -2007-10-17 Roland McGrath - - * dwfl_module_getsym.c (dwfl_module_getsym): Apply MOD->symfile->bias - to relocated st_value. - - * dwfl_report_elf.c (__libdwfl_report_elf): Align initial BASE for - ET_REL to 0x100. - -2007-10-16 Roland McGrath - - * dwfl_report_elf.c (__libdwfl_report_elf): Readjust BASE when a later - section has larger alignment requirements not met by the original BASE, - rather than padding more between sections. - - * dwfl_report_elf.c (__libdwfl_report_elf): Fix bias calculation. - - * dwfl_module_build_id.c (__libdwfl_find_build_id): Apply module bias - to sh_addr value. - - * dwfl_report_elf.c (__libdwfl_report_elf): Don't be confused by BASE - at zero in ET_REL case. Adjust BASE to necessary alignment. - - * dwfl_module_build_id.c (check_notes): Take -1, not 0, as stub value - for DATA_VADDR. - (__libdwfl_find_build_id): Update caller. - - * relocate.c (__libdwfl_relocate_value): Don't use sh_offset. - * dwfl_report_elf.c (__libdwfl_report_elf): Likewise. - * offline.c (dwfl_offline_section_address): Bail early if there is - separate debug file. - - * relocate.c (__libdwfl_relocate): Don't return DWFL_E_NO_DWARF. - -src/ -2007-10-16 Roland McGrath - - * readelf.c (hex_dump): Fix rounding error in whitespace calculation. - -tests/ -2007-10-16 Roland McGrath - - * test-subr.sh (remove_files): Don't pass -Bb to diff. - -============================================================ ---- libdwfl/dwfl_module_build_id.c ae14fc9f3be468ffff14b4f6247ad38898705132 -+++ libdwfl/dwfl_module_build_id.c c67b9be68b69c98f6fd1024f521acdab0678ea02 -@@ -73,6 +73,8 @@ found_build_id (Dwfl_Module *mod, bool s - return len; - } - -+#define NO_VADDR ((GElf_Addr) -1l) -+ - static int - check_notes (Dwfl_Module *mod, bool set, Elf_Data *data, GElf_Addr data_vaddr) - { -@@ -86,7 +88,7 @@ check_notes (Dwfl_Module *mod, bool set, - "GNU", sizeof "GNU")) - return found_build_id (mod, set, - data->d_buf + desc_pos, nhdr.n_descsz, -- data_vaddr == 0 ? 0 : data_vaddr + pos); -+ data_vaddr == NO_VADDR ? 0 : data_vaddr + pos); - return 0; - } - -@@ -129,7 +131,7 @@ __libdwfl_find_build_id (Dwfl_Module *mo - if (likely (shdr != NULL) && shdr->sh_type == SHT_NOTE) - result = check_notes (mod, set, elf_getdata (scn, NULL), - (shdr->sh_flags & SHF_ALLOC) -- ? shdr->sh_addr : 0); -+ ? shdr->sh_addr + mod->main.bias : NO_VADDR); - } - while (result == 0 && (scn = elf_nextscn (elf, scn)) != NULL); - -============================================================ ---- libdwfl/dwfl_module_getsym.c 5596a4a3df363bb27759a0c26519b9818475aa80 -+++ libdwfl/dwfl_module_getsym.c c1a0448eecebc039393fb884ff7d0684d1d5001f -@@ -85,10 +85,7 @@ dwfl_module_getsym (Dwfl_Module *mod, in - break; - - default: -- if (mod->e_type != ET_REL) -- /* Apply the bias to the symbol value. */ -- sym->st_value += mod->symfile->bias; -- else -+ if (mod->e_type == ET_REL) - { - /* In an ET_REL file, the symbol table values are relative - to the section, not to the module's load base. */ -@@ -102,6 +99,8 @@ dwfl_module_getsym (Dwfl_Module *mod, in - return NULL; - } - } -+ /* Apply the bias to the symbol value. */ -+ sym->st_value += mod->symfile->bias; - break; - } - -============================================================ ---- libdwfl/dwfl_report_elf.c d9db919b103fc3411d240f3a096af5e57a3adce6 -+++ libdwfl/dwfl_report_elf.c ee4a17cd0e3bf27c306b484ab38c34a7de2b7c0e -@@ -51,6 +51,14 @@ - #include - #include - -+ -+/* We start every ET_REL module at a moderately aligned boundary. -+ This keeps the low addresses easy to read compared to a layout -+ starting at 0 (as when using -e). It also makes it unlikely -+ that a middle section will have a larger alignment and require -+ rejiggering (see below). */ -+#define REL_MIN_ALIGN ((GElf_Xword) 0x100) -+ - Dwfl_Module * - internal_function - __libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, -@@ -72,41 +80,91 @@ __libdwfl_report_elf (Dwfl *dwfl, const - By updating the section header in place, we leave the layout - information to be found by relocation. */ - -- start = end = base; -+ start = end = base = (base + REL_MIN_ALIGN - 1) & -REL_MIN_ALIGN; - -+ bool first = true; - Elf_Scn *scn = NULL; - while ((scn = elf_nextscn (elf, scn)) != NULL) - { - GElf_Shdr shdr_mem; - GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); -- if (shdr == NULL) -+ if (unlikely (shdr == NULL)) - goto elf_error; - - if (shdr->sh_flags & SHF_ALLOC) - { - const GElf_Xword align = shdr->sh_addralign ?: 1; -- if (shdr->sh_addr == 0 || (bias == 0 && end > start)) -+ const GElf_Addr next = (end + align - 1) & -align; -+ if (shdr->sh_addr == 0 -+ /* Once we've started doing layout we have to do it all, -+ unless we just layed out the first section at 0 when -+ it already was at 0. */ -+ || (bias == 0 && end > start && end != next)) - { -- shdr->sh_addr = (end + align - 1) & -align; -+ shdr->sh_addr = next; - if (end == base) - /* This is the first section assigned a location. - Use its aligned address as the module's base. */ -- start = shdr->sh_addr; -+ start = base = shdr->sh_addr; -+ else if (unlikely (base & (align - 1))) -+ { -+ /* If BASE has less than the maximum alignment of -+ any section, we eat more than the optimal amount -+ of padding and so make the module's apparent -+ size come out larger than it would when placed -+ at zero. So reset the layout with a better base. */ -+ -+ start = end = base = (base + align - 1) & -align; -+ Elf_Scn *prev_scn = NULL; -+ do -+ { -+ prev_scn = elf_nextscn (elf, prev_scn); -+ GElf_Shdr prev_shdr_mem; -+ GElf_Shdr *prev_shdr = gelf_getshdr (prev_scn, -+ &prev_shdr_mem); -+ if (unlikely (prev_shdr == NULL)) -+ goto elf_error; -+ if (prev_shdr->sh_flags & SHF_ALLOC) -+ { -+ const GElf_Xword prev_align -+ = prev_shdr->sh_addralign ?: 1; -+ -+ prev_shdr->sh_addr -+ = (end + prev_align - 1) & -prev_align; -+ end = prev_shdr->sh_addr + prev_shdr->sh_size; -+ -+ if (unlikely (! gelf_update_shdr (prev_scn, -+ prev_shdr))) -+ goto elf_error; -+ } -+ } -+ while (prev_scn != scn); -+ continue; -+ } -+ - end = shdr->sh_addr + shdr->sh_size; -- if (shdr->sh_addr == 0) -- /* This is a marker that this was resolved to zero, -- to prevent a callback. */ -- shdr->sh_offset = 0; -- if (! gelf_update_shdr (scn, shdr)) -+ if (likely (shdr->sh_addr != 0) -+ && unlikely (! gelf_update_shdr (scn, shdr))) - goto elf_error; - } - else - { -- if (bias == 0 || end < shdr->sh_addr + shdr->sh_size) -+ /* The address is already assigned. Just track it. */ -+ if (first || end < shdr->sh_addr + shdr->sh_size) - end = shdr->sh_addr + shdr->sh_size; -- if (bias == 0 || bias > shdr->sh_addr) -+ if (first || bias > shdr->sh_addr) -+ /* This is the lowest address in the module. */ - bias = shdr->sh_addr; -+ -+ if ((shdr->sh_addr - bias + base) & (align - 1)) -+ /* This section winds up misaligned using BASE. -+ Adjust BASE upwards to make it congruent to -+ the lowest section address in the file modulo ALIGN. */ -+ base = (((base + align - 1) & -align) -+ + (bias & (align - 1))); - } -+ -+ first = false; - } - } - -@@ -117,7 +175,7 @@ __libdwfl_report_elf (Dwfl *dwfl, const - Now just compute the bias from the requested base. */ - start = base; - end = end - bias + start; -- bias -= start; -+ bias = start - bias; - } - break; - -@@ -133,7 +191,7 @@ __libdwfl_report_elf (Dwfl *dwfl, const - for (uint_fast16_t i = 0; i < ehdr->e_phnum; ++i) - { - GElf_Phdr phdr_mem, *ph = gelf_getphdr (elf, i, &phdr_mem); -- if (ph == NULL) -+ if (unlikely (ph == NULL)) - goto elf_error; - if (ph->p_type == PT_LOAD) - { -@@ -148,7 +206,7 @@ __libdwfl_report_elf (Dwfl *dwfl, const - for (uint_fast16_t i = ehdr->e_phnum; i-- > 0;) - { - GElf_Phdr phdr_mem, *ph = gelf_getphdr (elf, i, &phdr_mem); -- if (ph == NULL) -+ if (unlikely (ph == NULL)) - goto elf_error; - if (ph->p_type == PT_LOAD) - { -============================================================ ---- libdwfl/offline.c 1508fb5c96e46f5bf3bbdaa0e18921243cf2ab8b -+++ libdwfl/offline.c d8dc43d35ecff3200099ec421a93cfadbd5a2e17 -@@ -53,8 +53,9 @@ - - /* Since dwfl_report_elf lays out the sections already, this will only be - called when the section headers of the debuginfo file are being -- consulted instead. With binutils strip-to-debug, the symbol table is in -- the debuginfo file and relocation looks there. */ -+ consulted instead, or for the section placed at 0. With binutils -+ strip-to-debug, the symbol table is in the debuginfo file and relocation -+ looks there. */ - int - dwfl_offline_section_address (Dwfl_Module *mod, - void **userdata __attribute__ ((unused)), -@@ -69,6 +70,11 @@ dwfl_offline_section_address (Dwfl_Modul - assert (shdr->sh_addr == 0); - assert (shdr->sh_flags & SHF_ALLOC); - -+ if (mod->debug.elf == NULL) -+ /* We are only here because sh_addr is zero even though layout is complete. -+ The first section in the first file under -e is placed at 0. */ -+ return 0; -+ - /* The section numbers might not match between the two files. - The best we can rely on is the order of SHF_ALLOC sections. */ - -============================================================ ---- libdwfl/relocate.c 5a08921fcd4b957b0d768e7a140eb5187dcaf69e -+++ libdwfl/relocate.c 51258c3bf6a18602dbd3fd2d8b721d4f7a9aef60 -@@ -64,9 +64,7 @@ __libdwfl_relocate_value (Dwfl_Module *m - if (refshdr == NULL) - return DWFL_E_LIBELF; - -- if (refshdr->sh_addr == 0 -- && (refshdr->sh_flags & SHF_ALLOC) -- && refshdr->sh_offset != 0) -+ if (refshdr->sh_addr == 0 && (refshdr->sh_flags & SHF_ALLOC)) - { - /* This is a loaded section. Find its actual - address and update the section header. */ -@@ -89,13 +87,11 @@ __libdwfl_relocate_value (Dwfl_Module *m - don't really care. */ - refshdr->sh_addr = 0; /* Make no adjustment below. */ - -- /* Mark it so we don't check it again for the next relocation. */ -- refshdr->sh_offset = 0; -- - /* Update the in-core file's section header to show the final - load address (or unloadedness). This serves as a cache, - so we won't get here again for the same section. */ -- if (unlikely (! gelf_update_shdr (refscn, refshdr))) -+ if (likely (refshdr->sh_addr != 0) -+ && unlikely (! gelf_update_shdr (refscn, refshdr))) - return DWFL_E_LIBELF; - } - -@@ -202,7 +198,7 @@ __libdwfl_relocate (Dwfl_Module *mod, El - - /* Look at each section in the debuginfo file, and process the - relocation sections for debugging sections. */ -- Dwfl_Error result = DWFL_E_NO_DWARF; -+ Dwfl_Error result = DWFL_E_NOERROR; - Elf_Scn *scn = NULL; - while ((scn = elf_nextscn (debugfile, scn)) != NULL) - { -@@ -369,7 +365,6 @@ __libdwfl_relocate (Dwfl_Module *mod, El - if (reldata == NULL) - return DWFL_E_LIBELF; - -- result = DWFL_E_NOERROR; - size_t nrels = shdr->sh_size / shdr->sh_entsize; - if (shdr->sh_type == SHT_REL) - for (size_t relidx = 0; !result && relidx < nrels; ++relidx) -============================================================ ---- src/readelf.c a0d9bd8c3fb36429895ee314dd3a874af3f8866e -+++ src/readelf.c 06970982eff8d85287725619dd9eefc51c1bf1c0 -@@ -5888,7 +5888,7 @@ hex_dump (const uint8_t *data, size_t le - printf ("%02x", data[pos + i]); - - if (chunk < 16) -- printf ("%*s", (int) ((16 - chunk) * 2 + (16 - chunk) / 4), ""); -+ printf ("%*s", (int) ((16 - chunk) * 2 + (16 - chunk + 3) / 4), ""); - - for (size_t i = 0; i < chunk; ++i) - { -============================================================ ---- tests/test-subr.sh 5ba4008367c39437a8e8d6ed0b6757d54bc10f4d -+++ tests/test-subr.sh ea1d0339bca3d875076ed15e114e9d47b2ea96e2 -@@ -1,5 +1,5 @@ - #! /bin/sh --# Copyright (C) 2005 Red Hat, Inc. -+# Copyright (C) 2005, 2007 Red Hat, Inc. - # This file is part of Red Hat elfutils. - # - # Red Hat elfutils is free software; you can redistribute it and/or modify -@@ -58,7 +58,7 @@ testrun_compare() - { - outfile="${1##*/}.out" - testrun_out $outfile "$@" -- diff -Bbu $outfile - -+ diff -u $outfile - - # diff's exit status will kill the script. - } - diff --git a/elfutils-portability.patch b/elfutils-portability.patch index 54de64d..737e099 100644 --- a/elfutils-portability.patch +++ b/elfutils-portability.patch @@ -1,6 +1,6 @@ --- elfutils/backends/ChangeLog +++ elfutils/backends/ChangeLog -@@ -229,6 +229,11 @@ +@@ -240,6 +240,11 @@ * sparc_init.c: Likewise. * x86_64_init.c: Likewise. @@ -12,7 +12,7 @@ 2005-11-19 Roland McGrath * ppc64_reloc.def: REL30 -> ADDR30. -@@ -251,6 +256,9 @@ +@@ -262,6 +267,9 @@ * Makefile.am (uninstall): Don't try to remove $(pkgincludedir). (CLEANFILES): Add libebl_$(m).so. @@ -479,7 +479,7 @@ libcpu_i386_a_SOURCES = i386_dis.c --- elfutils/libdw/ChangeLog +++ elfutils/libdw/ChangeLog -@@ -406,6 +406,11 @@ +@@ -425,6 +425,11 @@ 2005-05-31 Roland McGrath @@ -543,7 +543,7 @@ $(COMPILE))) --- elfutils/libdwfl/ChangeLog +++ elfutils/libdwfl/ChangeLog -@@ -647,6 +647,11 @@ +@@ -739,6 +739,11 @@ 2005-07-21 Roland McGrath @@ -604,7 +604,7 @@ --- elfutils/libebl/ChangeLog +++ elfutils/libebl/ChangeLog -@@ -501,6 +501,11 @@ +@@ -505,6 +505,11 @@ * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency tracking works right. @@ -665,7 +665,7 @@ --- elfutils/libelf/ChangeLog +++ elfutils/libelf/ChangeLog -@@ -295,6 +295,11 @@ +@@ -303,6 +303,11 @@ If section content hasn't been read yet, do it before looking for the block size. If no section data present, infer size of section header. @@ -797,15 +797,16 @@ YACC = @YACC@ --- elfutils/src/ChangeLog +++ elfutils/src/ChangeLog -@@ -1,3 +1,7 @@ -+2007-10-16 Roland McGrath -+ +@@ -30,6 +30,8 @@ + + * readelf.c (hex_dump): Fix rounding error in whitespace calculation. + + * Makefile.am (readelf_no_Werror): New variable. + 2007-10-15 Roland McGrath * make-debug-archive.in: New file. -@@ -437,6 +441,10 @@ +@@ -469,6 +471,10 @@ * elflint.c (valid_e_machine): Add EM_ALPHA. Reported by Christian Aichinger . @@ -816,7 +817,7 @@ 2006-08-08 Ulrich Drepper * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB. -@@ -513,6 +521,10 @@ +@@ -545,6 +551,10 @@ * Makefile.am: Add hacks to create dependency files for non-generic linker. @@ -827,7 +828,7 @@ 2006-06-12 Ulrich Drepper * ldgeneric.c (ld_generic_generate_sections): Don't create .interp -@@ -861,6 +873,11 @@ +@@ -893,6 +903,11 @@ * readelf.c (print_debug_loc_section): Fix indentation for larger address size. @@ -1008,7 +1009,7 @@ cannot set access and modification date of '%s'"), fname); --- elfutils/tests/ChangeLog +++ elfutils/tests/ChangeLog -@@ -585,6 +585,11 @@ +@@ -606,6 +606,11 @@ * Makefile.am (TESTS): Add run-elflint-test.sh. (EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2. diff --git a/elfutils.spec b/elfutils.spec index f3c00e9..08bd0e5 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,5 +1,5 @@ -%define eu_version 0.130 -%define eu_release 3 +%define eu_version 0.131 +%define eu_release 1 %if %{?_with_compat:1}%{!?_with_compat:0} %define compat 1 @@ -35,8 +35,6 @@ Patch0: elfutils-strip-copy-symtab.patch Source2: testfile16.symtab.bz2 Source3: testfile16.symtab.debug.bz2 -Patch3: elfutils-0.130-fixes.patch - BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: bison >= 1.875 @@ -156,8 +154,6 @@ find . \( -name configure -o -name config.h.in \) -print | xargs touch %patch2 -p1 -%patch3 -p0 - %build # Remove -Wall from default flags. The makefiles enable enough warnings # themselves, and they use -Werror. Appending -Wall defeats the cases where @@ -265,6 +261,14 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/libelf.a %changelog +* Sun Nov 11 2007 Roland McGrath - 0.131-1 +- Update to 0.131 + - libdw: DW_FORM_ref_addr support; dwarf_formref entry point now deprecated; + bug fixes for oddly-formatted DWARF + - libdwfl: bug fixes in offline archive support, symbol table handling; + apply partial relocations for dwfl_module_address_section on ET_REL + - libebl: powerpc backend support for Altivec registers + * Wed Oct 17 2007 Roland McGrath - 0.130-3 - Fix ET_REL support. - Fix odd indentation in eu-readelf -x output.