diff --git a/build.diff b/build.diff new file mode 100644 index 0000000..ba0e745 --- /dev/null +++ b/build.diff @@ -0,0 +1,23 @@ +--- + libelf/Makefile.am | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +Index: b/libelf/Makefile.am +=================================================================== +--- a/libelf/Makefile.am ++++ b/libelf/Makefile.am +@@ -125,11 +125,12 @@ libelf.so: libelf_pic.a libelf.map + else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ + fi + +-install: install-am libelf.so ++install: install-am libelf.so libelf_pic.a + $(mkinstalldirs) $(DESTDIR)$(libdir) +- $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so ++ $(INSTALL) -m644 libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so + ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION) + ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so ++ $(INSTALL) -m644 libelf_pic.a $(DESTDIR)$(libdir)/libelf_pic.a + + uninstall: uninstall-am + rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so diff --git a/elfutils-0.137-dwarf-header-check-fix.diff b/elfutils-0.137-dwarf-header-check-fix.diff index 2176c53..14808a8 100644 --- a/elfutils-0.137-dwarf-header-check-fix.diff +++ b/elfutils-0.137-dwarf-header-check-fix.diff @@ -1,16 +1,4 @@ -From: Takashi Iwai -Subject: Fix for kernel debuginfo files -References: https://bugzilla.novell.com/show_bug.cgi?id=468247, comments 17-20 -References: https://bugzilla.novell.com/show_bug.cgi?id=433182 - -Above BZ originally occured with Systemtap testsuite (stmt_rel.exp). - -# stap -e 'probe kernel.statement("bio_put@fs/bio.c:*") {}' -semantic error: libdw failure (dwarf_getsrcfiles): invalid DWARF -... --- - - libdw/dwarf_getsrclines.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elfutils-0.142-no-osl.tar.bz2 b/elfutils-0.142-no-osl.tar.bz2 new file mode 100644 index 0000000..dd91fdd --- /dev/null +++ b/elfutils-0.142-no-osl.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:114accfbfb80a136b076554c586d75a153e54e187f81715740b0d8570b0fb74d +size 1512351 diff --git a/elfutils-0.147.tar.bz2 b/elfutils-0.147.tar.bz2 deleted file mode 100644 index 847ca01..0000000 --- a/elfutils-0.147.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c3dbcc2ac3d12a00f1d8fee4fa3fa8b61dfa7491d9e790e4b6a2af542d739848 -size 1777826 diff --git a/elfutils-0.97-ftruncate-mmap-fix.diff b/elfutils-0.97-ftruncate-mmap-fix.diff new file mode 100644 index 0000000..fdb34be --- /dev/null +++ b/elfutils-0.97-ftruncate-mmap-fix.diff @@ -0,0 +1,83 @@ +--- + libelf/elf_update.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 54 insertions(+) + +Index: b/libelf/elf_update.c +=================================================================== +--- a/libelf/elf_update.c ++++ b/libelf/elf_update.c +@@ -53,6 +53,7 @@ + #endif + + #include ++#include + #include + #include + #include +@@ -100,6 +101,33 @@ write_file (Elf *elf, off_t size, int ch + #endif + } + ++ /* ++ * We may have truncated the file so lets update the mapping before ++ * actually writing to the file. ++ */ ++ /* ++ else if (elf->map_address != NULL && elf->parent == NULL ++ && (elf->maximum_size != ~((size_t) 0) ++ && size != elf->maximum_size)) ++ { ++ void *new_address; ++ int ret; ++ fprintf(stderr, "sync old: %p\n", elf->map_address); ++ ret = msync(elf->map_address, elf->maximum_size, MS_SYNC); ++ if (ret) ++ perror("msync failed"); ++ new_address = mremap (elf->map_address, elf->maximum_size, ++ size, MREMAP_MAYMOVE); ++ if (unlikely (new_address == MAP_FAILED)) { ++ __libelf_seterrno (ELF_E_WRITE_ERROR); ++ return -1; ++ } ++ ++ fprintf(stderr, "old: %p, new: %p\n", elf->map_address, new_address); ++ elf->map_address = new_address; ++ } ++ */ ++ + if (elf->map_address != NULL) + { + /* The file is mmaped. */ +@@ -141,6 +169,32 @@ write_file (Elf *elf, off_t size, int ch + size = -1; + } + ++ if (elf->map_address != NULL && elf->parent == NULL ++ && (elf->maximum_size != ~((size_t) 0) ++ && (size > 0 && (size_t)size != elf->maximum_size))) ++ { ++ /* ++ * We may have truncated the file so lets update the mapping before ++ * actually writing to the file. ++ */ ++ void *new_address; ++ int ret; ++ ++ fprintf(stderr, "sync old: %p\n", elf->map_address); ++ ret = msync(elf->map_address, elf->maximum_size, MS_SYNC); ++ if (ret) ++ perror("msync failed"); ++ new_address = mremap (elf->map_address, elf->maximum_size, ++ size, MREMAP_MAYMOVE); ++ if (unlikely (new_address == MAP_FAILED)) { ++ __libelf_seterrno (ELF_E_WRITE_ERROR); ++ return -1; ++ } ++ ++ fprintf(stderr, "old: %p, new: %p\n", elf->map_address, new_address); ++ elf->map_address = new_address; ++ } ++ + if (size != -1 && elf->parent == NULL) + elf->maximum_size = size; + diff --git a/elfutils-no-po-test-build.diff b/elfutils-no-po-test-build.diff index 60714f5..dd3b5e1 100644 --- a/elfutils-no-po-test-build.diff +++ b/elfutils-no-po-test-build.diff @@ -1,9 +1,5 @@ -From: unknown -Upstream: no -Subject: do not build po and tests components - ---- elfutils/Makefile.am-dist 2007-07-04 12:05:20.000000000 +0200 -+++ elfutils/Makefile.am 2007-07-04 12:05:25.000000000 +0200 +--- Makefile.am-dist 2007-07-04 12:05:20.000000000 +0200 ++++ Makefile.am 2007-07-04 12:05:25.000000000 +0200 @@ -29,7 +29,7 @@ # Add doc back when we have some real content. diff --git a/elfutils-old-scanf-fix.diff b/elfutils-old-scanf-fix.diff new file mode 100644 index 0000000..d186b00 --- /dev/null +++ b/elfutils-old-scanf-fix.diff @@ -0,0 +1,27 @@ +Index: src/addr2line.c +=================================================================== +--- src/addr2line.c.orig 2009-04-21 16:50:01.000000000 +0200 ++++ src/addr2line.c 2009-08-20 13:11:58.000000000 +0200 +@@ -446,11 +446,11 @@ handle_address (const char *string, Dwfl + { + bool parsed = false; + int n; +- char *name = NULL; +- if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &n) == 2 ++ char name[4096]; /* FIXME */ ++ if (sscanf (string, "(%[^)])%" PRIiMAX "%n", name, &addr, &n) == 2 + && string[n] == '\0') + parsed = adjust_to_section (name, &addr, dwfl); +- else if (sscanf (string, "%m[^-+]%" PRIiMAX "%n", &name, &addr, &n) == 2 ++ else if (sscanf (string, "%[^-+]%" PRIiMAX "%n", &name, &addr, &n) == 2 + && string[n] == '\0') + { + /* It was symbol+offset. */ +@@ -471,7 +471,6 @@ handle_address (const char *string, Dwfl + } + } + +- free (name); + if (!parsed) + return 1; + } diff --git a/elfutils-portability.patch b/elfutils-portability.patch index a1d758a..71a1bf0 100644 --- a/elfutils-portability.patch +++ b/elfutils-portability.patch @@ -1,23 +1,53 @@ -From: Tony Jones -Subject: Elfutils portability patch -Version: 0.147 -References: https://fedorahosted.org/releases/e/l/elfutils/elfutils-portability.patch -Upstream: yes +--- + ChangeLog | 17 +++++++++++++++++ + Makefile.in | 2 ++ + backends/ChangeLog | 12 ++++++++++++ + backends/Makefile.am | 6 ++++-- + backends/Makefile.in | 8 +++++--- + config.h.in | 6 ++++++ + config/Makefile.in | 2 ++ + configure.ac | 38 +++++++++++++++++++++++++++++++++++++- + lib/ChangeLog | 8 ++++++++ + lib/Makefile.am | 3 ++- + lib/Makefile.in | 6 ++++-- + lib/eu-config.h | 11 +++++++++++ + libasm/ChangeLog | 5 +++++ + libasm/Makefile.am | 3 ++- + libasm/Makefile.in | 6 ++++-- + libcpu/ChangeLog | 8 ++++++++ + libcpu/Makefile.am | 3 ++- + libcpu/Makefile.in | 11 +++++++---- + libcpu/i386_disasm.c | 1 + + libdw/ChangeLog | 5 +++++ + libdw/Makefile.am | 3 ++- + libdw/Makefile.in | 7 +++++-- + libdwfl/ChangeLog | 5 +++++ + libdwfl/Makefile.am | 3 ++- + libdwfl/Makefile.in | 6 ++++-- + libebl/ChangeLog | 5 +++++ + libebl/Makefile.am | 3 ++- + libebl/Makefile.in | 6 ++++-- + libelf/ChangeLog | 5 +++++ + libelf/Makefile.am | 3 ++- + libelf/Makefile.in | 6 ++++-- + libelf/common.h | 4 ++-- + m4/Makefile.in | 2 ++ + src/ChangeLog | 20 ++++++++++++++++++++ + src/Makefile.am | 6 +++++- + src/Makefile.in | 9 +++++++-- + src/findtextrel.c | 6 +++++- + src/readelf.c | 2 +- + src/strings.c | 9 +++++++++ + src/strip.c | 20 ++++++++++++++++++-- + tests/ChangeLog | 7 +++++++ + tests/Makefile.am | 5 +++-- + tests/Makefile.in | 6 ++++-- + tests/line2addr.c | 2 +- + 44 files changed, 268 insertions(+), 43 deletions(-) -This patch contains portability fixes that are regarded as generally useful -by the community but are not accepted by the elfutils maintainer (and are -therefore not in the git repository). - - -Following change is removed from the patch (as Factory is built using -GNU_SOURCE and thus %a is interpreted as having a float param): - -+ * addr2line.c (handle_address): Use %a instead of %m for compatibility. -+ - ---- elfutils/backends/ChangeLog -+++ elfutils/backends/ChangeLog -@@ -106,6 +106,10 @@ +--- a/backends/ChangeLog ++++ b/backends/ChangeLog +@@ -48,6 +48,10 @@ * ppc_attrs.c (ppc_check_object_attribute): Handle tag GNU_Power_ABI_Struct_Return. @@ -28,7 +58,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2008-10-04 Ulrich Drepper * i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and -@@ -433,6 +437,11 @@ +@@ -375,6 +379,11 @@ * sparc_init.c: Likewise. * x86_64_init.c: Likewise. @@ -40,7 +70,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2005-11-19 Roland McGrath * ppc64_reloc.def: REL30 -> ADDR30. -@@ -455,6 +464,9 @@ +@@ -397,6 +406,9 @@ * Makefile.am (uninstall): Don't try to remove $(pkgincludedir). (CLEANFILES): Add libebl_$(m).so. @@ -50,20 +80,36 @@ GNU_SOURCE and thus %a is interpreted as having a float param): * ppc_reloc.def: Update bits per Alan Modra . * ppc64_reloc.def: Likewise. ---- elfutils/backends/Makefile.am -+++ elfutils/backends/Makefile.am -@@ -103,7 +103,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a - $(LINK) -shared -o $(@:.map=.so) \ - -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \ - -Wl,--version-script,$(@:.so=.map) \ +--- a/backends/Makefile.am ++++ b/backends/Makefile.am +@@ -25,12 +25,14 @@ + ## . + ## + DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DOBJDIR=\"$(shell pwd)\" ++WEXTRA = @WEXTRA@ ++LD_AS_NEEDED = @LD_AS_NEEDED@ + if MUDFLAP + AM_CFLAGS = -fmudflap + else + AM_CFLAGS = + endif +-AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 \ ++AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused $(WEXTRA) -Wformat=2 \ + -std=gnu99 + INCLUDES = -I$(srcdir) -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ + -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ +@@ -115,7 +117,7 @@ + $(LINK) -shared -o $@ -Wl,--whole-archive,$<\ + $(cpu_$(@:libebl_%.so=%)) -Wl,--no-whole-archive \ + -Wl,--version-script,$(word 2,$^) \ - -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap) + -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap) $(textrel_check) - libebl_i386.so: $(cpu_i386) ---- elfutils/backends/Makefile.in -+++ elfutils/backends/Makefile.in -@@ -165,6 +165,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ + # XXX Should not be needed... +--- a/backends/Makefile.in ++++ b/backends/Makefile.in +@@ -159,6 +159,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -71,57 +117,38 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -193,6 +194,7 @@ SHELL = @SHELL@ +@@ -188,6 +189,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -@@ -256,7 +258,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi - -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw - AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ - $($(*F)_no_Werror),,-Werror) $(if \ -- $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -+ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ - $(am__append_1) - @MUDFLAP_FALSE@libmudflap = -@@ -697,7 +699,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a - $(LINK) -shared -o $(@:.map=.so) \ - -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \ - -Wl,--version-script,$(@:.so=.map) \ + YACC = @YACC@ +@@ -245,9 +247,9 @@ + top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ + @MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ +-@MUDFLAP_FALSE@ -Wextra -Wformat=2 -std=gnu99 ++@MUDFLAP_FALSE@ $(WEXTRA) -Wformat=2 -std=gnu99 + @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -fpic -Wall -Wshadow -Werror \ +-@MUDFLAP_TRUE@ -Wunused -Wextra -Wformat=2 -std=gnu99 ++@MUDFLAP_TRUE@ -Wunused $(WEXTRA) -Wformat=2 -std=gnu99 + INCLUDES = -I$(srcdir) -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \ + -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ + -I$(top_srcdir)/lib -I.. +@@ -652,7 +654,7 @@ + $(LINK) -shared -o $@ -Wl,--whole-archive,$<\ + $(cpu_$(@:libebl_%.so=%)) -Wl,--no-whole-archive \ + -Wl,--version-script,$(word 2,$^) \ - -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap) + -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap) $(textrel_check) - libebl_i386.so: $(cpu_i386) ---- elfutils/ChangeLog -+++ elfutils/ChangeLog -@@ -2,6 +2,10 @@ - - * configure.ac (LOCALEDIR, DATADIRNAME): Removed. - -+2009-11-22 Roland McGrath -+ -+ * configure.ac: Use sed and expr instead of modern bash extensions. -+ - 2009-09-21 Ulrich Drepper - - * configure.ac: Update for more modern autoconf. -@@ -10,6 +14,10 @@ - - * configure.ac (zip_LIBS): Check for liblzma too. - -+2009-08-17 Roland McGrath -+ -+ * configure.ac: Check for -fgnu89-inline; add it to WEXTRA if it works. -+ - 2009-04-19 Roland McGrath - - * configure.ac (eu_version): Round down here, not in version.h macros. -@@ -21,6 +29,8 @@ + # XXX Should not be needed... +--- a/ChangeLog ++++ b/ChangeLog +@@ -9,6 +9,8 @@ 2009-01-23 Roland McGrath @@ -130,7 +157,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): * configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3. * configure.ac (__thread check): Use AC_LINK_IFELSE, in case of -@@ -101,6 +111,10 @@ +@@ -89,6 +91,10 @@ * configure.ac: Add dummy automake conditional to get dependencies for non-generic linker right. See src/Makefile.am. @@ -141,7 +168,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2005-11-18 Roland McGrath * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable. -@@ -148,6 +162,17 @@ +@@ -136,6 +142,17 @@ * Makefile.am (all_SUBDIRS): Add libdwfl. * configure.ac: Write libdwfl/Makefile. @@ -159,27 +186,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2005-05-19 Roland McGrath * configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros. ---- elfutils/config/eu.am -+++ elfutils/config/eu.am -@@ -25,11 +25,14 @@ - ## . - ## - -+WEXTRA = @WEXTRA@ -+LD_AS_NEEDED = @LD_AS_NEEDED@ -+ - DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"' - INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. - AM_CFLAGS = -std=gnu99 -Wall -Wshadow \ - $(if $($(*F)_no_Werror),,-Werror) \ -- $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ -+ $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \ - $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \ - $($(*F)_CFLAGS) - ---- elfutils/config/Makefile.in -+++ elfutils/config/Makefile.in -@@ -76,6 +76,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +--- a/config/Makefile.in ++++ b/config/Makefile.in +@@ -73,6 +73,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -187,16 +196,16 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -104,6 +105,7 @@ SHELL = @SHELL@ +@@ -102,6 +103,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ ---- elfutils/config.h.in -+++ elfutils/config.h.in + YACC = @YACC@ +--- a/config.h.in ++++ b/config.h.in @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ @@ -214,265 +223,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): +#undef __thread + #include ---- elfutils/configure -+++ elfutils/configure -@@ -646,6 +646,8 @@ NEVER_TRUE - base_cpu - NATIVE_LD_FALSE - NATIVE_LD_TRUE -+LD_AS_NEEDED -+WEXTRA - LEXLIB - LEX_OUTPUT_ROOT - LEX -@@ -4098,6 +4100,205 @@ $as_echo "$as_me: error: gcc with C99 su - fi - - -+{ $as_echo "$as_me:$LINENO: checking for -Wextra option to $CC" >&5 -+$as_echo_n "checking for -Wextra option to $CC... " >&6; } -+if test "${ac_cv_cc_wextra+set}" = set; then -+ $as_echo_n "(cached) " >&6 -+else -+ old_CFLAGS="$CFLAGS" -+CFLAGS="$CFLAGS -Wextra" -+cat >conftest.$ac_ext <<_ACEOF -+void foo (void) { } -+_ACEOF -+rm -f conftest.$ac_objext -+if { (ac_try="$ac_compile" -+case "(($ac_try" in -+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; -+ *) ac_try_echo=$ac_try;; -+esac -+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -+$as_echo "$ac_try_echo") >&5 -+ (eval "$ac_compile") 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { -+ test -z "$ac_c_werror_flag" || -+ test ! -s conftest.err -+ } && test -s conftest.$ac_objext; then -+ ac_cv_cc_wextra=yes -+else -+ $as_echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ ac_cv_cc_wextra=no -+fi -+ -+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+CFLAGS="$old_CFLAGS" -+fi -+{ $as_echo "$as_me:$LINENO: result: $ac_cv_cc_wextra" >&5 -+$as_echo "$ac_cv_cc_wextra" >&6; } -+ -+if test "x$ac_cv_cc_wextra" = xyes; then -+ WEXTRA=-Wextra -+else -+ WEXTRA=-W -+fi -+ -+ -+{ $as_echo "$as_me:$LINENO: checking for -fgnu89-inline option to $CC" >&5 -+$as_echo_n "checking for -fgnu89-inline option to $CC... " >&6; } -+if test "${ac_cv_cc_gnu89_inline+set}" = set; then -+ $as_echo_n "(cached) " >&6 -+else -+ old_CFLAGS="$CFLAGS" -+CFLAGS="$CFLAGS -fgnu89-inline -Werror" -+cat >conftest.$ac_ext <<_ACEOF -+ -+void foo (void) -+{ -+ inline void bar (void) {} -+ bar (); -+} -+extern inline void baz (void) {} -+ -+_ACEOF -+rm -f conftest.$ac_objext -+if { (ac_try="$ac_compile" -+case "(($ac_try" in -+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; -+ *) ac_try_echo=$ac_try;; -+esac -+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -+$as_echo "$ac_try_echo") >&5 -+ (eval "$ac_compile") 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { -+ test -z "$ac_c_werror_flag" || -+ test ! -s conftest.err -+ } && test -s conftest.$ac_objext; then -+ ac_cv_cc_gnu89_inline=yes -+else -+ $as_echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ ac_cv_cc_gnu89_inline=no -+fi -+ -+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -+CFLAGS="$old_CFLAGS" -+fi -+{ $as_echo "$as_me:$LINENO: result: $ac_cv_cc_gnu89_inline" >&5 -+$as_echo "$ac_cv_cc_gnu89_inline" >&6; } -+if test "x$ac_cv_cc_gnu89_inline" = xyes; then -+ WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline" -+fi -+ -+ -+{ $as_echo "$as_me:$LINENO: checking for --as-needed linker option" >&5 -+$as_echo_n "checking for --as-needed linker option... " >&6; } -+if test "${ac_cv_as_needed+set}" = set; then -+ $as_echo_n "(cached) " >&6 -+else -+ cat > conftest.c <&5 -+ (eval $ac_try) 2>&5 -+ ac_status=$? -+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); }; } -+then -+ ac_cv_as_needed=yes -+else -+ ac_cv_as_needed=no -+fi -+rm -f conftest* -+fi -+{ $as_echo "$as_me:$LINENO: result: $ac_cv_as_needed" >&5 -+$as_echo "$ac_cv_as_needed" >&6; } -+if test "x$ac_cv_as_needed" = xyes; then -+ LD_AS_NEEDED=-Wl,--as-needed -+else -+ LD_AS_NEEDED= -+fi -+ -+ -+ -+{ $as_echo "$as_me:$LINENO: checking for __builtin_popcount" >&5 -+$as_echo_n "checking for __builtin_popcount... " >&6; } -+if test "${ac_cv_popcount+set}" = set; then -+ $as_echo_n "(cached) " >&6 -+else -+ cat >conftest.$ac_ext <<_ACEOF -+/* confdefs.h. */ -+_ACEOF -+cat confdefs.h >>conftest.$ac_ext -+cat >>conftest.$ac_ext <<_ACEOF -+/* end confdefs.h. */ -+ -+int -+main () -+{ -+exit (__builtin_popcount (127)); -+ ; -+ return 0; -+} -+_ACEOF -+rm -f conftest.$ac_objext conftest$ac_exeext -+if { (ac_try="$ac_link" -+case "(($ac_try" in -+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; -+ *) ac_try_echo=$ac_try;; -+esac -+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -+$as_echo "$ac_try_echo") >&5 -+ (eval "$ac_link") 2>conftest.er1 -+ ac_status=$? -+ grep -v '^ *+' conftest.er1 >conftest.err -+ rm -f conftest.er1 -+ cat conftest.err >&5 -+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 -+ (exit $ac_status); } && { -+ test -z "$ac_c_werror_flag" || -+ test ! -s conftest.err -+ } && test -s conftest$ac_exeext && { -+ test "$cross_compiling" = yes || -+ $as_test_x conftest$ac_exeext -+ }; then -+ ac_cv_popcount=yes -+else -+ $as_echo "$as_me: failed program was:" >&5 -+sed 's/^/| /' conftest.$ac_ext >&5 -+ -+ ac_cv_popcount=no -+fi -+ -+rm -rf conftest.dSYM -+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ -+ conftest$ac_exeext conftest.$ac_ext -+fi -+{ $as_echo "$as_me:$LINENO: result: $ac_cv_popcount" >&5 -+$as_echo "$ac_cv_popcount" >&6; } -+if test "x$ac_cv_popcount" = xyes; then -+ -+cat >>confdefs.h <<\_ACEOF -+#define HAVE_BUILTIN_POPCOUNT 1 -+_ACEOF -+ -+fi -+ -+ - { $as_echo "$as_me:$LINENO: checking for __thread support" >&5 - $as_echo_n "checking for __thread support... " >&6; } - if test "${ac_cv_tls+set}" = set; then -@@ -4163,9 +4364,18 @@ fi - { $as_echo "$as_me:$LINENO: result: $ac_cv_tls" >&5 - $as_echo "$ac_cv_tls" >&6; } - if test "x$ac_cv_tls" != xyes; then -- { { $as_echo "$as_me:$LINENO: error: __thread support required" >&5 --$as_echo "$as_me: error: __thread support required" >&2;} -+ if test "$use_locks" = yes; then -+ { { $as_echo "$as_me:$LINENO: error: --enable-thread-safety requires __thread support" >&5 -+$as_echo "$as_me: error: --enable-thread-safety requires __thread support" >&2;} - { (exit 1); exit 1; }; } -+else -+ -+cat >>confdefs.h <<\_ACEOF -+#define __thread /* empty: no multi-thread support */ -+_ACEOF -+ -+fi -+ - fi - - -@@ -5454,7 +5664,7 @@ ac_config_files="$ac_config_files versio - - # 1.234 -> 1234 - case "$PACKAGE_VERSION" in --[0-9].*) eu_version="${PACKAGE_VERSION/./}" ;; -+[0-9].*) eu_version=`echo "$PACKAGE_VERSION" | sed 's@\.@@'` ;; - *) { { $as_echo "$as_me:$LINENO: error: confused by version number '$PACKAGE_VERSION'" >&5 - $as_echo "$as_me: error: confused by version number '$PACKAGE_VERSION'" >&2;} - { (exit 1); exit 1; }; } ;; -@@ -5489,7 +5699,7 @@ $as_echo "$as_me: error: confused by ver - esac - - # Round up to the next release API (x.y) version. --eu_version=$[($eu_version + 999) / 1000] -+eu_version=`expr \( $eu_version + 999 \) / 1000` - - cat >confcache <<\_ACEOF - # This file is a shell script that caches the results of configure ---- elfutils/configure.ac -+++ elfutils/configure.ac -@@ -73,6 +73,54 @@ CFLAGS="$old_CFLAGS"]) +--- a/configure.ac ++++ b/configure.ac +@@ -74,6 +74,39 @@ AS_IF([test "x$ac_cv_c99" != xyes], AC_MSG_ERROR([gcc with C99 support required])) @@ -485,21 +238,6 @@ GNU_SOURCE and thus %a is interpreted as having a float param): +AC_SUBST(WEXTRA) +AS_IF([test "x$ac_cv_cc_wextra" = xyes], [WEXTRA=-Wextra], [WEXTRA=-W]) + -+AC_CACHE_CHECK([for -fgnu89-inline option to $CC], ac_cv_cc_gnu89_inline, [dnl -+old_CFLAGS="$CFLAGS" -+CFLAGS="$CFLAGS -fgnu89-inline -Werror" -+AC_COMPILE_IFELSE([ -+void foo (void) -+{ -+ inline void bar (void) {} -+ bar (); -+} -+extern inline void baz (void) {} -+], ac_cv_cc_gnu89_inline=yes, ac_cv_cc_gnu89_inline=no) -+CFLAGS="$old_CFLAGS"]) -+AS_IF([test "x$ac_cv_cc_gnu89_inline" = xyes], -+ [WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"]) -+ +AC_CACHE_CHECK([for --as-needed linker option], + ac_cv_as_needed, [dnl +cat > conftest.c < -> 1234 - case "$PACKAGE_VERSION" in --[[0-9]].*) eu_version="${PACKAGE_VERSION/./}" ;; -+[[0-9]].*) eu_version=`echo "$PACKAGE_VERSION" | sed 's@\.@@'` ;; - *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; - esac - case "$eu_version" in -@@ -280,6 +331,6 @@ case "$eu_version" in - esac - - # Round up to the next release API (x.y) version. --[eu_version=$[($eu_version + 999) / 1000]] -+eu_version=`expr \( $eu_version + 999 \) / 1000` - - AC_OUTPUT ---- elfutils/lib/ChangeLog -+++ elfutils/lib/ChangeLog -@@ -8,6 +8,9 @@ - + LOCALEDIR=$datadir + AC_SUBST(LOCALEDIR) +--- a/lib/ChangeLog ++++ b/lib/ChangeLog +@@ -1,5 +1,8 @@ 2009-01-23 Roland McGrath + * eu-config.h [! HAVE_BUILTIN_POPCOUNT] @@ -568,7 +288,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): * eu-config.h: Add multiple inclusion protection. 2009-01-17 Ulrich Drepper -@@ -64,6 +67,11 @@ +@@ -56,6 +59,11 @@ * Makefile.am (libeu_a_SOURCES): Add it. * system.h: Declare crc32_file. @@ -580,9 +300,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2005-04-30 Ulrich Drepper * Makefile.am: Use -ffunction-sections for xmalloc.c. ---- elfutils/lib/eu-config.h -+++ elfutils/lib/eu-config.h -@@ -182,6 +182,17 @@ asm (".section predict_data, \"aw\"; .pr +--- a/lib/eu-config.h ++++ b/lib/eu-config.h +@@ -182,5 +182,16 @@ /* This macro is used by the tests conditionalize for standalone building. */ #define ELFUTILS_HEADER(name) @@ -598,11 +318,27 @@ GNU_SOURCE and thus %a is interpreted as having a float param): +#endif /* HAVE_BUILTIN_POPCOUNT */ + - #ifdef SHARED - # define OLD_VERSION(name, version) \ ---- elfutils/lib/Makefile.in -+++ elfutils/lib/Makefile.in -@@ -99,6 +99,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ + #endif /* eu-config.h */ +--- a/lib/Makefile.am ++++ b/lib/Makefile.am +@@ -25,12 +25,13 @@ + ## . + ## + DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H ++WEXTRA = @WEXTRA@ + if MUDFLAP + AM_CFLAGS = -fmudflap + else + AM_CFLAGS = + endif +-AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra $($(*F)_CFLAGS) ++AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused $(WEXTRA) $($(*F)_CFLAGS) + INCLUDES = -I$(srcdir)/../libelf -I.. + + noinst_LIBRARIES = libeu.a +--- a/lib/Makefile.in ++++ b/lib/Makefile.in +@@ -94,6 +94,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -610,26 +346,29 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -127,6 +128,7 @@ SHELL = @SHELL@ +@@ -123,6 +124,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -@@ -189,7 +191,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi - -I$(srcdir)/../libelf - AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ - $($(*F)_no_Werror),,-Werror) $(if \ -- $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -+ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ - $(am__append_1) -fpic - @MUDFLAP_FALSE@libmudflap = ---- elfutils/libasm/ChangeLog -+++ elfutils/libasm/ChangeLog -@@ -67,6 +67,11 @@ + YACC = @YACC@ +@@ -180,9 +182,9 @@ + top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ + @MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ +-@MUDFLAP_FALSE@ -Wextra $($(*F)_CFLAGS) ++@MUDFLAP_FALSE@ $(WEXTRA) $($(*F)_CFLAGS) + @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -fpic -Wall -Wshadow -Werror \ +-@MUDFLAP_TRUE@ -Wunused -Wextra $($(*F)_CFLAGS) ++@MUDFLAP_TRUE@ -Wunused $(WEXTRA) $($(*F)_CFLAGS) + INCLUDES = -I$(srcdir)/../libelf -I.. + noinst_LIBRARIES = libeu.a + libeu_a_SOURCES = xstrndup.c xmalloc.c next_prime.c \ +--- a/libasm/ChangeLog ++++ b/libasm/ChangeLog +@@ -63,6 +63,11 @@ * asm_error.c: Add new error ASM_E_IOERROR. * libasmP.h: Add ASM_E_IOERROR definition. @@ -641,9 +380,26 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2005-02-15 Ulrich Drepper * Makefile.am (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2. ---- elfutils/libasm/Makefile.in -+++ elfutils/libasm/Makefile.in -@@ -147,6 +147,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +--- a/libasm/Makefile.am ++++ b/libasm/Makefile.am +@@ -25,12 +25,13 @@ + ## . + ## + DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H ++WEXTRA = @WEXTRA@ + if MUDFLAP + AM_CFLAGS = -fmudflap + else + AM_CFLAGS = + endif +-AM_CFLAGS += -std=gnu99 -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 ++AM_CFLAGS += -std=gnu99 -Wall -Wshadow -Werror -Wunused $(WEXTRA) -Wformat=2 + INCLUDES = -I. -I$(srcdir) -I.. \ + -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl -I$(top_srcdir)/libdw\ + -I$(top_srcdir)/lib +--- a/libasm/Makefile.in ++++ b/libasm/Makefile.in +@@ -128,6 +128,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -651,26 +407,29 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -175,6 +176,7 @@ SHELL = @SHELL@ +@@ -157,6 +158,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -@@ -238,7 +240,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi - -I$(top_srcdir)/libdw - AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ - $($(*F)_no_Werror),,-Werror) $(if \ -- $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -+ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ - $(am__append_1) - @MUDFLAP_FALSE@libmudflap = ---- elfutils/libcpu/ChangeLog -+++ elfutils/libcpu/ChangeLog -@@ -9,6 +9,9 @@ + YACC = @YACC@ +@@ -214,9 +216,9 @@ + top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ + @MUDFLAP_FALSE@AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Werror -Wunused \ +-@MUDFLAP_FALSE@ -Wextra -Wformat=2 ++@MUDFLAP_FALSE@ $(WEXTRA) -Wformat=2 + @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -std=gnu99 -Wall -Wshadow -Werror \ +-@MUDFLAP_TRUE@ -Wunused -Wextra -Wformat=2 ++@MUDFLAP_TRUE@ -Wunused $(WEXTRA) -Wformat=2 + INCLUDES = -I. -I$(srcdir) -I.. \ + -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl -I$(top_srcdir)/libdw\ + -I$(top_srcdir)/lib +--- a/libcpu/ChangeLog ++++ b/libcpu/ChangeLog +@@ -5,6 +5,9 @@ 2009-01-23 Roland McGrath @@ -680,7 +439,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): * Makefile.am (i386_parse_CFLAGS): Use quotes around command substitution that can produce leading whitespace. -@@ -338,6 +341,11 @@ +@@ -334,6 +337,11 @@ * defs/i386.doc: New file. * defs/x86_64: New file. @@ -692,9 +451,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2005-02-15 Ulrich Drepper * Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2. ---- elfutils/libcpu/i386_disasm.c -+++ elfutils/libcpu/i386_disasm.c -@@ -791,6 +791,7 @@ i386_disasm (const uint8_t **startp, con +--- a/libcpu/i386_disasm.c ++++ b/libcpu/i386_disasm.c +@@ -791,6 +791,7 @@ default: assert (! "INVALID not handled"); @@ -702,9 +461,21 @@ GNU_SOURCE and thus %a is interpreted as having a float param): } } else ---- elfutils/libcpu/Makefile.in -+++ elfutils/libcpu/Makefile.in -@@ -116,6 +116,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +--- a/libcpu/Makefile.am ++++ b/libcpu/Makefile.am +@@ -30,7 +30,8 @@ + else + AM_CFLAGS = + endif +-AM_CFLAGS += -Wall -Wshadow -Wunused -Wextra -std=gnu99 -fpic \ ++WEXTRA = @WEXTRA@ ++AM_CFLAGS += -Wall -Wshadow -Wunused $(WEXTRA) -std=gnu99 -fpic \ + -fdollars-in-identifiers \ + $($(*F)_CFLAGS) \ + $(if $($(*F)_no_Werror),,-Werror) +--- a/libcpu/Makefile.in ++++ b/libcpu/Makefile.in +@@ -110,6 +110,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -712,37 +483,33 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = lex.$( -+ -+ * libdw.h: Disable extern inlines for GCC 4.2. -+ - 2009-08-10 Roland McGrath - - * dwarf_getscopevar.c: Use dwarf_diename. -@@ -850,6 +854,11 @@ + YACC = @YACC@ +@@ -195,10 +197,11 @@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ +-@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Wshadow -Wunused -Wextra -std=gnu99 \ +-@MUDFLAP_FALSE@ -fpic -fdollars-in-identifiers $($(*F)_CFLAGS) \ +-@MUDFLAP_FALSE@ $(if $($(*F)_no_Werror),,-Werror) +-@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Wshadow -Wunused -Wextra \ ++@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Wshadow -Wunused $(WEXTRA) \ ++@MUDFLAP_FALSE@ -std=gnu99 -fpic -fdollars-in-identifiers \ ++@MUDFLAP_FALSE@ $($(*F)_CFLAGS) $(if \ ++@MUDFLAP_FALSE@ $($(*F)_no_Werror),,-Werror) ++@MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Wshadow -Wunused $(WEXTRA) \ + @MUDFLAP_TRUE@ -std=gnu99 -fpic -fdollars-in-identifiers \ + @MUDFLAP_TRUE@ $($(*F)_CFLAGS) $(if \ + @MUDFLAP_TRUE@ $($(*F)_no_Werror),,-Werror) +--- a/libdw/ChangeLog ++++ b/libdw/ChangeLog +@@ -738,6 +738,11 @@ 2005-05-31 Roland McGrath @@ -754,20 +521,28 @@ GNU_SOURCE and thus %a is interpreted as having a float param): * dwarf_formref_die.c (dwarf_formref_die): Add CU header offset to formref offset. ---- elfutils/libdw/libdw.h -+++ elfutils/libdw/libdw.h -@@ -814,7 +814,7 @@ extern Dwarf_OOM dwarf_new_oom_handler ( +--- a/libdw/Makefile.am ++++ b/libdw/Makefile.am +@@ -25,6 +25,7 @@ + ## . + ## + DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DIS_LIBDW ++WEXTRA = @WEXTRA@ + if MUDFLAP + AM_CFLAGS = -fmudflap + else +@@ -33,7 +34,7 @@ + if BUILD_STATIC + AM_CFLAGS += -fpic + endif +-AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99 ++AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 $(WEXTRA) -std=gnu99 + INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib + VERSION = 1 - - /* Inline optimizations. */ --#ifdef __OPTIMIZE__ -+#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2) - /* Return attribute code of given attribute. */ - __libdw_extern_inline unsigned int - dwarf_whatattr (Dwarf_Attribute *attr) ---- elfutils/libdw/Makefile.in -+++ elfutils/libdw/Makefile.in -@@ -189,6 +189,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +--- a/libdw/Makefile.in ++++ b/libdw/Makefile.in +@@ -170,6 +170,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -775,26 +550,30 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -217,6 +218,7 @@ SHELL = @SHELL@ +@@ -199,6 +200,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -@@ -279,7 +281,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi - -I$(srcdir)/../libelf - AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ - $($(*F)_no_Werror),,-Werror) $(if \ -- $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -+ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ - $(am__append_1) $(am__append_2) - @MUDFLAP_FALSE@libmudflap = ---- elfutils/libdwfl/ChangeLog -+++ elfutils/libdwfl/ChangeLog -@@ -1207,6 +1207,11 @@ + YACC = @YACC@ +@@ -256,9 +258,10 @@ + top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ + @MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Werror -Wshadow \ +-@MUDFLAP_FALSE@ -Wunused -Wformat=2 -Wextra -std=gnu99 ++@MUDFLAP_FALSE@ -Wunused -Wformat=2 $(WEXTRA) -std=gnu99 + @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap $(am__append_1) -Wall -Werror \ +-@MUDFLAP_TRUE@ -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99 ++@MUDFLAP_TRUE@ -Wshadow -Wunused -Wformat=2 $(WEXTRA) \ ++@MUDFLAP_TRUE@ -std=gnu99 + INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib + COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \ + $(COMPILE))) +--- a/libdwfl/ChangeLog ++++ b/libdwfl/ChangeLog +@@ -1098,6 +1098,11 @@ 2005-07-21 Roland McGrath @@ -806,9 +585,26 @@ GNU_SOURCE and thus %a is interpreted as having a float param): * Makefile.am (noinst_HEADERS): Add loc2c.c. * test2.c (main): Check sscanf result to quiet warning. ---- elfutils/libdwfl/Makefile.in -+++ elfutils/libdwfl/Makefile.in -@@ -181,6 +181,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +--- a/libdwfl/Makefile.am ++++ b/libdwfl/Makefile.am +@@ -27,12 +27,13 @@ + ## . + ## + DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H ++WEXTRA = @WEXTRA@ + if MUDFLAP + AM_CFLAGS = -fmudflap + else + AM_CFLAGS = + endif +-AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99 ++AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 $(WEXTRA) -std=gnu99 + INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ + -I$(srcdir)/../libdw -I.. -I$(srcdir)/../lib + VERSION = 1 +--- a/libdwfl/Makefile.in ++++ b/libdwfl/Makefile.in +@@ -158,6 +158,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -816,26 +612,29 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -209,6 +210,7 @@ SHELL = @SHELL@ +@@ -187,6 +188,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -@@ -272,7 +274,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi - -I$(srcdir)/../libdw - AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ - $($(*F)_no_Werror),,-Werror) $(if \ -- $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -+ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ - $(am__append_1) - @MUDFLAP_FALSE@libmudflap = ---- elfutils/libebl/ChangeLog -+++ elfutils/libebl/ChangeLog -@@ -624,6 +624,11 @@ + YACC = @YACC@ +@@ -244,9 +246,9 @@ + top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ + @MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wshadow -Wunused -Wformat=2 \ +-@MUDFLAP_FALSE@ -Wextra -std=gnu99 ++@MUDFLAP_FALSE@ $(WEXTRA) -std=gnu99 + @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Werror -Wshadow -Wunused \ +-@MUDFLAP_TRUE@ -Wformat=2 -Wextra -std=gnu99 ++@MUDFLAP_TRUE@ -Wformat=2 $(WEXTRA) -std=gnu99 + INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ + -I$(srcdir)/../libdw -I.. -I$(srcdir)/../lib + +--- a/libebl/ChangeLog ++++ b/libebl/ChangeLog +@@ -593,6 +593,11 @@ * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency tracking works right. @@ -847,9 +646,26 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2005-05-21 Ulrich Drepper * libebl_x86_64.map: Add x86_64_core_note. ---- elfutils/libebl/Makefile.in -+++ elfutils/libebl/Makefile.in -@@ -143,6 +143,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +--- a/libebl/Makefile.am ++++ b/libebl/Makefile.am +@@ -25,12 +25,13 @@ + ## . + ## + DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DOBJDIR=\"$(shell pwd)\" ++WEXTRA = @WEXTRA@ + if MUDFLAP + AM_CFLAGS = -fmudflap + else + AM_CFLAGS = + endif +-AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 \ ++AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused $(WEXTRA) -Wformat=2 \ + -std=gnu99 + + INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ +--- a/libebl/Makefile.in ++++ b/libebl/Makefile.in +@@ -124,6 +124,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -857,26 +673,29 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -171,6 +172,7 @@ SHELL = @SHELL@ +@@ -153,6 +154,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -@@ -234,7 +236,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi - -I$(srcdir)/../libasm - AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ - $($(*F)_no_Werror),,-Werror) $(if \ -- $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -+ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ - $(am__append_1) -fpic - @MUDFLAP_FALSE@libmudflap = ---- elfutils/libelf/ChangeLog -+++ elfutils/libelf/ChangeLog -@@ -651,6 +651,11 @@ + YACC = @YACC@ +@@ -210,9 +212,9 @@ + top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ + @MUDFLAP_FALSE@AM_CFLAGS = -fpic -Wall -Wshadow -Werror -Wunused \ +-@MUDFLAP_FALSE@ -Wextra -Wformat=2 -std=gnu99 ++@MUDFLAP_FALSE@ $(WEXTRA) -Wformat=2 -std=gnu99 + @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -fpic -Wall -Wshadow -Werror \ +-@MUDFLAP_TRUE@ -Wunused -Wextra -Wformat=2 -std=gnu99 ++@MUDFLAP_TRUE@ -Wunused $(WEXTRA) -Wformat=2 -std=gnu99 + INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \ + -I$(top_srcdir)/lib -I.. -I$(srcdir)/../libasm + +--- a/libelf/ChangeLog ++++ b/libelf/ChangeLog +@@ -576,6 +576,11 @@ * elf.h: Update from glibc. @@ -888,9 +707,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2005-05-08 Roland McGrath * elf_begin.c (read_file) [_MUDFLAP]: Don't use mmap for now. ---- elfutils/libelf/common.h -+++ elfutils/libelf/common.h -@@ -160,7 +160,7 @@ libelf_release_all (Elf *elf) +--- a/libelf/common.h ++++ b/libelf/common.h +@@ -160,7 +160,7 @@ (Var) = (sizeof (Var) == 1 \ ? (unsigned char) (Var) \ : (sizeof (Var) == 2 \ @@ -899,7 +718,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): : (sizeof (Var) == 4 \ ? bswap_32 (Var) \ : bswap_64 (Var)))) -@@ -169,7 +169,7 @@ libelf_release_all (Elf *elf) +@@ -169,7 +169,7 @@ (Dst) = (sizeof (Var) == 1 \ ? (unsigned char) (Var) \ : (sizeof (Var) == 2 \ @@ -908,9 +727,28 @@ GNU_SOURCE and thus %a is interpreted as having a float param): : (sizeof (Var) == 4 \ ? bswap_32 (Var) \ : bswap_64 (Var)))) ---- elfutils/libelf/Makefile.in -+++ elfutils/libelf/Makefile.in -@@ -189,6 +189,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +--- a/libelf/Makefile.am ++++ b/libelf/Makefile.am +@@ -25,6 +25,7 @@ + ## . + ## + DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H ++WEXTRA = @WEXTRA@ + if MUDFLAP + AM_CFLAGS = -fmudflap + else +@@ -33,7 +34,7 @@ + if BUILD_STATIC + AM_CFLAGS += -fpic + endif +-AM_CFLAGS += -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 -std=gnu99 \ ++AM_CFLAGS += -Wall -Wshadow -Werror -Wunused $(WEXTRA) -Wformat=2 -std=gnu99 \ + $($(*F)_CFLAGS) + INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I.. + GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) +--- a/libelf/Makefile.in ++++ b/libelf/Makefile.in +@@ -172,6 +172,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -918,26 +756,30 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -217,6 +218,7 @@ SHELL = @SHELL@ +@@ -201,6 +202,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = 1 +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -@@ -278,7 +280,7 @@ zip_LIBS = @zip_LIBS@ - INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. - AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ - $($(*F)_no_Werror),,-Werror) $(if \ -- $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -+ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ - $(am__append_1) $(am__append_2) - @MUDFLAP_FALSE@libmudflap = ---- elfutils/m4/Makefile.in -+++ elfutils/m4/Makefile.in -@@ -75,6 +75,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ + YACC = @YACC@ +@@ -258,10 +260,10 @@ + top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ + @MUDFLAP_FALSE@AM_CFLAGS = $(am__append_1) -Wall -Wshadow -Werror \ +-@MUDFLAP_FALSE@ -Wunused -Wextra -Wformat=2 -std=gnu99 \ ++@MUDFLAP_FALSE@ -Wunused $(WEXTRA) -Wformat=2 -std=gnu99 \ + @MUDFLAP_FALSE@ $($(*F)_CFLAGS) + @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap $(am__append_1) -Wall -Wshadow \ +-@MUDFLAP_TRUE@ -Werror -Wunused -Wextra -Wformat=2 -std=gnu99 \ ++@MUDFLAP_TRUE@ -Werror -Wunused $(WEXTRA) -Wformat=2 -std=gnu99 \ + @MUDFLAP_TRUE@ $($(*F)_CFLAGS) + INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I.. + GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include) +--- a/m4/Makefile.in ++++ b/m4/Makefile.in +@@ -72,6 +72,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -945,17 +787,17 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -103,6 +104,7 @@ SHELL = @SHELL@ +@@ -101,6 +102,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ ---- elfutils/Makefile.in -+++ elfutils/Makefile.in -@@ -155,6 +155,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ + YACC = @YACC@ +--- a/Makefile.in ++++ b/Makefile.in +@@ -110,6 +110,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -963,34 +805,17 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -183,6 +184,7 @@ SHELL = @SHELL@ +@@ -139,6 +140,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ ---- elfutils/src/ChangeLog -+++ elfutils/src/ChangeLog -@@ -98,8 +98,16 @@ - * readelf.c (attr_callback): Use print_block only when we don't use - print_ops. - -+2009-08-17 Roland McGrath -+ -+ * ld.h: Disable extern inlines for GCC 4.2. -+ - 2009-08-14 Roland McGrath - -+ * strings.c (read_block): Conditionalize posix_fadvise use -+ on [POSIX_FADV_SEQUENTIAL]. -+ From Petr Salinger . -+ - * ar.c (do_oper_extract): Use pathconf instead of statfs. - - 2009-08-01 Ulrich Drepper -@@ -446,6 +456,11 @@ + YACC = @YACC@ +--- a/src/ChangeLog ++++ b/src/ChangeLog +@@ -338,6 +338,11 @@ that matches its PT_LOAD's p_flags &~ PF_W. On sparc, PF_X really is valid in RELRO. @@ -1002,7 +827,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2008-02-29 Roland McGrath * readelf.c (print_attributes): Add a cast. -@@ -697,6 +712,8 @@ +@@ -589,6 +594,8 @@ * readelf.c (hex_dump): Fix rounding error in whitespace calculation. @@ -1011,7 +836,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2007-10-15 Roland McGrath * make-debug-archive.in: New file. -@@ -1136,6 +1153,10 @@ +@@ -1028,6 +1035,10 @@ * elflint.c (valid_e_machine): Add EM_ALPHA. Reported by Christian Aichinger . @@ -1022,7 +847,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2006-08-08 Ulrich Drepper * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB. -@@ -1212,6 +1233,10 @@ +@@ -1104,6 +1115,10 @@ * Makefile.am: Add hacks to create dependency files for non-generic linker. @@ -1033,7 +858,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2006-06-12 Ulrich Drepper * ldgeneric.c (ld_generic_generate_sections): Don't create .interp -@@ -1560,6 +1585,11 @@ +@@ -1452,6 +1467,11 @@ * readelf.c (print_debug_loc_section): Fix indentation for larger address size. @@ -1045,9 +870,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2005-05-30 Roland McGrath * readelf.c (print_debug_line_section): Print section offset of each ---- elfutils/src/findtextrel.c -+++ elfutils/src/findtextrel.c -@@ -490,7 +490,11 @@ ptrcompare (const void *p1, const void * +--- a/src/findtextrel.c ++++ b/src/findtextrel.c +@@ -490,7 +490,11 @@ static void @@ -1060,26 +885,26 @@ GNU_SOURCE and thus %a is interpreted as having a float param): GElf_Addr addr, Elf *elf, Elf_Scn *symscn, Dwarf *dw, const char *fname, bool more_than_one, void **knownsrcs) { ---- elfutils/src/ld.h -+++ elfutils/src/ld.h -@@ -1122,6 +1122,7 @@ extern bool dynamically_linked_p (void); +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -26,6 +26,7 @@ + ## + DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \ + -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\" ++WEXTRA = @WEXTRA@ + if MUDFLAP + AM_CFLAGS = -fmudflap + else +@@ -33,7 +34,7 @@ + endif + AM_CFLAGS += -Wall -Wshadow -std=gnu99 $(native_ld_cflags) \ + $(if $($(*F)_no_Werror),,-Werror) \ +- $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ ++ $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \ + $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(CFLAGS_$(*F)) - /* Checked whether the symbol is undefined and referenced from a DSO. */ - extern bool linked_from_dso_p (struct scninfo *scninfo, size_t symidx); -+#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2) - #ifdef __GNUC_STDC_INLINE__ - __attribute__ ((__gnu_inline__)) - #endif -@@ -1139,5 +1140,6 @@ linked_from_dso_p (struct scninfo *scnin - - return sym->defined && sym->in_dso; - } -+#endif /* Optimizing and not GCC 4.2. */ - - #endif /* ld.h */ ---- elfutils/src/Makefile.am -+++ elfutils/src/Makefile.am -@@ -99,6 +99,9 @@ addr2line_no_Wformat = yes + INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ +@@ -112,6 +113,9 @@ # XXX While the file is not finished, don't warn about this ldgeneric_no_Wunused = yes @@ -1089,9 +914,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl size_LDADD = $(libelf) $(libeu) $(libmudflap) ---- elfutils/src/Makefile.in -+++ elfutils/src/Makefile.in -@@ -228,6 +228,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -202,6 +202,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -1099,24 +924,31 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -256,6 +257,7 @@ SHELL = @SHELL@ +@@ -231,6 +232,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -@@ -320,7 +322,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi - -I$(srcdir)/../libasm - AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ - $($(*F)_no_Werror),,-Werror) $(if \ -- $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -+ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ - $(am__append_1) - @MUDFLAP_FALSE@libmudflap = -@@ -367,6 +369,9 @@ strings_no_Wformat = yes + YACC = @YACC@ -d +@@ -290,13 +292,13 @@ + @MUDFLAP_FALSE@AM_CFLAGS = -Wall -Wshadow -std=gnu99 \ + @MUDFLAP_FALSE@ $(native_ld_cflags) $(if \ + @MUDFLAP_FALSE@ $($(*F)_no_Werror),,-Werror) $(if \ +-@MUDFLAP_FALSE@ $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ ++@MUDFLAP_FALSE@ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ + @MUDFLAP_FALSE@ $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \ + @MUDFLAP_FALSE@ $(CFLAGS_$(*F)) + @MUDFLAP_TRUE@AM_CFLAGS = -fmudflap -Wall -Wshadow -std=gnu99 \ + @MUDFLAP_TRUE@ $(native_ld_cflags) $(if \ + @MUDFLAP_TRUE@ $($(*F)_no_Werror),,-Werror) $(if \ +-@MUDFLAP_TRUE@ $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ ++@MUDFLAP_TRUE@ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ + @MUDFLAP_TRUE@ $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \ + @MUDFLAP_TRUE@ $(CFLAGS_$(*F)) + INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ +@@ -342,6 +344,9 @@ addr2line_no_Wformat = yes # XXX While the file is not finished, don't warn about this ldgeneric_no_Wunused = yes @@ -1126,9 +958,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl size_LDADD = $(libelf) $(libeu) $(libmudflap) ---- elfutils/src/readelf.c -+++ elfutils/src/readelf.c -@@ -7655,7 +7655,7 @@ dump_archive_index (Elf *elf, const char +--- a/src/readelf.c ++++ b/src/readelf.c +@@ -7591,7 +7591,7 @@ if (unlikely (elf_rand (elf, as_off) == 0) || unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf)) == NULL)) @@ -1137,8 +969,8 @@ GNU_SOURCE and thus %a is interpreted as having a float param): while (1) #endif error (EXIT_FAILURE, 0, ---- elfutils/src/strings.c -+++ elfutils/src/strings.c +--- a/src/strings.c ++++ b/src/strings.c @@ -51,6 +51,10 @@ #include @@ -1150,7 +982,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): /* Prototypes of local functions. */ static int read_fd (int fd, const char *fname, off64_t fdlen); -@@ -491,8 +495,13 @@ map_file (int fd, off64_t start_off, off +@@ -491,8 +495,13 @@ fd, start_off); if (mem != MAP_FAILED) { @@ -1164,21 +996,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): break; } if (errno != EINVAL && errno != ENOMEM) -@@ -586,9 +595,11 @@ read_block (int fd, const char *fname, o - elfmap_off = from & ~(ps - 1); - elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size); - -+#ifdef POSIX_FADV_SEQUENTIAL - if (unlikely (elfmap == MAP_FAILED)) - /* Let the kernel know we are going to read everything in sequence. */ - (void) posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL); -+#endif - } - - if (unlikely (elfmap == MAP_FAILED)) ---- elfutils/src/strip.c -+++ elfutils/src/strip.c -@@ -53,6 +53,12 @@ +--- a/src/strip.c ++++ b/src/strip.c +@@ -52,6 +52,12 @@ #include #include @@ -1191,7 +1011,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): /* Name and version of program. */ static void print_version (FILE *stream, struct argp_state *state); -@@ -301,8 +307,18 @@ process_file (const char *fname) +@@ -300,8 +306,18 @@ /* If we have to preserve the timestamp, we need it in the format utimes() understands. */ @@ -1210,7 +1030,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): } /* Open the file. */ -@@ -1747,7 +1763,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1746,7 +1762,7 @@ /* If requested, preserve the timestamp. */ if (tvp != NULL) { @@ -1219,7 +1039,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): { error (0, errno, gettext ("\ cannot set access and modification date of '%s'"), -@@ -1804,7 +1820,7 @@ handle_ar (int fd, Elf *elf, const char +@@ -1803,7 +1819,7 @@ if (tvp != NULL) { @@ -1228,9 +1048,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): { error (0, errno, gettext ("\ cannot set access and modification date of '%s'"), fname); ---- elfutils/tests/ChangeLog -+++ elfutils/tests/ChangeLog -@@ -150,6 +150,8 @@ +--- a/tests/ChangeLog ++++ b/tests/ChangeLog +@@ -124,6 +124,8 @@ 2008-01-21 Roland McGrath @@ -1239,7 +1059,7 @@ GNU_SOURCE and thus %a is interpreted as having a float param): * testfile45.S.bz2: Add tests for cltq, cqto. * testfile45.expect.bz2: Adjust. -@@ -858,6 +860,11 @@ +@@ -832,6 +834,11 @@ * Makefile.am (TESTS): Add run-elflint-test.sh. (EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2. @@ -1251,9 +1071,9 @@ GNU_SOURCE and thus %a is interpreted as having a float param): 2005-05-24 Ulrich Drepper * get-files.c (main): Use correct format specifier. ---- elfutils/tests/line2addr.c -+++ elfutils/tests/line2addr.c -@@ -132,7 +132,7 @@ main (int argc, char *argv[]) +--- a/tests/line2addr.c ++++ b/tests/line2addr.c +@@ -132,7 +132,7 @@ { struct args a = { .arg = argv[cnt] }; @@ -1262,9 +1082,27 @@ GNU_SOURCE and thus %a is interpreted as having a float param): { default: case 0: ---- elfutils/tests/Makefile.in -+++ elfutils/tests/Makefile.in -@@ -372,6 +372,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -25,12 +25,13 @@ + ## . + ## + DEFS = -DHAVE_CONFIG_H -D_GNU_SOURCE ++WEXTRA = @WEXTRA@ + if MUDFLAP +-AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 -fmudflap\ ++AM_CFLAGS = -Wall -Werror $(WEXTRA) -std=gnu99 -fmudflap\ + $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) + BUILD_RPATH = \$$ORIGIN/../backends + else +-AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 \ ++AM_CFLAGS = -Wall -Werror $(WEXTRA) -std=gnu99 \ + $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) + BUILT_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf + endif +--- a/tests/Makefile.in ++++ b/tests/Makefile.in +@@ -353,6 +353,7 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ @@ -1272,20 +1110,24 @@ GNU_SOURCE and thus %a is interpreted as having a float param): LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -@@ -400,6 +401,7 @@ SHELL = @SHELL@ +@@ -382,6 +383,7 @@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +WEXTRA = @WEXTRA@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ - XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -@@ -461,7 +463,7 @@ zip_LIBS = @zip_LIBS@ - INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. $(am__append_2) - AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \ - $($(*F)_no_Werror),,-Werror) $(if \ -- $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \ -+ $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \ - $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \ - $(am__append_1) - @MUDFLAP_FALSE@libmudflap = + YACC = @YACC@ +@@ -438,10 +440,10 @@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + zip_LIBS = @zip_LIBS@ +-@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 \ ++@MUDFLAP_FALSE@AM_CFLAGS = -Wall -Werror $(WEXTRA) -std=gnu99 \ + @MUDFLAP_FALSE@ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) + +-@MUDFLAP_TRUE@AM_CFLAGS = -Wall -Werror -Wextra -std=gnu99 -fmudflap\ ++@MUDFLAP_TRUE@AM_CFLAGS = -Wall -Werror $(WEXTRA) -std=gnu99 -fmudflap\ + @MUDFLAP_TRUE@ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) + + @MUDFLAP_TRUE@BUILD_RPATH = \$$ORIGIN/../backends diff --git a/elfutils-robustify.patch b/elfutils-robustify.patch index abe0f2c..eb195d3 100644 --- a/elfutils-robustify.patch +++ b/elfutils-robustify.patch @@ -1,19 +1,59 @@ -From: Tony Jones -Subject: Elfutils robustify patch -Version: 0.147 -References: https://fedorahosted.org/releases/e/l/elfutils/elfutils-robustify.patch -Upstream: yes +--- + libelf/ChangeLog | 43 +++++++++++++++++ + libelf/elf32_getphdr.c | 10 ++++ + libelf/elf32_getshdr.c | 15 +++++- + libelf/elf32_newphdr.c | 6 ++ + libelf/elf32_updatefile.c | 7 ++ + libelf/elf_begin.c | 46 ++++++++++++++++++- + libelf/elf_getarsym.c | 3 + + libelf/elf_getshdrstrndx.c | 38 ++++++++++++++- + libelf/elf_newscn.c | 10 +++- + libelf/gelf_getdyn.c | 6 +- + libelf/gelf_getlib.c | 3 - + libelf/gelf_getmove.c | 3 - + libelf/gelf_getrel.c | 12 +--- + libelf/gelf_getrela.c | 12 +--- + libelf/gelf_getsym.c | 6 +- + libelf/gelf_getsyminfo.c | 3 - + libelf/gelf_getsymshndx.c | 10 ++-- + libelf/gelf_getversym.c | 3 - + libelf/gelf_update_dyn.c | 12 +--- + libelf/gelf_update_lib.c | 9 --- + libelf/gelf_update_move.c | 2 + libelf/gelf_update_rel.c | 12 +--- + libelf/gelf_update_rela.c | 12 +--- + libelf/gelf_update_sym.c | 12 +--- + libelf/gelf_update_syminfo.c | 9 --- + libelf/gelf_update_symshndx.c | 12 +--- + libelf/gelf_update_versym.c | 2 + libelf/libelfP.h | 9 +++ + src/ChangeLog | 23 +++++++++ + src/elflint.c | 101 +++++++++++++++++++++++++++++++----------- + src/readelf.c | 92 +++++++++++++++++++++++++++----------- + src/strip.c | 70 +++++++++++++++++++---------- + 32 files changed, 446 insertions(+), 167 deletions(-) -This patch contains functional/stability fixes that are regarded as generally -useful by the community but are not accepted by the elfutils maintainer (and -are therefore not in the git repository). - ---- elfutils/libelf/ChangeLog -+++ elfutils/libelf/ChangeLog -@@ -643,10 +643,53 @@ +--- a/libelf/ChangeLog ++++ b/libelf/ChangeLog +@@ -568,6 +568,49 @@ 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. ++2005-05-17 Jakub Jelinek ++ ++ * elf32_getphdr.c (elfw2(LIBELFBITS,getphdr)): Check if program header ++ table fits into object's bounds. ++ * elf_getshstrndx.c (elf_getshstrndx): Add elf->start_offset to ++ elf->map_address. Check if first section header fits into object's ++ bounds. ++ * elf32_getshdr.c (elfw2(LIBELFBITS,getshdr)): ++ Check if section header table fits into object's bounds. ++ * elf_begin.c (get_shnum): Ensure section headers fits into ++ object's bounds. ++ (file_read_elf): Make sure scncnt is small enough to allocate both ++ ElfXX_Shdr and Elf_Scn array. Make sure section and program header ++ tables fit into object's bounds. Avoid memory leak on failure. ++ +2005-05-14 Jakub Jelinek + + * libelfP.h (INVALID_NDX): Define. @@ -45,35 +85,16 @@ are therefore not in the git repository). 2005-05-11 Ulrich Drepper * elf.h: Update again. - -+2005-05-17 Jakub Jelinek -+ -+ * elf32_getphdr.c (elfw2(LIBELFBITS,getphdr)): Check if program header -+ table fits into object's bounds. -+ * elf_getshstrndx.c (elf_getshstrndx): Add elf->start_offset to -+ elf->map_address. Check if first section header fits into object's -+ bounds. -+ * elf32_getshdr.c (elfw2(LIBELFBITS,getshdr)): -+ Check if section header table fits into object's bounds. -+ * elf_begin.c (get_shnum): Ensure section headers fits into -+ object's bounds. -+ (file_read_elf): Make sure scncnt is small enough to allocate both -+ ElfXX_Shdr and Elf_Scn array. Make sure section and program header -+ tables fit into object's bounds. Avoid memory leak on failure. -+ - 2005-05-09 Ulrich Drepper - - * elf.h: Update from glibc. ---- elfutils/libelf/elf32_getphdr.c -+++ elfutils/libelf/elf32_getphdr.c -@@ -114,6 +114,16 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf) +--- a/libelf/elf32_getphdr.c ++++ b/libelf/elf32_getphdr.c +@@ -105,6 +105,16 @@ if (elf->map_address != NULL) { + /* First see whether the information in the ELF header is + valid and it does not ask for too much. */ + if (unlikely (ehdr->e_phoff >= elf->maximum_size) -+ || unlikely (elf->maximum_size - ehdr->e_phoff < size)) ++ || unlikely (ehdr->e_phoff + size > elf->maximum_size)) + { + /* Something is wrong. */ + __libelf_seterrno (ELF_E_INVALID_PHDR); @@ -83,8 +104,8 @@ are therefore not in the git repository). /* All the data is already mapped. Use it. */ void *file_phdr = ((char *) elf->map_address + elf->start_offset + ehdr->e_phoff); ---- elfutils/libelf/elf32_getshdr.c -+++ elfutils/libelf/elf32_getshdr.c +--- a/libelf/elf32_getshdr.c ++++ b/libelf/elf32_getshdr.c @@ -1,5 +1,5 @@ /* Return section header. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2007, 2009 Red Hat, Inc. @@ -92,7 +113,7 @@ are therefore not in the git repository). This file is part of Red Hat elfutils. Written by Ulrich Drepper , 1998. -@@ -81,7 +81,8 @@ load_shdr_wrlock (Elf_Scn *scn) +@@ -81,7 +81,8 @@ goto out; size_t shnum; @@ -102,14 +123,14 @@ are therefore not in the git repository). goto out; size_t size = shnum * sizeof (ElfW2(LIBELFBITS,Shdr)); -@@ -98,6 +99,16 @@ load_shdr_wrlock (Elf_Scn *scn) +@@ -98,6 +99,16 @@ if (elf->map_address != NULL) { + /* First see whether the information in the ELF header is + valid and it does not ask for too much. */ + if (unlikely (ehdr->e_shoff >= elf->maximum_size) -+ || unlikely (elf->maximum_size - ehdr->e_shoff < size)) ++ || unlikely (ehdr->e_shoff + size > elf->maximum_size)) + { + /* Something is wrong. */ + __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER); @@ -119,10 +140,10 @@ are therefore not in the git repository). ElfW2(LIBELFBITS,Shdr) *notcvt; /* All the data is already mapped. If we could use it ---- elfutils/libelf/elf32_newphdr.c -+++ elfutils/libelf/elf32_newphdr.c -@@ -135,6 +135,12 @@ elfw2(LIBELFBITS,newphdr) (elf, count) - || count == PN_XNUM +--- a/libelf/elf32_newphdr.c ++++ b/libelf/elf32_newphdr.c +@@ -124,6 +124,12 @@ + else if (elf->state.ELFW(elf,LIBELFBITS).ehdr->e_phnum != count || elf->state.ELFW(elf,LIBELFBITS).phdr == NULL) { + if (unlikely (count > SIZE_MAX / sizeof (ElfW2(LIBELFBITS,Phdr)))) @@ -134,9 +155,9 @@ are therefore not in the git repository). /* Allocate a new program header with the appropriate number of elements. */ result = (ElfW2(LIBELFBITS,Phdr) *) ---- elfutils/libelf/elf32_updatefile.c -+++ elfutils/libelf/elf32_updatefile.c -@@ -223,6 +223,9 @@ __elfw2(LIBELFBITS,updatemmap) (Elf *elf +--- a/libelf/elf32_updatefile.c ++++ b/libelf/elf32_updatefile.c +@@ -220,6 +220,9 @@ /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) { @@ -146,7 +167,7 @@ are therefore not in the git repository). Elf_ScnList *list = &elf->state.ELFW(elf,LIBELFBITS).scns; Elf_Scn **scns = (Elf_Scn **) alloca (shnum * sizeof (Elf_Scn *)); char *const shdr_start = ((char *) elf->map_address + elf->start_offset -@@ -645,6 +648,10 @@ __elfw2(LIBELFBITS,updatefile) (Elf *elf +@@ -636,6 +639,10 @@ /* Write all the sections. Well, only those which are modified. */ if (shnum > 0) { @@ -157,19 +178,19 @@ are therefore not in the git repository). off_t shdr_offset = elf->start_offset + ehdr->e_shoff; #if EV_NUM != 2 xfct_t shdr_fctp = __elf_xfctstom[__libelf_version - 1][EV_CURRENT - 1][ELFW(ELFCLASS, LIBELFBITS) - 1][ELF_T_SHDR]; ---- elfutils/libelf/elf_begin.c -+++ elfutils/libelf/elf_begin.c -@@ -165,7 +165,8 @@ get_shnum (void *map_address, unsigned c +--- a/libelf/elf_begin.c ++++ b/libelf/elf_begin.c +@@ -165,7 +165,8 @@ if (unlikely (result == 0) && ehdr.e32->e_shoff != 0) { - if (ehdr.e32->e_shoff + sizeof (Elf32_Shdr) > maxsize) + if (unlikely (ehdr.e32->e_shoff >= maxsize) -+ || unlikely (maxsize - ehdr.e32->e_shoff < sizeof (Elf32_Shdr))) ++ || unlikely (ehdr.e32->e_shoff + sizeof (Elf32_Shdr) > maxsize)) /* Cannot read the first section header. */ return 0; -@@ -213,7 +214,8 @@ get_shnum (void *map_address, unsigned c +@@ -213,7 +214,8 @@ if (unlikely (result == 0) && ehdr.e64->e_shoff != 0) { @@ -179,7 +200,7 @@ are therefore not in the git repository). /* Cannot read the first section header. */ return 0; -@@ -285,6 +287,15 @@ file_read_elf (int fildes, void *map_add +@@ -285,6 +287,15 @@ /* Could not determine the number of sections. */ return NULL; @@ -192,17 +213,17 @@ are therefore not in the git repository). + else if (scncnt > SIZE_MAX / (sizeof (Elf_Scn) + sizeof (Elf64_Shdr))) + return NULL; + - /* We can now allocate the memory. Even if there are no section headers, - we allocate space for a zeroth section in case we need it later. */ - const size_t scnmax = (scncnt ?: (cmd == ELF_C_RDWR || cmd == ELF_C_RDWR_MMAP) -@@ -324,6 +335,16 @@ file_read_elf (int fildes, void *map_add + /* We can now allocate the memory. */ + Elf *elf = allocate_elf (fildes, map_address, offset, maxsize, cmd, parent, + ELF_K_ELF, scncnt * sizeof (Elf_Scn)); +@@ -318,13 +329,31 @@ { /* We can use the mmapped memory. */ elf->state.elf32.ehdr = ehdr; + + if (unlikely (ehdr->e_shoff >= maxsize) -+ || unlikely (maxsize - ehdr->e_shoff -+ < scncnt * sizeof (Elf32_Shdr))) ++ || unlikely (ehdr->e_shoff ++ + scncnt * sizeof (Elf32_Shdr) > maxsize)) + { + free_and_out: + free (elf); @@ -211,8 +232,23 @@ are therefore not in the git repository). + } elf->state.elf32.shdr = (Elf32_Shdr *) ((char *) ehdr + ehdr->e_shoff); ++ + if (ehdr->e_phnum > 0) ++ { + /* Assign a value only if there really is a program + header. Otherwise the value remains NULL. */ ++ if (unlikely (ehdr->e_phoff >= maxsize) ++ || unlikely (ehdr->e_phoff ++ + ehdr->e_phnum ++ * sizeof (Elf32_Phdr) > maxsize)) ++ goto free_and_out; + elf->state.elf32.phdr + = (Elf32_Phdr *) ((char *) ehdr + ehdr->e_phoff); ++ } -@@ -410,6 +431,11 @@ file_read_elf (int fildes, void *map_add + for (size_t cnt = 0; cnt < scncnt; ++cnt) + { +@@ -406,13 +435,26 @@ { /* We can use the mmapped memory. */ elf->state.elf64.ehdr = ehdr; @@ -223,10 +259,25 @@ are therefore not in the git repository). + goto free_and_out; elf->state.elf64.shdr = (Elf64_Shdr *) ((char *) ehdr + ehdr->e_shoff); ++ + if (ehdr->e_phnum > 0) ++ { + /* Assign a value only if there really is a program + header. Otherwise the value remains NULL. */ ++ if (unlikely (ehdr->e_phoff >= maxsize) ++ || unlikely (ehdr->e_phoff ++ + ehdr->e_phnum ++ * sizeof (Elf32_Phdr) > maxsize)) ++ goto free_and_out; + elf->state.elf64.phdr + = (Elf64_Phdr *) ((char *) ehdr + ehdr->e_phoff); ++ } ---- elfutils/libelf/elf_getarsym.c -+++ elfutils/libelf/elf_getarsym.c -@@ -179,6 +179,9 @@ elf_getarsym (elf, ptr) + for (size_t cnt = 0; cnt < scncnt; ++cnt) + { +--- a/libelf/elf_getarsym.c ++++ b/libelf/elf_getarsym.c +@@ -179,6 +179,9 @@ size_t index_size = atol (tmpbuf); if (SARMAG + sizeof (struct ar_hdr) + index_size > elf->maximum_size @@ -236,9 +287,9 @@ are therefore not in the git repository). || n * sizeof (uint32_t) > index_size) { /* This index table cannot be right since it does not fit into ---- elfutils/libelf/elf_getshdrstrndx.c -+++ elfutils/libelf/elf_getshdrstrndx.c -@@ -125,10 +125,25 @@ elf_getshdrstrndx (elf, dst) +--- a/libelf/elf_getshdrstrndx.c ++++ b/libelf/elf_getshdrstrndx.c +@@ -125,10 +125,25 @@ if (elf->map_address != NULL && elf->state.elf32.ehdr->e_ident[EI_DATA] == MY_ELFDATA && (ALLOW_UNALIGNED @@ -246,13 +297,11 @@ are therefore not in the git repository). + || (((size_t) ((char *) elf->map_address + + elf->start_offset + offset)) & (__alignof__ (Elf32_Shdr) - 1)) == 0)) -- /* We can directly access the memory. */ -- num = ((Elf32_Shdr *) (elf->map_address + offset))->sh_link; + { + /* First see whether the information in the ELF header is + valid and it does not ask for too much. */ -+ if (unlikely (elf->maximum_size - offset -+ < sizeof (Elf32_Shdr))) ++ if (unlikely (offset + sizeof (Elf32_Shdr) ++ > elf->maximum_size)) + { + /* Something is wrong. */ + __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER); @@ -260,14 +309,15 @@ are therefore not in the git repository). + goto out; + } + -+ /* We can directly access the memory. */ + /* We can directly access the memory. */ +- num = ((Elf32_Shdr *) (elf->map_address + offset))->sh_link; + num = ((Elf32_Shdr *) (elf->map_address + elf->start_offset + + offset))->sh_link; + } else { /* We avoid reading in all the section headers. Just read -@@ -163,10 +178,25 @@ elf_getshdrstrndx (elf, dst) +@@ -163,10 +178,25 @@ if (elf->map_address != NULL && elf->state.elf64.ehdr->e_ident[EI_DATA] == MY_ELFDATA && (ALLOW_UNALIGNED @@ -275,13 +325,11 @@ are therefore not in the git repository). + || (((size_t) ((char *) elf->map_address + + elf->start_offset + offset)) & (__alignof__ (Elf64_Shdr) - 1)) == 0)) -- /* We can directly access the memory. */ -- num = ((Elf64_Shdr *) (elf->map_address + offset))->sh_link; + { + /* First see whether the information in the ELF header is + valid and it does not ask for too much. */ -+ if (unlikely (elf->maximum_size - offset -+ < sizeof (Elf64_Shdr))) ++ if (unlikely (offset + sizeof (Elf64_Shdr) ++ > elf->maximum_size)) + { + /* Something is wrong. */ + __libelf_seterrno (ELF_E_INVALID_SECTION_HEADER); @@ -289,16 +337,17 @@ are therefore not in the git repository). + goto out; + } + -+ /* We can directly access the memory. */ -+ num = ((Elf64_Shdr *) (elf->map_address + elf->start_offset -+ + offset))->sh_link; + /* We can directly access the memory. */ +- num = ((Elf64_Shdr *) (elf->map_address + offset))->sh_link; ++ num = ((Elf64_Shdr *) (elf->map_address ++ + elf->start_offset + offset))->sh_link; + } else { /* We avoid reading in all the section headers. Just read ---- elfutils/libelf/elf_newscn.c -+++ elfutils/libelf/elf_newscn.c -@@ -104,10 +104,18 @@ elf_newscn (elf) +--- a/libelf/elf_newscn.c ++++ b/libelf/elf_newscn.c +@@ -104,10 +104,18 @@ else { /* We must allocate a new element. */ @@ -318,79 +367,55 @@ are therefore not in the git repository). newp = (Elf_ScnList *) calloc (sizeof (Elf_ScnList) + ((elf->state.elf.scnincr *= 2) * sizeof (Elf_Scn)), 1); ---- elfutils/libelf/gelf_getdyn.c -+++ elfutils/libelf/gelf_getdyn.c -@@ -1,5 +1,5 @@ - /* Get information from dynamic table at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -93,7 +93,7 @@ gelf_getdyn (data, ndx, dst) +--- a/libelf/gelf_getdyn.c ++++ b/libelf/gelf_getdyn.c +@@ -93,7 +93,8 @@ table entries has to be adopted. The user better has provided a buffer where we can store the information. While copying the data we are converting the format. */ - if (unlikely ((ndx + 1) * sizeof (Elf32_Dyn) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Dyn, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf32_Dyn) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Dyn) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; -@@ -114,7 +114,7 @@ gelf_getdyn (data, ndx, dst) +@@ -114,7 +115,8 @@ /* The data is already in the correct form. Just make sure the index is OK. */ - if (unlikely ((ndx + 1) * sizeof (GElf_Dyn) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, GElf_Dyn, &data_scn->d)) ++ if (INVALID_NDX (ndx, GElf_Dyn) ++ || unlikely ((ndx + 1) * sizeof (GElf_Dyn) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_getlib.c -+++ elfutils/libelf/gelf_getlib.c -@@ -1,5 +1,5 @@ - /* Get library from table at the given index. -- Copyright (C) 2004 Red Hat, Inc. -+ Copyright (C) 2004-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2004. - -@@ -86,7 +86,7 @@ gelf_getlib (data, ndx, dst) +--- a/libelf/gelf_getlib.c ++++ b/libelf/gelf_getlib.c +@@ -86,7 +86,8 @@ /* The data is already in the correct form. Just make sure the index is OK. */ GElf_Lib *result = NULL; - if (unlikely ((ndx + 1) * sizeof (GElf_Lib) > data->d_size)) -+ if (INVALID_NDX (ndx, GElf_Lib, data)) ++ if (INVALID_NDX (ndx, GElf_Lib) ++ || unlikely ((ndx + 1) * sizeof (GElf_Lib) > data->d_size)) __libelf_seterrno (ELF_E_INVALID_INDEX); else { ---- elfutils/libelf/gelf_getmove.c -+++ elfutils/libelf/gelf_getmove.c -@@ -1,5 +1,5 @@ - /* Get move structure at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -83,7 +83,7 @@ gelf_getmove (data, ndx, dst) +--- a/libelf/gelf_getmove.c ++++ b/libelf/gelf_getmove.c +@@ -83,7 +83,8 @@ /* The data is already in the correct form. Just make sure the index is OK. */ - if (unlikely ((ndx + 1) * sizeof (GElf_Move) > data->d_size)) -+ if (INVALID_NDX (ndx, GElf_Move, data)) ++ if (INVALID_NDX (ndx, GElf_Move) ++ || unlikely ((ndx + 1) * sizeof (GElf_Move) > data->d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_getrela.c -+++ elfutils/libelf/gelf_getrela.c -@@ -1,5 +1,5 @@ - /* Get RELA relocation information at given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -71,12 +71,6 @@ gelf_getrela (data, ndx, dst) +--- a/libelf/gelf_getrela.c ++++ b/libelf/gelf_getrela.c +@@ -71,12 +71,6 @@ if (data_scn == NULL) return NULL; @@ -403,34 +428,29 @@ are therefore not in the git repository). if (unlikely (data_scn->d.d_type != ELF_T_RELA)) { __libelf_seterrno (ELF_E_INVALID_HANDLE); -@@ -93,7 +87,7 @@ gelf_getrela (data, ndx, dst) +@@ -93,7 +87,8 @@ if (scn->elf->class == ELFCLASS32) { /* We have to convert the data. */ - if (unlikely ((ndx + 1) * sizeof (Elf32_Rela) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Rela, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf32_Rela) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Rela) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); result = NULL; -@@ -114,7 +108,7 @@ gelf_getrela (data, ndx, dst) +@@ -114,7 +109,8 @@ { /* Simply copy the data after we made sure we are actually getting correct data. */ - if (unlikely ((ndx + 1) * sizeof (Elf64_Rela) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Rela, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf64_Rela) ++ || unlikely ((ndx + 1) * sizeof (Elf64_Rela) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); result = NULL; ---- elfutils/libelf/gelf_getrel.c -+++ elfutils/libelf/gelf_getrel.c -@@ -1,5 +1,5 @@ - /* Get REL relocation information at given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -71,12 +71,6 @@ gelf_getrel (data, ndx, dst) +--- a/libelf/gelf_getrel.c ++++ b/libelf/gelf_getrel.c +@@ -71,12 +71,6 @@ if (data_scn == NULL) return NULL; @@ -443,134 +463,108 @@ are therefore not in the git repository). if (unlikely (data_scn->d.d_type != ELF_T_REL)) { __libelf_seterrno (ELF_E_INVALID_HANDLE); -@@ -93,7 +87,7 @@ gelf_getrel (data, ndx, dst) +@@ -93,7 +87,8 @@ if (scn->elf->class == ELFCLASS32) { /* We have to convert the data. */ - if (unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Rel, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf32_Rel) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); result = NULL; -@@ -113,7 +107,7 @@ gelf_getrel (data, ndx, dst) +@@ -113,7 +108,8 @@ { /* Simply copy the data after we made sure we are actually getting correct data. */ - if (unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Rel, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf64_Rel) ++ || unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); result = NULL; ---- elfutils/libelf/gelf_getsym.c -+++ elfutils/libelf/gelf_getsym.c -@@ -1,5 +1,5 @@ - /* Get symbol information from symbol table at the given index. -- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 1999-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 1999. - -@@ -90,7 +90,7 @@ gelf_getsym (data, ndx, dst) +--- a/libelf/gelf_getsym.c ++++ b/libelf/gelf_getsym.c +@@ -90,7 +90,8 @@ table entries has to be adopted. The user better has provided a buffer where we can store the information. While copying the data we are converting the format. */ - if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > data->d_size)) -+ if (INVALID_NDX (ndx, Elf32_Sym, data)) ++ if (INVALID_NDX (ndx, Elf32_Sym) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Sym) > data->d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; -@@ -119,7 +119,7 @@ gelf_getsym (data, ndx, dst) +@@ -119,7 +120,8 @@ /* The data is already in the correct form. Just make sure the index is OK. */ - if (unlikely ((ndx + 1) * sizeof (GElf_Sym) > data->d_size)) -+ if (INVALID_NDX (ndx, GElf_Sym, data)) ++ if (INVALID_NDX (ndx, GElf_Sym) ++ || unlikely ((ndx + 1) * sizeof (GElf_Sym) > data->d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_getsyminfo.c -+++ elfutils/libelf/gelf_getsyminfo.c -@@ -1,5 +1,5 @@ - /* Get additional symbol information from symbol table at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -84,7 +84,7 @@ gelf_getsyminfo (data, ndx, dst) +--- a/libelf/gelf_getsyminfo.c ++++ b/libelf/gelf_getsyminfo.c +@@ -84,7 +84,8 @@ /* The data is already in the correct form. Just make sure the index is OK. */ - if (unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data->d_size)) -+ if (INVALID_NDX (ndx, GElf_Syminfo, data)) ++ if (INVALID_NDX (ndx, GElf_Syminfo) ++ || unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data->d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_getsymshndx.c -+++ elfutils/libelf/gelf_getsymshndx.c -@@ -1,6 +1,6 @@ - /* Get symbol information and separate section index from symbol table - at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -90,7 +90,7 @@ gelf_getsymshndx (symdata, shndxdata, nd +--- a/libelf/gelf_getsymshndx.c ++++ b/libelf/gelf_getsymshndx.c +@@ -90,7 +90,9 @@ section index table. */ if (likely (shndxdata_scn != NULL)) { - if (unlikely ((ndx + 1) * sizeof (Elf32_Word) > shndxdata_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Word, &shndxdata_scn->d)) ++ if (INVALID_NDX (ndx, Elf32_Word) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Word) ++ > shndxdata_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; -@@ -110,7 +110,7 @@ gelf_getsymshndx (symdata, shndxdata, nd +@@ -110,7 +112,8 @@ table entries has to be adopted. The user better has provided a buffer where we can store the information. While copying the data we are converting the format. */ - if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata->d_size)) -+ if (INVALID_NDX (ndx, Elf32_Sym, symdata)) ++ if (INVALID_NDX (ndx, Elf32_Sym) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata->d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; -@@ -139,7 +139,7 @@ gelf_getsymshndx (symdata, shndxdata, nd +@@ -139,7 +142,8 @@ /* The data is already in the correct form. Just make sure the index is OK. */ - if (unlikely ((ndx + 1) * sizeof (GElf_Sym) > symdata->d_size)) -+ if (INVALID_NDX (ndx, GElf_Sym, symdata)) ++ if (INVALID_NDX (ndx, GElf_Sym) ++ || unlikely ((ndx + 1) * sizeof (GElf_Sym) > symdata->d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_getversym.c -+++ elfutils/libelf/gelf_getversym.c -@@ -1,5 +1,5 @@ - /* Get symbol version information at the given index. -- Copyright (C) 1999, 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 1999-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 1999. - -@@ -92,7 +92,7 @@ gelf_getversym (data, ndx, dst) +--- a/libelf/gelf_getversym.c ++++ b/libelf/gelf_getversym.c +@@ -92,7 +92,8 @@ /* The data is already in the correct form. Just make sure the index is OK. */ - if (unlikely ((ndx + 1) * sizeof (GElf_Versym) > data->d_size)) -+ if (INVALID_NDX (ndx, GElf_Versym, data)) ++ if (INVALID_NDX (ndx, GElf_Versym) ++ || unlikely ((ndx + 1) * sizeof (GElf_Versym) > data->d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); result = NULL; ---- elfutils/libelf/gelf_update_dyn.c -+++ elfutils/libelf/gelf_update_dyn.c -@@ -1,5 +1,5 @@ - /* Update information in dynamic table at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -71,12 +71,6 @@ gelf_update_dyn (data, ndx, src) +--- a/libelf/gelf_update_dyn.c ++++ b/libelf/gelf_update_dyn.c +@@ -71,12 +71,6 @@ if (data == NULL) return 0; @@ -583,34 +577,29 @@ are therefore not in the git repository). if (unlikely (data_scn->d.d_type != ELF_T_DYN)) { /* The type of the data better should match. */ -@@ -102,7 +96,7 @@ gelf_update_dyn (data, ndx, src) +@@ -102,7 +96,8 @@ } /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (Elf32_Dyn) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Dyn, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf32_Dyn) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Dyn) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; -@@ -116,7 +110,7 @@ gelf_update_dyn (data, ndx, src) +@@ -116,7 +111,8 @@ else { /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (Elf64_Dyn) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Dyn, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf64_Dyn) ++ || unlikely ((ndx + 1) * sizeof (Elf64_Dyn) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_update_lib.c -+++ elfutils/libelf/gelf_update_lib.c -@@ -1,5 +1,5 @@ - /* Update library in table at the given index. -- Copyright (C) 2004 Red Hat, Inc. -+ Copyright (C) 2004-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2004. - -@@ -68,12 +68,6 @@ gelf_update_lib (data, ndx, src) +--- a/libelf/gelf_update_lib.c ++++ b/libelf/gelf_update_lib.c +@@ -68,12 +68,6 @@ if (data == NULL) return 0; @@ -623,44 +612,30 @@ are therefore not in the git repository). Elf_Data_Scn *data_scn = (Elf_Data_Scn *) data; if (unlikely (data_scn->d.d_type != ELF_T_LIB)) { -@@ -87,7 +81,7 @@ gelf_update_lib (data, ndx, src) +@@ -87,7 +81,8 @@ /* Check whether we have to resize the data buffer. */ int result = 0; - if (unlikely ((ndx + 1) * sizeof (Elf64_Lib) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Lib, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf64_Lib) ++ || unlikely ((ndx + 1) * sizeof (Elf64_Lib) > data_scn->d.d_size)) __libelf_seterrno (ELF_E_INVALID_INDEX); else { ---- elfutils/libelf/gelf_update_move.c -+++ elfutils/libelf/gelf_update_move.c -@@ -1,5 +1,5 @@ - /* Update move structure at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -75,8 +75,7 @@ gelf_update_move (data, ndx, src) +--- a/libelf/gelf_update_move.c ++++ b/libelf/gelf_update_move.c +@@ -75,7 +75,7 @@ assert (sizeof (GElf_Move) == sizeof (Elf64_Move)); /* Check whether we have to resize the data buffer. */ - if (unlikely (ndx < 0) -- || unlikely ((ndx + 1) * sizeof (GElf_Move) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, GElf_Move, &data_scn->d)) ++ if (INVALID_NDX (ndx, GElf_Move) + || unlikely ((ndx + 1) * sizeof (GElf_Move) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); - return 0; ---- elfutils/libelf/gelf_update_rela.c -+++ elfutils/libelf/gelf_update_rela.c -@@ -1,5 +1,5 @@ - /* Update RELA relocation information at given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -68,12 +68,6 @@ gelf_update_rela (Elf_Data *dst, int ndx +--- a/libelf/gelf_update_rela.c ++++ b/libelf/gelf_update_rela.c +@@ -68,12 +68,6 @@ if (dst == NULL) return 0; @@ -673,34 +648,29 @@ are therefore not in the git repository). if (unlikely (data_scn->d.d_type != ELF_T_RELA)) { /* The type of the data better should match. */ -@@ -101,7 +95,7 @@ gelf_update_rela (Elf_Data *dst, int ndx +@@ -101,7 +95,8 @@ } /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (Elf32_Rela) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Rela, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf32_Rela) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Rela) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; -@@ -117,7 +111,7 @@ gelf_update_rela (Elf_Data *dst, int ndx +@@ -117,7 +112,8 @@ else { /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (Elf64_Rela) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Rela, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf64_Rela) ++ || unlikely ((ndx + 1) * sizeof (Elf64_Rela) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_update_rel.c -+++ elfutils/libelf/gelf_update_rel.c -@@ -1,5 +1,5 @@ - /* Update REL relocation information at given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -68,12 +68,6 @@ gelf_update_rel (Elf_Data *dst, int ndx, +--- a/libelf/gelf_update_rel.c ++++ b/libelf/gelf_update_rel.c +@@ -68,12 +68,6 @@ if (dst == NULL) return 0; @@ -713,34 +683,29 @@ are therefore not in the git repository). if (unlikely (data_scn->d.d_type != ELF_T_REL)) { /* The type of the data better should match. */ -@@ -99,7 +93,7 @@ gelf_update_rel (Elf_Data *dst, int ndx, +@@ -99,7 +93,8 @@ } /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Rel, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf32_Rel) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Rel) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; -@@ -114,7 +108,7 @@ gelf_update_rel (Elf_Data *dst, int ndx, +@@ -114,7 +109,8 @@ else { /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Rel, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf64_Rel) ++ || unlikely ((ndx + 1) * sizeof (Elf64_Rel) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_update_sym.c -+++ elfutils/libelf/gelf_update_sym.c -@@ -1,5 +1,5 @@ - /* Update symbol information in symbol table at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -72,12 +72,6 @@ gelf_update_sym (data, ndx, src) +--- a/libelf/gelf_update_sym.c ++++ b/libelf/gelf_update_sym.c +@@ -72,12 +72,6 @@ if (data == NULL) return 0; @@ -753,34 +718,29 @@ are therefore not in the git repository). if (unlikely (data_scn->d.d_type != ELF_T_SYM)) { /* The type of the data better should match. */ -@@ -102,7 +96,7 @@ gelf_update_sym (data, ndx, src) +@@ -102,7 +96,8 @@ } /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Sym, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf32_Sym) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Sym) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; -@@ -125,7 +119,7 @@ gelf_update_sym (data, ndx, src) +@@ -125,7 +120,8 @@ else { /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (Elf64_Sym) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Sym, &data_scn->d)) ++ if (INVALID_NDX (ndx, Elf64_Sym) ++ || unlikely ((ndx + 1) * sizeof (Elf64_Sym) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_update_syminfo.c -+++ elfutils/libelf/gelf_update_syminfo.c -@@ -1,5 +1,5 @@ - /* Update additional symbol information in symbol table at the given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -72,12 +72,6 @@ gelf_update_syminfo (data, ndx, src) +--- a/libelf/gelf_update_syminfo.c ++++ b/libelf/gelf_update_syminfo.c +@@ -72,12 +72,6 @@ if (data == NULL) return 0; @@ -793,26 +753,19 @@ are therefore not in the git repository). if (unlikely (data_scn->d.d_type != ELF_T_SYMINFO)) { /* The type of the data better should match. */ -@@ -93,7 +87,7 @@ gelf_update_syminfo (data, ndx, src) +@@ -93,7 +87,8 @@ rwlock_wrlock (scn->elf->lock); /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, GElf_Syminfo, &data_scn->d)) ++ if (INVALID_NDX (ndx, GElf_Syminfo) ++ || unlikely ((ndx + 1) * sizeof (GElf_Syminfo) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_update_symshndx.c -+++ elfutils/libelf/gelf_update_symshndx.c -@@ -1,6 +1,6 @@ - /* Update symbol information and section index in symbol table at the - given index. -- Copyright (C) 2000, 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2000-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2000. - -@@ -77,12 +77,6 @@ gelf_update_symshndx (symdata, shndxdata +--- a/libelf/gelf_update_symshndx.c ++++ b/libelf/gelf_update_symshndx.c +@@ -77,12 +77,6 @@ if (symdata == NULL) return 0; @@ -825,57 +778,56 @@ are therefore not in the git repository). if (unlikely (symdata_scn->d.d_type != ELF_T_SYM)) { /* The type of the data better should match. */ -@@ -128,7 +122,7 @@ gelf_update_symshndx (symdata, shndxdata +@@ -128,7 +122,8 @@ } /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf32_Sym, &symdata_scn->d)) ++ if (INVALID_NDX (ndx, Elf32_Sym) ++ || unlikely ((ndx + 1) * sizeof (Elf32_Sym) > symdata_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; -@@ -151,7 +145,7 @@ gelf_update_symshndx (symdata, shndxdata +@@ -151,7 +146,8 @@ else { /* Check whether we have to resize the data buffer. */ - if (unlikely ((ndx + 1) * sizeof (Elf64_Sym) > symdata_scn->d.d_size)) -+ if (INVALID_NDX (ndx, Elf64_Sym, &symdata_scn->d)) ++ if (INVALID_NDX (ndx, Elf64_Sym) ++ || unlikely ((ndx + 1) * sizeof (Elf64_Sym) > symdata_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); goto out; ---- elfutils/libelf/gelf_update_versym.c -+++ elfutils/libelf/gelf_update_versym.c -@@ -1,5 +1,5 @@ - /* Update symbol version information. -- Copyright (C) 2001, 2002 Red Hat, Inc. -+ Copyright (C) 2001-2009 Red Hat, Inc. - This file is part of Red Hat elfutils. - Written by Ulrich Drepper , 2001. - -@@ -75,8 +75,7 @@ gelf_update_versym (data, ndx, src) +--- a/libelf/gelf_update_versym.c ++++ b/libelf/gelf_update_versym.c +@@ -75,7 +75,7 @@ assert (sizeof (GElf_Versym) == sizeof (Elf64_Versym)); /* Check whether we have to resize the data buffer. */ - if (unlikely (ndx < 0) -- || unlikely ((ndx + 1) * sizeof (GElf_Versym) > data_scn->d.d_size)) -+ if (INVALID_NDX (ndx, GElf_Versym, &data_scn->d)) ++ if (INVALID_NDX (ndx, GElf_Versym) + || unlikely ((ndx + 1) * sizeof (GElf_Versym) > data_scn->d.d_size)) { __libelf_seterrno (ELF_E_INVALID_INDEX); - return 0; ---- elfutils/libelf/libelfP.h -+++ elfutils/libelf/libelfP.h -@@ -608,4 +608,8 @@ extern uint32_t __libelf_crc32 (uint32_t +--- a/libelf/libelfP.h ++++ b/libelf/libelfP.h +@@ -606,4 +606,13 @@ /* Align offset to 4 bytes as needed for note name and descriptor data. */ #define NOTE_ALIGN(n) (((n) + 3) & -4U) -+/* Convenience macro. */ -+#define INVALID_NDX(ndx, type, data) \ -+ unlikely ((data)->d_size / sizeof (type) <= (unsigned int) (ndx)) ++/* Convenience macro. Assumes int NDX and TYPE with size at least ++ 2 bytes. */ ++#if SIZE_MAX > 4294967295U ++# define INVALID_NDX(ndx, type) unlikely (ndx < 0) ++#else ++# define INVALID_NDX(ndx, type) \ ++ unlikely ((unsigned int) (ndx) >= SIZE_MAX / sizeof (type)) ++#endif + #endif /* libelfP.h */ ---- elfutils/src/ChangeLog -+++ elfutils/src/ChangeLog -@@ -1548,6 +1548,16 @@ +--- a/src/ChangeLog ++++ b/src/ChangeLog +@@ -1455,6 +1455,16 @@ object symbols or symbols with unknown type. (check_rel): Likewise. @@ -892,7 +844,7 @@ are therefore not in the git repository). 2005-06-08 Roland McGrath * readelf.c (print_ops): Add consts. -@@ -1593,6 +1603,19 @@ +@@ -1505,6 +1515,19 @@ * readelf.c (dwarf_tag_string): Add new tags. @@ -912,20 +864,19 @@ are therefore not in the git repository). 2005-05-08 Roland McGrath * strip.c (handle_elf): Don't translate hash and versym data formats, ---- elfutils/src/elflint.c -+++ elfutils/src/elflint.c -@@ -131,6 +131,10 @@ static uint32_t shstrndx; +--- a/src/elflint.c ++++ b/src/elflint.c +@@ -130,6 +130,9 @@ /* Array to count references in section groups. */ static int *scnref; -+/* Numbers of sections and program headers. */ ++/* Number of sections. */ +static unsigned int shnum; -+static unsigned int phnum; + int main (int argc, char *argv[]) -@@ -319,10 +323,19 @@ section_name (Ebl *ebl, int idx) +@@ -318,10 +321,19 @@ { GElf_Shdr shdr_mem; GElf_Shdr *shdr; @@ -946,19 +897,18 @@ are therefore not in the git repository). } -@@ -344,11 +357,6 @@ static const int valid_e_machine[] = +@@ -343,10 +355,6 @@ (sizeof (valid_e_machine) / sizeof (valid_e_machine[0])) --/* Numbers of sections and program headers. */ +-/* Number of sections. */ -static unsigned int shnum; --static unsigned int phnum; - - static void check_elf_header (Ebl *ebl, GElf_Ehdr *ehdr, size_t size) { -@@ -632,7 +640,8 @@ section [%2d] '%s': symbol table cannot +@@ -612,7 +620,8 @@ } } @@ -968,7 +918,7 @@ are therefore not in the git repository). ERROR (gettext ("\ section [%2u] '%s': entry size is does not match ElfXX_Sym\n"), idx, section_name (ebl, idx)); -@@ -670,7 +679,7 @@ section [%2d] '%s': XINDEX for zeroth en +@@ -650,7 +659,7 @@ xndxscnidx, section_name (ebl, xndxscnidx)); } @@ -977,7 +927,7 @@ are therefore not in the git repository). { sym = gelf_getsymshndx (data, xndxdata, cnt, &sym_mem, &xndx); if (sym == NULL) -@@ -690,7 +699,8 @@ section [%2d] '%s': symbol %zu: invalid +@@ -670,7 +679,8 @@ else { name = elf_strptr (ebl->elf, shdr->sh_link, sym->st_name); @@ -987,7 +937,7 @@ are therefore not in the git repository). } if (sym->st_shndx == SHN_XINDEX) -@@ -1038,9 +1048,11 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e +@@ -1018,9 +1028,11 @@ { GElf_Shdr rcshdr_mem; const GElf_Shdr *rcshdr = gelf_getshdr (scn, &rcshdr_mem); @@ -1001,7 +951,7 @@ are therefore not in the git repository). { /* Found the dynamic section. Look through it. */ Elf_Data *d = elf_getdata (scn, NULL); -@@ -1050,7 +1062,9 @@ is_rel_dyn (Ebl *ebl, const GElf_Ehdr *e +@@ -1030,7 +1042,9 @@ { GElf_Dyn dyn_mem; GElf_Dyn *dyn = gelf_getdyn (d, cnt, &dyn_mem); @@ -1012,7 +962,7 @@ are therefore not in the git repository). if (dyn->d_tag == DT_RELCOUNT) { -@@ -1064,7 +1078,9 @@ section [%2d] '%s': DT_RELCOUNT used for +@@ -1044,7 +1058,9 @@ /* Does the number specified number of relative relocations exceed the total number of relocations? */ @@ -1023,7 +973,7 @@ are therefore not in the git repository). ERROR (gettext ("\ section [%2d] '%s': DT_RELCOUNT value %d too high for this section\n"), idx, section_name (ebl, idx), -@@ -1224,7 +1240,8 @@ section [%2d] '%s': no relocations for m +@@ -1204,7 +1220,8 @@ } } @@ -1033,7 +983,7 @@ are therefore not in the git repository). ERROR (gettext (reltype == ELF_T_RELA ? "\ section [%2d] '%s': section entry size does not match ElfXX_Rela\n" : "\ section [%2d] '%s': section entry size does not match ElfXX_Rel\n"), -@@ -1447,7 +1464,8 @@ check_rela (Ebl *ebl, GElf_Ehdr *ehdr, G +@@ -1427,7 +1444,8 @@ Elf_Data *symdata = elf_getdata (symscn, NULL); enum load_state state = state_undecided; @@ -1043,7 +993,7 @@ are therefore not in the git repository). { GElf_Rela rela_mem; GElf_Rela *rela = gelf_getrela (data, cnt, &rela_mem); -@@ -1497,7 +1515,8 @@ check_rel (Ebl *ebl, GElf_Ehdr *ehdr, GE +@@ -1477,7 +1495,8 @@ Elf_Data *symdata = elf_getdata (symscn, NULL); enum load_state state = state_undecided; @@ -1053,7 +1003,7 @@ are therefore not in the git repository). { GElf_Rel rel_mem; GElf_Rel *rel = gelf_getrel (data, cnt, &rel_mem); -@@ -1600,7 +1619,8 @@ section [%2d] '%s': referenced as string +@@ -1580,7 +1599,8 @@ shdr->sh_link, section_name (ebl, shdr->sh_link), idx, section_name (ebl, idx)); @@ -1063,7 +1013,7 @@ are therefore not in the git repository). ERROR (gettext ("\ section [%2d] '%s': section entry size does not match ElfXX_Dyn\n"), idx, section_name (ebl, idx)); -@@ -1610,7 +1630,7 @@ section [%2d] '%s': section entry size d +@@ -1590,7 +1610,7 @@ idx, section_name (ebl, idx)); bool non_null_warned = false; @@ -1072,7 +1022,7 @@ are therefore not in the git repository). { GElf_Dyn dyn_mem; GElf_Dyn *dyn = gelf_getdyn (data, cnt, &dyn_mem); -@@ -1891,6 +1911,8 @@ section [%2d] '%s': entry size does not +@@ -1871,6 +1891,8 @@ idx, section_name (ebl, idx)); if (symshdr != NULL @@ -1081,7 +1031,7 @@ are therefore not in the git repository). && (shdr->sh_size / shdr->sh_entsize < symshdr->sh_size / symshdr->sh_entsize)) ERROR (gettext ("\ -@@ -1917,6 +1939,12 @@ section [%2d] '%s': extended section ind +@@ -1897,6 +1919,12 @@ } Elf_Data *data = elf_getdata (elf_getscn (ebl->elf, idx), NULL); @@ -1094,7 +1044,7 @@ are therefore not in the git repository). if (*((Elf32_Word *) data->d_buf) != 0) ERROR (gettext ("symbol 0 should have zero extended section index\n")); -@@ -1959,7 +1987,7 @@ section [%2d] '%s': hash table section i +@@ -1939,7 +1967,7 @@ size_t maxidx = nchain; @@ -1103,7 +1053,7 @@ are therefore not in the git repository). { size_t symsize = symshdr->sh_size / symshdr->sh_entsize; -@@ -1970,18 +1998,28 @@ section [%2d] '%s': hash table section i +@@ -1950,18 +1978,28 @@ maxidx = symsize; } @@ -1134,7 +1084,7 @@ are therefore not in the git repository). } -@@ -2011,18 +2049,28 @@ section [%2d] '%s': hash table section i +@@ -1991,18 +2029,28 @@ maxidx = symsize; } @@ -1166,7 +1116,7 @@ are therefore not in the git repository). } -@@ -2047,7 +2095,7 @@ section [%2d] '%s': bitmask size not pow +@@ -2027,7 +2075,7 @@ if (shdr->sh_size < (4 + bitmask_words + nbuckets) * sizeof (Elf32_Word)) { ERROR (gettext ("\ @@ -1175,7 +1125,7 @@ are therefore not in the git repository). idx, section_name (ebl, idx), (long int) shdr->sh_size, (long int) ((4 + bitmask_words + nbuckets) * sizeof (Elf32_Word))); return; -@@ -2719,8 +2767,9 @@ section [%2d] '%s' refers in sh_link to +@@ -2699,8 +2747,9 @@ /* The number of elements in the version symbol table must be the same as the number of symbols. */ @@ -1187,9 +1137,9 @@ are therefore not in the git repository). ERROR (gettext ("\ section [%2d] '%s' has different number of entries than symbol table [%2d] '%s'\n"), idx, section_name (ebl, idx), ---- elfutils/src/readelf.c -+++ elfutils/src/readelf.c -@@ -1171,6 +1171,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G +--- a/src/readelf.c ++++ b/src/readelf.c +@@ -1146,6 +1146,8 @@ Elf32_Word *grpref = (Elf32_Word *) data->d_buf; GElf_Sym sym_mem; @@ -1198,7 +1148,7 @@ are therefore not in the git repository). printf ((grpref[0] & GRP_COMDAT) ? ngettext ("\ \nCOMDAT section group [%2zu] '%s' with signature '%s' contains %zu entry:\n", -@@ -1183,8 +1185,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G +@@ -1158,8 +1160,8 @@ data->d_size / sizeof (Elf32_Word) - 1), elf_ndxscn (scn), elf_strptr (ebl->elf, shstrndx, shdr->sh_name), @@ -1209,7 +1159,7 @@ are therefore not in the git repository). ?: gettext (""), data->d_size / sizeof (Elf32_Word) - 1); -@@ -1335,7 +1337,8 @@ static void +@@ -1310,7 +1312,8 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr) { int class = gelf_getclass (ebl->elf); @@ -1219,7 +1169,7 @@ are therefore not in the git repository). Elf_Data *data; size_t cnt; size_t shstrndx; -@@ -1350,6 +1353,11 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, +@@ -1325,6 +1328,11 @@ error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1231,7 +1181,7 @@ are therefore not in the git repository). printf (ngettext ("\ \nDynamic segment contains %lu entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ -@@ -1359,9 +1367,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn, +@@ -1334,9 +1342,7 @@ class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (int) shdr->sh_link, @@ -1242,7 +1192,7 @@ are therefore not in the git repository). fputs_unlocked (gettext (" Type Value\n"), stdout); for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) -@@ -1944,6 +1950,13 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G +@@ -1919,6 +1925,13 @@ error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1256,7 +1206,7 @@ are therefore not in the git repository). /* Now we can compute the number of entries in the section. */ unsigned int nsyms = data->d_size / (class == ELFCLASS32 ? sizeof (Elf32_Sym) -@@ -1954,15 +1967,12 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G +@@ -1929,15 +1942,12 @@ nsyms), (unsigned int) elf_ndxscn (scn), elf_strptr (ebl->elf, shstrndx, shdr->sh_name), nsyms); @@ -1273,7 +1223,7 @@ are therefore not in the git repository). fputs_unlocked (class == ELFCLASS32 ? gettext ("\ -@@ -2198,7 +2208,13 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, +@@ -2173,7 +2183,13 @@ error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1288,7 +1238,7 @@ are therefore not in the git repository). printf (ngettext ("\ \nVersion needs section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ -@@ -2209,9 +2225,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn, +@@ -2184,9 +2200,7 @@ class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1299,7 +1249,7 @@ are therefore not in the git repository). unsigned int offset = 0; for (int cnt = shdr->sh_info; --cnt >= 0; ) -@@ -2264,8 +2278,14 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G +@@ -2239,8 +2253,14 @@ error (EXIT_FAILURE, 0, gettext ("cannot get section header string table index")); @@ -1315,7 +1265,7 @@ are therefore not in the git repository). printf (ngettext ("\ \nVersion definition section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ -@@ -2277,9 +2297,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G +@@ -2252,9 +2272,7 @@ class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1326,7 +1276,7 @@ are therefore not in the git repository). unsigned int offset = 0; for (int cnt = shdr->sh_info; --cnt >= 0; ) -@@ -2541,8 +2559,14 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G +@@ -2516,8 +2534,14 @@ filename = NULL; } @@ -1342,7 +1292,7 @@ are therefore not in the git repository). printf (ngettext ("\ \nVersion symbols section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'", "\ -@@ -2554,9 +2578,7 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G +@@ -2529,9 +2553,7 @@ class == ELFCLASS32 ? 10 : 18, shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1353,7 +1303,7 @@ are therefore not in the git repository). /* Now we can finally look at the actual contents of this section. */ for (unsigned int cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt) -@@ -2608,7 +2630,17 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, +@@ -2583,7 +2605,17 @@ for (Elf32_Word cnt = 0; cnt < nbucket; ++cnt) ++counts[lengths[cnt]]; @@ -1372,7 +1322,7 @@ are therefore not in the git repository). printf (ngettext ("\ \nHistogram for bucket list length in section [%2u] '%s' (total of %d bucket):\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n", "\ -@@ -2621,9 +2653,7 @@ print_hash_info (Ebl *ebl, Elf_Scn *scn, +@@ -2596,9 +2628,7 @@ shdr->sh_addr, shdr->sh_offset, (unsigned int) shdr->sh_link, @@ -1383,7 +1333,7 @@ are therefore not in the git repository). if (extrastr != NULL) fputs (extrastr, stdout); -@@ -4265,6 +4295,16 @@ print_debug_aranges_section (Dwfl_Module +@@ -4231,6 +4261,16 @@ return; } @@ -1400,9 +1350,9 @@ are therefore not in the git repository). printf (ngettext ("\ \nDWARF section [%2zu] '%s' at offset %#" PRIx64 " contains %zu entry:\n", "\ ---- elfutils/src/strip.c -+++ elfutils/src/strip.c -@@ -545,6 +545,11 @@ handle_elf (int fd, Elf *elf, const char +--- a/src/strip.c ++++ b/src/strip.c +@@ -560,6 +560,11 @@ goto fail_close; } @@ -1414,7 +1364,7 @@ are therefore not in the git repository). /* Storage for section information. We leave room for two more entries since we unconditionally create a section header string table. Maybe some weird tool created an ELF file without one. -@@ -566,7 +571,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -581,7 +586,7 @@ { /* This should always be true (i.e., there should not be any holes in the numbering). */ @@ -1423,7 +1373,7 @@ are therefore not in the git repository). shdr_info[cnt].scn = scn; -@@ -579,6 +584,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -594,6 +599,7 @@ shdr_info[cnt].shdr.sh_name); if (shdr_info[cnt].name == NULL) { @@ -1431,7 +1381,7 @@ are therefore not in the git repository). error (0, 0, gettext ("illformed file '%s'"), fname); goto fail_close; } -@@ -588,6 +594,8 @@ handle_elf (int fd, Elf *elf, const char +@@ -603,6 +609,8 @@ /* Remember the shdr.sh_link value. */ shdr_info[cnt].old_sh_link = shdr_info[cnt].shdr.sh_link; @@ -1440,7 +1390,7 @@ are therefore not in the git repository). /* Sections in files other than relocatable object files which are not loaded can be freely moved by us. In relocatable -@@ -600,7 +608,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -615,7 +623,7 @@ appropriate reference. */ if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_SYMTAB_SHNDX)) { @@ -1449,7 +1399,7 @@ are therefore not in the git repository). shdr_info[shdr_info[cnt].shdr.sh_link].symtab_idx = cnt; } else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GROUP)) -@@ -617,7 +625,12 @@ handle_elf (int fd, Elf *elf, const char +@@ -632,7 +640,12 @@ for (inner = 1; inner < shdr_info[cnt].data->d_size / sizeof (Elf32_Word); ++inner) @@ -1462,7 +1412,7 @@ are therefore not in the git repository). if (inner == 1 || (inner == 2 && (grpref[0] & GRP_COMDAT) == 0)) /* If the section group contains only one element and this -@@ -628,7 +641,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -643,7 +656,7 @@ } else if (unlikely (shdr_info[cnt].shdr.sh_type == SHT_GNU_versym)) { @@ -1471,7 +1421,7 @@ are therefore not in the git repository). shdr_info[shdr_info[cnt].shdr.sh_link].version_idx = cnt; } -@@ -636,7 +649,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -651,7 +664,7 @@ discarded right away. */ if ((shdr_info[cnt].shdr.sh_flags & SHF_GROUP) != 0) { @@ -1480,7 +1430,7 @@ are therefore not in the git repository). if (shdr_info[shdr_info[cnt].group_idx].idx == 0) { -@@ -711,11 +724,15 @@ handle_elf (int fd, Elf *elf, const char +@@ -726,11 +739,15 @@ { /* If a relocation section is marked as being removed make sure the section it is relocating is removed, too. */ @@ -1498,7 +1448,7 @@ are therefore not in the git repository). if (shdr_info[cnt].idx == 1) { -@@ -742,7 +759,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -757,7 +774,7 @@ if (shdr_info[cnt].symtab_idx != 0 && shdr_info[shdr_info[cnt].symtab_idx].data == NULL) { @@ -1507,7 +1457,7 @@ are therefore not in the git repository). shdr_info[shdr_info[cnt].symtab_idx].data = elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn, -@@ -782,6 +799,9 @@ handle_elf (int fd, Elf *elf, const char +@@ -797,6 +814,9 @@ else if (scnidx == SHN_XINDEX) scnidx = xndx; @@ -1517,7 +1467,7 @@ are therefore not in the git repository). if (shdr_info[scnidx].idx == 0) /* This symbol table has a real symbol in a discarded section. So preserve the -@@ -812,12 +832,16 @@ handle_elf (int fd, Elf *elf, const char +@@ -827,12 +847,16 @@ } /* Handle references through sh_info. */ @@ -1536,7 +1486,7 @@ are therefore not in the git repository). /* Mark the section as investigated. */ shdr_info[cnt].idx = 2; -@@ -956,7 +980,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -971,7 +995,7 @@ error (EXIT_FAILURE, 0, gettext ("while generating output file: %s"), elf_errmsg (-1)); @@ -1545,7 +1495,7 @@ are therefore not in the git repository). /* Add this name to the section header string table. */ shdr_info[cnt].se = ebl_strtabadd (shst, shdr_info[cnt].name, 0); -@@ -993,7 +1017,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1008,7 +1032,7 @@ error (EXIT_FAILURE, 0, gettext ("while create section header section: %s"), elf_errmsg (-1)); @@ -1554,7 +1504,7 @@ are therefore not in the git repository). shdr_info[cnt].data = elf_newdata (shdr_info[cnt].newscn); if (shdr_info[cnt].data == NULL) -@@ -1049,7 +1073,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1064,7 +1088,7 @@ error (EXIT_FAILURE, 0, gettext ("while create section header section: %s"), elf_errmsg (-1)); @@ -1563,7 +1513,7 @@ are therefore not in the git repository). /* Finalize the string table and fill in the correct indices in the section headers. */ -@@ -1139,20 +1163,20 @@ handle_elf (int fd, Elf *elf, const char +@@ -1154,20 +1178,20 @@ shndxdata = elf_getdata (shdr_info[shdr_info[cnt].symtab_idx].scn, NULL); @@ -1587,7 +1537,7 @@ are therefore not in the git repository). >= shdr_info[cnt].data->d_size / elsize); } -@@ -1207,7 +1231,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1222,7 +1246,7 @@ sec = shdr_info[sym->st_shndx].idx; else { @@ -1596,7 +1546,7 @@ are therefore not in the git repository). sec = shdr_info[xshndx].idx; } -@@ -1228,7 +1252,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1243,7 +1267,7 @@ nxshndx = sec; } @@ -1605,7 +1555,7 @@ are therefore not in the git repository). if ((inner != destidx || nshndx != sym->st_shndx || (shndxdata != NULL && nxshndx != xshndx)) -@@ -1252,7 +1276,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1267,7 +1291,7 @@ || shdr_info[cnt].debug_data == NULL) /* This is a section symbol for a section which has been removed. */ @@ -1614,7 +1564,7 @@ are therefore not in the git repository). } if (destidx != inner) -@@ -1439,11 +1463,11 @@ handle_elf (int fd, Elf *elf, const char +@@ -1454,11 +1478,11 @@ { GElf_Sym sym_mem; GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem); @@ -1628,7 +1578,7 @@ are therefore not in the git repository). size_t hidx = elf_hash (name) % nbucket; if (bucket[hidx] == 0) -@@ -1462,7 +1486,7 @@ handle_elf (int fd, Elf *elf, const char +@@ -1477,7 +1501,7 @@ else { /* Alpha and S390 64-bit use 64-bit SHT_HASH entries. */ @@ -1637,7 +1587,7 @@ are therefore not in the git repository). == sizeof (Elf64_Xword)); Elf64_Xword *bucket = (Elf64_Xword *) hashd->d_buf; -@@ -1493,11 +1517,11 @@ handle_elf (int fd, Elf *elf, const char +@@ -1508,11 +1532,11 @@ { GElf_Sym sym_mem; GElf_Sym *sym = gelf_getsym (symd, inner, &sym_mem); diff --git a/elfutils-suse-10.3-fixes.diff b/elfutils-suse-10.3-fixes.diff new file mode 100644 index 0000000..f0fe313 --- /dev/null +++ b/elfutils-suse-10.3-fixes.diff @@ -0,0 +1,154 @@ +--- libdwfl/Makefile.am-dist 2009-02-19 15:35:22.000000000 +0100 ++++ libdwfl/Makefile.am 2009-02-19 15:36:58.000000000 +0100 +@@ -33,7 +33,8 @@ + else + AM_CFLAGS = + endif +-AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 $(WEXTRA) -std=gnu99 ++AM_CFLAGS += -Wall -Wshadow -Wunused -Wformat=2 $(WEXTRA) -std=gnu99 ++AM_CFLAGS += -fgnu89-inline + INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ + -I$(srcdir)/../libdw -I.. -I$(srcdir)/../lib + VERSION = 1 +--- libdwfl/link_map.c-dist 2009-02-15 23:39:44.000000000 +0100 ++++ libdwfl/link_map.c 2009-02-19 15:36:58.000000000 +0100 +@@ -75,10 +75,10 @@ + /* Examine an auxv data block and determine its format. + Return true iff we figured it out. */ + static bool +-auxv_format_probe (const void *auxv, size_t size, ++auxv_format_probe (void *auxv, size_t size, + uint_fast8_t *elfclass, uint_fast8_t *elfdata) + { +- const union ++ union + { + char buf[size]; + Elf32_auxv_t a32[size / sizeof (Elf32_auxv_t)]; +@@ -301,7 +301,7 @@ report_r_debug (uint_fast8_t elfclass, u + return true; + } + +- const union ++ union + { + Elf32_Addr a32[n]; + Elf64_Addr a64[n]; +@@ -568,7 +568,7 @@ consider_executable (Dwfl_Module *mod, G + d_val_vaddr, buffer_available, + memory_callback_arg)) + { +- const union ++ union + { + Elf32_Addr a32; + Elf64_Addr a64; +@@ -626,10 +626,11 @@ find_executable (Dwfl *dwfl, GElf_Addr a + + + int +-dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size, ++dwfl_link_map_report (Dwfl *dwfl, const void *_auxv, size_t auxv_size, + Dwfl_Memory_Callback *memory_callback, + void *memory_callback_arg) + { ++ void *auxv = (void *)_auxv; + GElf_Addr r_debug_vaddr = 0; + + uint_fast8_t elfclass = ELFCLASSNONE; +@@ -644,7 +645,7 @@ dwfl_link_map_report (Dwfl *dwfl, const + + #define AUXV_SCAN(NN, BL) do \ + { \ +- const Elf##NN##_auxv_t *av = auxv; \ ++ Elf##NN##_auxv_t *av = auxv; \ + for (size_t i = 0; i < auxv_size / sizeof av[0]; ++i) \ + { \ + Elf##NN##_Addr val = BL##NN (av[i].a_un.a_val); \ +@@ -718,7 +719,7 @@ dwfl_link_map_report (Dwfl *dwfl, const + (&out, &in, elfdata) != NULL)) + { + /* We are looking for PT_DYNAMIC. */ +- const union ++ union + { + Elf32_Phdr p32[phnum]; + Elf64_Phdr p64[phnum]; +@@ -806,7 +807,7 @@ dwfl_link_map_report (Dwfl *dwfl, const + (&out, &in, elfdata) != NULL)) + { + /* We are looking for PT_DYNAMIC. */ +- const union ++ union + { + Elf32_Dyn d32[dyn_filesz / sizeof (Elf32_Dyn)]; + Elf64_Dyn d64[dyn_filesz / sizeof (Elf64_Dyn)]; +--- libdw/Makefile.am-dist 2009-02-19 15:35:22.000000000 +0100 ++++ libdw/Makefile.am 2009-02-19 15:36:58.000000000 +0100 +@@ -35,6 +35,7 @@ + AM_CFLAGS += -fpic + endif + AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 $(WEXTRA) -std=gnu99 ++AM_CFLAGS += -fgnu89-inline + INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib + VERSION = 1 + +--- libdw/libdw.h-dist 2008-12-10 23:21:29.000000000 +0100 ++++ libdw/libdw.h 2009-02-19 15:36:58.000000000 +0100 +@@ -67,7 +67,7 @@ + #ifdef __GNUC_STDC_INLINE__ + # define __libdw_extern_inline extern __inline __attribute__ ((__gnu_inline__)) + #else +-# define __libdw_extern_inline extern __inline ++# define __libdw_extern_inline extern __inline __attribute__ ((gnu_inline)) + #endif + + +--- src/Makefile.am-dist 2009-02-19 15:35:22.000000000 +0100 ++++ src/Makefile.am 2009-02-19 15:37:25.000000000 +0100 +@@ -37,6 +37,8 @@ + $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \ + $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(CFLAGS_$(*F)) + ++AM_CFLAGS += -fgnu89-inline ++ + INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ + -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \ + -I$(srcdir)/../libasm -I$(srcdir)/../lib -I.. +--- src/ldgeneric.c-dist 2008-12-10 23:21:30.000000000 +0100 ++++ src/ldgeneric.c 2009-02-19 15:36:58.000000000 +0100 +@@ -63,6 +63,14 @@ struct unw_eh_frame_hdr + }; + #define EH_FRAME_HDR_VERSION 1 + ++static inline int popcount(unsigned int val) ++{ ++ int count = 0; ++ for (; val; val >>= 1) ++ if (val & 1) ++ count++; ++ return count; ++} + + /* Prototypes for local functions. */ + static const char **ld_generic_lib_extensions (struct ld_state *) +@@ -5830,7 +5838,7 @@ cannot create dynamic symbol table for o + + /* We need one more array which contains the hash codes of the + symbol names. */ +- hashcodes = (Elf32_Word *) xcalloc (__builtin_popcount ((int) ld_state.hash_style) ++ hashcodes = (Elf32_Word *) xcalloc (popcount ((int) ld_state.hash_style) + * nsym_dyn_allocated, + sizeof (Elf32_Word)); + gnuhashcodes = hashcodes; +--- backends/ia64_retval.c-dist 2008-12-10 23:21:28.000000000 +0100 ++++ backends/ia64_retval.c 2009-02-19 15:36:58.000000000 +0100 +@@ -96,7 +96,7 @@ hfa_type (Dwarf_Die *typedie, const Dwar + If we find a datum that's not the same FP type as the first datum, punt. + If we count more than eight total homogeneous FP data, punt. */ + +- inline int hfa (const Dwarf_Op *loc, int nregs) ++ inline __attribute__((gnu_inline)) int hfa (const Dwarf_Op *loc, int nregs) + { + if (fpregs_used == 0) + *locp = loc; diff --git a/elfutils.changes b/elfutils.changes index f58e5ee..f7d392a 100644 --- a/elfutils.changes +++ b/elfutils.changes @@ -1,50 +1,3 @@ -------------------------------------------------------------------- -Tue May 11 20:01:23 UTC 2010 - tonyj@novell.com - -- update to version 0.147 (fix bnc#588293) -- dropped patches for 10.3 and older -- dropped elfutils-0.97-ftruncate-mmap-fix, libelf-ignore-NOBITS, test and - build patches. According to jbl these were mistakenly checked in from - home:janblunck:debuginfo:libs/elfutils and the purpose of this project is - no longer known. Absense of any patch header makes confirmation difficult. - -- Upstream changelog: - 0.147 - - libdw: Fixes in CFI handling, best possible handling of bogus CFA - ops. - - libdwfl: Ignore R_*_NONE relocs, works around old (binutils) ld -r - bugs. - - 0.146 - - libdwfl: New function dwfl_core_file_report. - - 0.145 - - Fix build with --disable-dependency-tracking. - - Fix build with most recent glibc headers. - - libelf: More robust to bogus section headers. - - libdw: Fix CFI decoding. - - libdwfl: Fix address bias returned by CFI accessors. Fix core - file module layout identification. - - readelf: Fix CFI decoding. - - 0.144 - - libelf: New function elf_getphdrnum. Now support using more than - 65536 program headers in a file. - - libdw: New function dwarf_aggregate_size for computing (constant) - type sizes, including array_type cases with nontrivial - calculation. - - readelf: Don't give errors for missing info under -a. - Handle Linux "VMCOREINFO" notes under -n. - - 0.143 - - libdw: Various convenience functions for individual attributes now - use dwarf_attr_integrate to look up indirect inherited - attributes. Location expression handling now supports - DW_OP_implicit_value. - - libdwfl: Support automatic decompression of files in XZ format, - and of Linux kernel images made with bzip2 or LZMA (as well - as gzip). - ------------------------------------------------------------------- Wed Feb 10 12:21:51 CET 2010 - rguenther@suse.de diff --git a/elfutils.spec b/elfutils.spec index 04aef67..05a8f66 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,5 +1,5 @@ # -# spec file for package elfutils (Version 0.147) +# spec file for package elfutils (Version 0.142) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -20,21 +20,26 @@ Name: elfutils License: GPLv2+ -Version: 0.147 -Release: 0 +Version: 0.142 +Release: 4 Summary: Higher-level library to access ELF Group: System/Libraries Url: http://elfutils.fedorahosted.org -Source: elfutils-%{version}.tar.bz2 +Source: elfutils-%{version}-no-osl.tar.bz2 Source2: baselibs.conf -Patch1: elfutils-portability.patch -Patch2: elfutils-robustify.patch +Patch: elfutils-portability.patch +Patch1: elfutils-robustify.patch Patch3: elfutils-no-po-test-build.diff -Patch4: libebl-prototype-fix.diff -Patch5: elfutils-uninitialized.diff -Patch6: elfutils-0.137-dwarf-header-check-fix.diff +Patch7: libebl-prototype-fix.diff +Patch8: elfutils-0.97-ftruncate-mmap-fix.diff +Patch9: libelf-ignore-NOBITS-sh_offset.patch +Patch10: test.diff +Patch11: build.diff +Patch12: elfutils-old-scanf-fix.diff +Patch13: elfutils-suse-10.3-fixes.diff +Patch20: elfutils-0.137-dwarf-header-check-fix.diff +Patch21: elfutils-uninitialized.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: bison flex %description This package provides a higher-level library to access ELF files. This @@ -190,12 +195,23 @@ Authors: %prep %setup -q -n elfutils-%{version} +%patch -p1 %patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 +%patch3 +%patch7 +%patch8 -p1 +%patch9 -p1 +#%patch10 -p1 +%patch11 -p1 +%if %suse_version < 1100 +%patch12 +%endif +%if %suse_version == 1030 +# only 10.3 gcc has a problem +%patch13 +%endif +%patch20 -p1 +%patch21 %build autoreconf -fi @@ -206,7 +222,6 @@ make %{?jobs:-j%jobs}; make DESTDIR=$RPM_BUILD_ROOT install # remove unneeded files rm -f $RPM_BUILD_ROOT%{_libdir}/*.la -ls -lR $RPM_BUILD_ROOT%{_libdir}/libelf* %post -n libebl1 -p /sbin/ldconfig @@ -259,7 +274,7 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) %{_libdir}/libelf.so %{_libdir}/libelf.a -#%{_libdir}/libelf_pic.a +%{_libdir}/libelf_pic.a %{_includedir}/libelf.h %{_includedir}/gelf.h %{_includedir}/nlist.h diff --git a/libebl-prototype-fix.diff b/libebl-prototype-fix.diff index cb26571..ca8f74d 100644 --- a/libebl-prototype-fix.diff +++ b/libebl-prototype-fix.diff @@ -1,11 +1,5 @@ -From: unknown -Upstream: no -References: none - -Update from K&R to ANSI prototype. This fix should go upstream. - ---- elfutils/libebl/eblopenbackend.c-dist 2008-01-28 14:21:23.000000000 +0100 -+++ elfutils/libebl/eblopenbackend.c 2008-01-28 14:21:39.000000000 +0100 +--- libebl/eblopenbackend.c-dist 2008-01-28 14:21:23.000000000 +0100 ++++ libebl/eblopenbackend.c 2008-01-28 14:21:39.000000000 +0100 @@ -253,10 +253,7 @@ fill_defaults (Ebl *result) /* Find an appropriate backend for the file associated with ELF. */ @@ -18,8 +12,8 @@ Update from K&R to ANSI prototype. This fix should go upstream. { Ebl *result; size_t cnt; ---- elfutils/lib/dynamicsizehash.c-dist 2008-01-28 14:25:32.000000000 +0100 -+++ elfutils/lib/dynamicsizehash.c 2008-01-28 14:25:52.000000000 +0100 +--- lib/dynamicsizehash.c-dist 2008-01-28 14:25:32.000000000 +0100 ++++ lib/dynamicsizehash.c 2008-01-28 14:25:52.000000000 +0100 @@ -65,10 +65,7 @@ diff --git a/libelf-ignore-NOBITS-sh_offset.patch b/libelf-ignore-NOBITS-sh_offset.patch new file mode 100644 index 0000000..4906a0c --- /dev/null +++ b/libelf-ignore-NOBITS-sh_offset.patch @@ -0,0 +1,24 @@ +--- + libelf/elf32_updatenull.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +Index: b/libelf/elf32_updatenull.c +=================================================================== +--- a/libelf/elf32_updatenull.c ++++ b/libelf/elf32_updatenull.c +@@ -331,10 +331,11 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf + + if (elf->flags & ELF_F_LAYOUT) + { +- size = MAX ((GElf_Word) size, +- shdr->sh_offset +- + (shdr->sh_type != SHT_NOBITS +- ? shdr->sh_size : 0)); ++ /* Even the sh_offset is only the "conceptual" possition ++ in the file. So completely ignore NOBITS sections. */ ++ if (shdr->sh_type != SHT_NOBITS) ++ size = MAX ((GElf_Word) size, ++ shdr->sh_offset + shdr->sh_size); + + /* The alignment must be a power of two. This is a + requirement from the ELF specification. Additionally diff --git a/test.diff b/test.diff new file mode 100644 index 0000000..3232765 --- /dev/null +++ b/test.diff @@ -0,0 +1,126 @@ +--- + libelf/elf32_updatenull.c | 35 +++++++++++++++++++++++++++++++---- + 1 file changed, 31 insertions(+), 4 deletions(-) + +Index: b/libelf/elf32_updatenull.c +=================================================================== +--- a/libelf/elf32_updatenull.c ++++ b/libelf/elf32_updatenull.c +@@ -55,6 +55,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -144,7 +145,7 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf + return -1; + + /* At least the ELF header is there. */ +- off_t size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1); ++ off_t size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1), old_size; + + /* Set the program header position. */ + if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL +@@ -166,9 +167,12 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf + { + /* The user is supposed to fill out e_phoff. Use it and + e_phnum to determine the maximum extend. */ ++ old_size = size; + size = MAX ((size_t) size, + ehdr->e_phoff + + elf_typesize (LIBELFBITS, ELF_T_PHDR, ehdr->e_phnum)); ++ fprintf(stderr, "e_phoff: old=%ld, new=%ld\n", (long) old_size, ++ (long) size); + } + else + { +@@ -176,8 +180,11 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf + elf_typesize (LIBELFBITS, ELF_T_EHDR, 1), + ehdr_flags); + ++ old_size = size; + /* We need no alignment here. */ + size += elf_typesize (LIBELFBITS, ELF_T_PHDR, ehdr->e_phnum); ++ fprintf(stderr, "e_phnum: old=%ld, new=%ld\n", (long) old_size, ++ (long) size); + } + } + +@@ -334,9 +341,13 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf + /* Even the sh_offset is only the "conceptual" possition + in the file. So completely ignore NOBITS sections. */ + if (shdr->sh_type != SHT_NOBITS) +- size = MAX ((GElf_Word) size, +- shdr->sh_offset + shdr->sh_size); +- ++ { ++ old_size = size; ++ size = MAX ((GElf_Word) size, ++ shdr->sh_offset + shdr->sh_size); ++ fprintf(stderr, "sh_offset: old=%ld, new=%ld\n", ++ (long) old_size, (long) size); ++ } + /* The alignment must be a power of two. This is a + requirement from the ELF specification. Additionally + we test for the alignment of the section being large +@@ -355,7 +366,11 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf + update_if_changed (shdr->sh_addralign, sh_align, + scn->shdr_flags); + ++ old_size = size; + size = (size + sh_align - 1) & ~(sh_align - 1); ++ fprintf(stderr, "sh_align: old=%ld, new=%ld\n", ++ (long) old_size, (long) size); ++ + int offset_changed = 0; + update_if_changed (shdr->sh_offset, (GElf_Word) size, + offset_changed); +@@ -373,8 +388,11 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf + update_if_changed (shdr->sh_size, (GElf_Word) offset, + changed); + ++ old_size = size; + if (shdr->sh_type != SHT_NOBITS) + size += offset; ++ fprintf(stderr, "sh_size: old=%ld, new=%ld\n", ++ (long) old_size, (long) size); + + scn->flags |= changed; + } +@@ -401,9 +419,12 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf + { + /* The user is supposed to fill out e_phoff. Use it and + e_phnum to determine the maximum extend. */ ++ old_size = size; + size = MAX ((GElf_Word) size, + (ehdr->e_shoff + + (elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum)))); ++ fprintf(stderr, "e_shoff: old=%ld, new=%ld\n", (long) old_size, ++ (long) size); + } + else + { +@@ -413,7 +434,10 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf + want to be surprised by architectures with less strict + alignment rules. */ + #define SHDR_ALIGN sizeof (ElfW2(LIBELFBITS,Off)) ++ old_size = size; + size = (size + SHDR_ALIGN - 1) & ~(SHDR_ALIGN - 1); ++ fprintf(stderr, "e_shoff(align): old=%ld, new=%ld\n", ++ (long) old_size, (long) size); + + update_if_changed (ehdr->e_shoff, (GElf_Word) size, elf->flags); + update_if_changed (ehdr->e_shentsize, +@@ -421,7 +445,10 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf + ehdr_flags); + + /* Account for the section header size. */ ++ old_size = size; + size += elf_typesize (LIBELFBITS, ELF_T_SHDR, shnum); ++ fprintf(stderr, "shnum: old=%ld, new=%ld\n", (long) old_size, ++ (long) size); + } + } +