Blame SOURCES/elfutils-portability.patch

64372c
--- elfutils/backends/ChangeLog
64372c
+++ elfutils/backends/ChangeLog
64372c
@@ -364,6 +364,10 @@
64372c
 	* ppc_attrs.c (ppc_check_object_attribute): Handle tag
64372c
 	GNU_Power_ABI_Struct_Return.
64372c
 
64372c
+2009-01-23  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* Makefile.am (libebl_%.so): Use $(LD_AS_NEEDED).
64372c
+
64372c
 2008-10-04  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and
64372c
@@ -691,6 +695,11 @@
64372c
 	* sparc_init.c: Likewise.
64372c
 	* x86_64_init.c: Likewise.
64372c
 
64372c
+2005-11-22  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* Makefile.am (LD_AS_NEEDED): New variable, substituted by configure.
64372c
+	(libebl_%.so rule): Use it in place of -Wl,--as-needed.
64372c
+
64372c
 2005-11-19  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
 	* ppc64_reloc.def: REL30 -> ADDR30.
64372c
@@ -713,6 +722,9 @@
64372c
 	* Makefile.am (uninstall): Don't try to remove $(pkgincludedir).
64372c
 	(CLEANFILES): Add libebl_$(m).so.
64372c
 
64372c
+	* Makefile.am (WEXTRA): New variable, substituted by configure.
64372c
+	(AM_CFLAGS): Use it in place of -Wextra.
64372c
+
64372c
 	* ppc_reloc.def: Update bits per Alan Modra <amodra@bigpond.net.au>.
64372c
 	* ppc64_reloc.def: Likewise.
64372c
 
64372c
--- elfutils/backends/Makefile.am
64372c
+++ elfutils/backends/Makefile.am
64372c
@@ -119,7 +119,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
64372c
 	$(LINK) -shared -o $(@:.map=.so) \
64372c
 		-Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
64372c
 		-Wl,--version-script,$(@:.so=.map) \
64372c
-		-Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw)
64372c
+		-Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw)
64372c
 	$(textrel_check)
64372c
 
64372c
 libebl_i386.so: $(cpu_i386)
64372c
--- elfutils/backends/Makefile.in
64372c
+++ elfutils/backends/Makefile.in
64372c
@@ -83,6 +83,7 @@ host_triplet = @host@
64372c
 DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \
64372c
 	$(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
64372c
 	$(noinst_HEADERS) ChangeLog
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
 subdir = backends
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
 am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
64372c
@@ -285,6 +286,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -316,6 +318,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = @VERSION@
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -378,11 +381,11 @@ zip_LIBS = @zip_LIBS@
64372c
 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
64372c
 	-I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
64372c
 	-I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
64372c
-	    $(if $($(*F)_no_Werror),,-Werror) \
64372c
-	    $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
64372c
-	    $($(*F)_CFLAGS)
64372c
-
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
+	$($(*F)_no_Werror),,-Werror) $(if \
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1)
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda $(foreach m,$(modules), libebl_$(m).map \
64372c
 	libebl_$(m).so $(am_libebl_$(m)_pic_a_OBJECTS))
64372c
@@ -885,7 +888,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
64372c
 	$(LINK) -shared -o $(@:.map=.so) \
64372c
 		-Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
64372c
 		-Wl,--version-script,$(@:.so=.map) \
64372c
-		-Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw)
64372c
+		-Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw)
64372c
 	$(textrel_check)
64372c
 
64372c
 libebl_i386.so: $(cpu_i386)
64372c
--- elfutils/ChangeLog
64372c
+++ elfutils/ChangeLog
64372c
@@ -148,6 +148,8 @@
64372c
 
64372c
 2012-01-24  Mark Wielaard  <mjw@redhat.com>
64372c
 
64372c
+	* configure.ac: Wrap AC_COMPILE_IFELSE sources in AC_LANG_SOURCE.
64372c
+
64372c
 	* COPYING: Fix address. Updated version from gnulib.
64372c
 
64372c
 2012-01-23  Mark Wielaard  <mjw@redhat.com>
64372c
@@ -166,6 +168,9 @@
64372c
 
64372c
 2011-10-08  Mike Frysinger  <vapier@gentoo.org>
64372c
 
64372c
+	* configure.ac (--disable-werror): Handle it, controlling BUILD_WERROR
64372c
+	automake option.
64372c
+
64372c
 	* configure.ac: Fix use of AC_ARG_ENABLE to handle $enableval correctly.
64372c
 
64372c
 2011-10-02  Ulrich Drepper  <drepper@gmail.com>
64372c
@@ -187,6 +192,10 @@
64372c
 
64372c
 	* configure.ac (LOCALEDIR, DATADIRNAME): Removed.
64372c
 
64372c
+2009-11-22  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* configure.ac: Use sed and expr instead of modern bash extensions.
64372c
+
64372c
 2009-09-21  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* configure.ac: Update for more modern autoconf.
64372c
@@ -195,6 +204,10 @@
64372c
 
64372c
 	* configure.ac (zip_LIBS): Check for liblzma too.
64372c
 
64372c
+2009-08-17  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* configure.ac: Check for -fgnu89-inline; add it to WEXTRA if it works.
64372c
+
64372c
 2009-04-19  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
 	* configure.ac (eu_version): Round down here, not in version.h macros.
64372c
@@ -206,6 +219,8 @@
64372c
 
64372c
 2009-01-23  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
+	* configure.ac: Check for __builtin_popcount.
64372c
+
64372c
 	* configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3.
64372c
 
64372c
 	* configure.ac (__thread check): Use AC_LINK_IFELSE, in case of
64372c
@@ -286,6 +301,10 @@
64372c
 	* configure.ac: Add dummy automake conditional to get dependencies
64372c
 	for non-generic linker right.  See src/Makefile.am.
64372c
 
64372c
+2005-11-22  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* configure.ac: Check for --as-needed linker option.
64372c
+
64372c
 2005-11-18  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
 	* Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable.
64372c
@@ -333,6 +352,17 @@
64372c
 	* Makefile.am (all_SUBDIRS): Add libdwfl.
64372c
 	* configure.ac: Write libdwfl/Makefile.
64372c
 
64372c
+2005-05-31  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* configure.ac (WEXTRA): Check for -Wextra and set this substitution.
64372c
+
64372c
+	* configure.ac: Check for struct stat st_?tim members.
64372c
+	* src/strip.c (process_file): Use st_?time if st_?tim are not there.
64372c
+
64372c
+	* configure.ac: Check for futimes function.
64372c
+	* src/strip.c (handle_elf) [! HAVE_FUTIMES]: Use utimes instead.
64372c
+	(handle_ar) [! HAVE_FUTIMES]: Likewise.
64372c
+
64372c
 2005-05-19  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
 	* configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros.
64372c
--- elfutils/config/ChangeLog
64372c
+++ elfutils/config/ChangeLog
64372c
@@ -58,6 +58,10 @@
64372c
 
64372c
 	* known-dwarf.awk: Use gawk.
64372c
 
64372c
+2011-10-08  Mike Frysinger  <vapier@gentoo.org>
64372c
+
64372c
+	* eu.am [BUILD_WERROR]: Conditionalize -Werror use on this.
64372c
+
64372c
 2010-07-02  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* elfutils.spec.in: Add more BuildRequires.
64372c
--- elfutils/config/eu.am
64372c
+++ elfutils/config/eu.am
64372c
@@ -1,6 +1,6 @@
64372c
 ## Common automake fragments for elfutils subdirectory makefiles.
64372c
 ##
64372c
-## Copyright (C) 2010, 2014 Red Hat, Inc.
64372c
+## Copyright (C) 2010-2011, 2014 Red Hat, Inc.
64372c
 ##
64372c
 ## This file is part of elfutils.
64372c
 ##
64372c
@@ -29,13 +29,21 @@
64372c
 ## not, see <http://www.gnu.org/licenses/>.
64372c
 ##
64372c
 
64372c
+WEXTRA = @WEXTRA@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
+
64372c
 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
64372c
 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
64372c
 	    $(if $($(*F)_no_Werror),,-Werror) \
64372c
-	    $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
64372c
+	    $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \
64372c
+	    $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
64372c
 	    $($(*F)_CFLAGS)
64372c
 
64372c
+if BUILD_WERROR
64372c
+AM_CFLAGS += $(if $($(*F)_no_Werror),,-Werror)
64372c
+endif
64372c
+
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 
64372c
 %.os: %.c %.o
64372c
--- elfutils/config/Makefile.in
64372c
+++ elfutils/config/Makefile.in
64372c
@@ -146,6 +146,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -177,6 +178,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = @VERSION@
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
--- elfutils/config.h.in
64372c
+++ elfutils/config.h.in
64372c
@@ -3,6 +3,9 @@
64372c
 /* Should ar and ranlib use -D behavior by default? */
64372c
 #undef DEFAULT_AR_DETERMINISTIC
64372c
 
64372c
+/* Have __builtin_popcount. */
64372c
+#undef HAVE_BUILTIN_POPCOUNT
64372c
+
64372c
 /* Define to 1 if you have the <inttypes.h> header file. */
64372c
 #undef HAVE_INTTYPES_H
64372c
 
64372c
@@ -99,4 +102,7 @@
64372c
 /* Define for large files, on AIX-style hosts. */
64372c
 #undef _LARGE_FILES
64372c
 
64372c
+/* Stubbed out if missing compiler support. */
64372c
+#undef __thread
64372c
+
64372c
 #include <eu-config.h>
64372c
--- elfutils/configure
64372c
+++ elfutils/configure
64372c
@@ -661,6 +661,8 @@ ZLIB_TRUE
64372c
 LIBEBL_SUBDIR
64372c
 TESTS_RPATH_FALSE
64372c
 TESTS_RPATH_TRUE
64372c
+BUILD_WERROR_FALSE
64372c
+BUILD_WERROR_TRUE
64372c
 BUILD_STATIC_FALSE
64372c
 BUILD_STATIC_TRUE
64372c
 USE_VALGRIND_FALSE
64372c
@@ -676,6 +678,8 @@ NEVER_TRUE
64372c
 base_cpu
64372c
 NATIVE_LD_FALSE
64372c
 NATIVE_LD_TRUE
64372c
+LD_AS_NEEDED
64372c
+WEXTRA
64372c
 NM
64372c
 READELF
64372c
 ac_ct_AR
64372c
@@ -796,6 +800,7 @@ enable_debugpred
64372c
 enable_gprof
64372c
 enable_gcov
64372c
 enable_valgrind
64372c
+enable_werror
64372c
 enable_tests_rpath
64372c
 enable_libebl_subdir
64372c
 with_zlib
64372c
@@ -1452,6 +1457,7 @@ Optional Features:
64372c
   --enable-gprof          build binaries with gprof support
64372c
   --enable-gcov           build binaries with gcov support
64372c
   --enable-valgrind       run all tests under valgrind
64372c
+  --disable-werror        do not build with -Werror
64372c
   --enable-tests-rpath    build $ORIGIN-using rpath into tests
64372c
   --enable-libebl-subdir=DIR
64372c
                           install libebl_CPU modules in $(libdir)/DIR
64372c
@@ -4674,6 +4680,130 @@ if test "x$ac_cv_c99" != xyes; then :
64372c
   as_fn_error $? "gcc with C99 support required" "$LINENO" 5
64372c
 fi
64372c
 
64372c
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra option to $CC" >&5
64372c
+$as_echo_n "checking for -Wextra option to $CC... " >&6; }
64372c
+if ${ac_cv_cc_wextra+:} false; then :
64372c
+  $as_echo_n "(cached) " >&6
64372c
+else
64372c
+  old_CFLAGS="$CFLAGS"
64372c
+CFLAGS="$CFLAGS -Wextra"
64372c
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
64372c
+/* end confdefs.h.  */
64372c
+void foo (void) { }
64372c
+_ACEOF
64372c
+if ac_fn_c_try_compile "$LINENO"; then :
64372c
+  ac_cv_cc_wextra=yes
64372c
+else
64372c
+  ac_cv_cc_wextra=no
64372c
+fi
64372c
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
64372c
+CFLAGS="$old_CFLAGS"
64372c
+fi
64372c
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_wextra" >&5
64372c
+$as_echo "$ac_cv_cc_wextra" >&6; }
64372c
+
64372c
+if test "x$ac_cv_cc_wextra" = xyes; then :
64372c
+  WEXTRA=-Wextra
64372c
+else
64372c
+  WEXTRA=-W
64372c
+fi
64372c
+
64372c
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fgnu89-inline option to $CC" >&5
64372c
+$as_echo_n "checking for -fgnu89-inline option to $CC... " >&6; }
64372c
+if ${ac_cv_cc_gnu89_inline+:} false; then :
64372c
+  $as_echo_n "(cached) " >&6
64372c
+else
64372c
+  old_CFLAGS="$CFLAGS"
64372c
+CFLAGS="$CFLAGS -fgnu89-inline -Werror"
64372c
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
64372c
+/* end confdefs.h.  */
64372c
+
64372c
+void foo (void)
64372c
+{
64372c
+  inline void bar (void) {}
64372c
+  bar ();
64372c
+}
64372c
+extern inline void baz (void) {}
64372c
+
64372c
+_ACEOF
64372c
+if ac_fn_c_try_compile "$LINENO"; then :
64372c
+  ac_cv_cc_gnu89_inline=yes
64372c
+else
64372c
+  ac_cv_cc_gnu89_inline=no
64372c
+fi
64372c
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
64372c
+CFLAGS="$old_CFLAGS"
64372c
+fi
64372c
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_gnu89_inline" >&5
64372c
+$as_echo "$ac_cv_cc_gnu89_inline" >&6; }
64372c
+if test "x$ac_cv_cc_gnu89_inline" = xyes; then :
64372c
+  WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"
64372c
+fi
64372c
+
64372c
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --as-needed linker option" >&5
64372c
+$as_echo_n "checking for --as-needed linker option... " >&6; }
64372c
+if ${ac_cv_as_needed+:} false; then :
64372c
+  $as_echo_n "(cached) " >&6
64372c
+else
64372c
+  cat > conftest.c <
64372c
+int main (void) { return 0; }
64372c
+EOF
64372c
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
64372c
+			    -fPIC -shared -o conftest.so conftest.c
64372c
+			    -Wl,--as-needed 1>&5'
64372c
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
64372c
+  (eval $ac_try) 2>&5
64372c
+  ac_status=$?
64372c
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
64372c
+  test $ac_status = 0; }; }
64372c
+then
64372c
+  ac_cv_as_needed=yes
64372c
+else
64372c
+  ac_cv_as_needed=no
64372c
+fi
64372c
+rm -f conftest*
64372c
+fi
64372c
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_as_needed" >&5
64372c
+$as_echo "$ac_cv_as_needed" >&6; }
64372c
+if test "x$ac_cv_as_needed" = xyes; then :
64372c
+  LD_AS_NEEDED=-Wl,--as-needed
64372c
+else
64372c
+  LD_AS_NEEDED=
64372c
+fi
64372c
+
64372c
+
64372c
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_popcount" >&5
64372c
+$as_echo_n "checking for __builtin_popcount... " >&6; }
64372c
+if ${ac_cv_popcount+:} false; then :
64372c
+  $as_echo_n "(cached) " >&6
64372c
+else
64372c
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
64372c
+/* end confdefs.h.  */
64372c
+
64372c
+int
64372c
+main ()
64372c
+{
64372c
+exit (__builtin_popcount (127));
64372c
+  ;
64372c
+  return 0;
64372c
+}
64372c
+_ACEOF
64372c
+if ac_fn_c_try_link "$LINENO"; then :
64372c
+  ac_cv_popcount=yes
64372c
+else
64372c
+  ac_cv_popcount=no
64372c
+fi
64372c
+rm -f core conftest.err conftest.$ac_objext \
64372c
+    conftest$ac_exeext conftest.$ac_ext
64372c
+fi
64372c
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_popcount" >&5
64372c
+$as_echo "$ac_cv_popcount" >&6; }
64372c
+if test "x$ac_cv_popcount" = xyes; then :
64372c
+
64372c
+$as_echo "#define HAVE_BUILTIN_POPCOUNT 1" >>confdefs.h
64372c
+
64372c
+fi
64372c
+
64372c
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __thread support" >&5
64372c
 $as_echo_n "checking for __thread support... " >&6; }
64372c
 if ${ac_cv_tls+:} false; then :
64372c
@@ -4710,7 +4840,13 @@ fi
64372c
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5
64372c
 $as_echo "$ac_cv_tls" >&6; }
64372c
 if test "x$ac_cv_tls" != xyes; then :
64372c
-  as_fn_error $? "__thread support required" "$LINENO" 5
64372c
+  if test "$use_locks" = yes; then :
64372c
+  as_fn_error $? "--enable-thread-safety requires __thread support" "$LINENO" 5
64372c
+else
64372c
+
64372c
+$as_echo "#define __thread /* empty: no multi-thread support */" >>confdefs.h
64372c
+
64372c
+fi
64372c
 fi
64372c
 
64372c
 # Check whether --enable-largefile was given.
64372c
@@ -5077,6 +5213,22 @@ else
64372c
 fi
64372c
 
64372c
 
64372c
+# Check whether --enable-werror was given.
64372c
+if test "${enable_werror+set}" = set; then :
64372c
+  enableval=$enable_werror; enable_werror=$enableval
64372c
+else
64372c
+  enable_werror=yes
64372c
+fi
64372c
+
64372c
+ if test "$enable_werror" = yes; then
64372c
+  BUILD_WERROR_TRUE=
64372c
+  BUILD_WERROR_FALSE='#'
64372c
+else
64372c
+  BUILD_WERROR_TRUE='#'
64372c
+  BUILD_WERROR_FALSE=
64372c
+fi
64372c
+
64372c
+
64372c
 # Check whether --enable-tests-rpath was given.
64372c
 if test "${enable_tests_rpath+set}" = set; then :
64372c
   enableval=$enable_tests_rpath; tests_use_rpath=$enableval
64372c
@@ -5800,7 +5952,7 @@ case "$eu_version" in
64372c
 esac
64372c
 
64372c
 # Round up to the next release API (x.y) version.
64372c
-eu_version=$(( (eu_version + 999) / 1000 ))
64372c
+eu_version=`expr \( $eu_version + 999 \) / 1000`
64372c
 
64372c
 ac_ext=c
64372c
 ac_cpp='$CPP $CPPFLAGS'
64372c
@@ -6530,6 +6682,10 @@ if test -z "${BUILD_STATIC_TRUE}" && tes
64372c
   as_fn_error $? "conditional \"BUILD_STATIC\" was never defined.
64372c
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
64372c
 fi
64372c
+if test -z "${BUILD_WERROR_TRUE}" && test -z "${BUILD_WERROR_FALSE}"; then
64372c
+  as_fn_error $? "conditional \"BUILD_WERROR\" was never defined.
64372c
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
64372c
+fi
64372c
 if test -z "${TESTS_RPATH_TRUE}" && test -z "${TESTS_RPATH_FALSE}"; then
64372c
   as_fn_error $? "conditional \"TESTS_RPATH\" was never defined.
64372c
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
64372c
--- elfutils/configure.ac
64372c
+++ elfutils/configure.ac
64372c
@@ -89,6 +89,54 @@ CFLAGS="$old_CFLAGS"])
64372c
 AS_IF([test "x$ac_cv_c99" != xyes],
64372c
       AC_MSG_ERROR([gcc with C99 support required]))
64372c
 
64372c
+AC_CACHE_CHECK([for -Wextra option to $CC], ac_cv_cc_wextra, [dnl
64372c
+old_CFLAGS="$CFLAGS"
64372c
+CFLAGS="$CFLAGS -Wextra"
64372c
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([void foo (void) { }])],
64372c
+		  ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no)
64372c
+CFLAGS="$old_CFLAGS"])
64372c
+AC_SUBST(WEXTRA)
64372c
+AS_IF([test "x$ac_cv_cc_wextra" = xyes], [WEXTRA=-Wextra], [WEXTRA=-W])
64372c
+
64372c
+AC_CACHE_CHECK([for -fgnu89-inline option to $CC], ac_cv_cc_gnu89_inline, [dnl
64372c
+old_CFLAGS="$CFLAGS"
64372c
+CFLAGS="$CFLAGS -fgnu89-inline -Werror"
64372c
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
64372c
+void foo (void)
64372c
+{
64372c
+  inline void bar (void) {}
64372c
+  bar ();
64372c
+}
64372c
+extern inline void baz (void) {}
64372c
+])], ac_cv_cc_gnu89_inline=yes, ac_cv_cc_gnu89_inline=no)
64372c
+CFLAGS="$old_CFLAGS"])
64372c
+AS_IF([test "x$ac_cv_cc_gnu89_inline" = xyes],
64372c
+      [WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"])
64372c
+
64372c
+AC_CACHE_CHECK([for --as-needed linker option],
64372c
+	       ac_cv_as_needed, [dnl
64372c
+cat > conftest.c <
64372c
+int main (void) { return 0; }
64372c
+EOF
64372c
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
64372c
+			    -fPIC -shared -o conftest.so conftest.c
64372c
+			    -Wl,--as-needed 1>&AS_MESSAGE_LOG_FD])
64372c
+then
64372c
+  ac_cv_as_needed=yes
64372c
+else
64372c
+  ac_cv_as_needed=no
64372c
+fi
64372c
+rm -f conftest*])
64372c
+AS_IF([test "x$ac_cv_as_needed" = xyes],
64372c
+      [LD_AS_NEEDED=-Wl,--as-needed], [LD_AS_NEEDED=])
64372c
+AC_SUBST(LD_AS_NEEDED)
64372c
+
64372c
+AC_CACHE_CHECK([for __builtin_popcount], ac_cv_popcount, [dnl
64372c
+AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[exit (__builtin_popcount (127));]])],
64372c
+	       ac_cv_popcount=yes, ac_cv_popcount=no)])
64372c
+AS_IF([test "x$ac_cv_popcount" = xyes],
64372c
+      [AC_DEFINE([HAVE_BUILTIN_POPCOUNT], [1], [Have __builtin_popcount.])])
64372c
+
64372c
 AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
64372c
 # Use the same flags that we use for our DSOs, so the test is representative.
64372c
 # Some old compiler/linker/libc combinations fail some ways and not others.
64372c
@@ -104,7 +152,10 @@ static __thread int a; int foo (int b) {
64372c
 CFLAGS="$save_CFLAGS"
64372c
 LDFLAGS="$save_LDFLAGS"])
64372c
 AS_IF([test "x$ac_cv_tls" != xyes],
64372c
-      AC_MSG_ERROR([__thread support required]))
64372c
+      [AS_IF([test "$use_locks" = yes],
64372c
+	     [AC_MSG_ERROR([--enable-thread-safety requires __thread support])],
64372c
+	     [AC_DEFINE([__thread], [/* empty: no multi-thread support */],
64372c
+			[Stubbed out if missing compiler support.])])])
64372c
 
64372c
 dnl This test must come as early as possible after the compiler configuration
64372c
 dnl tests, because the choice of the file model can (in principle) affect
64372c
@@ -183,6 +234,11 @@ AM_CONDITIONAL(USE_VALGRIND, test "$use_
64372c
 AM_CONDITIONAL(BUILD_STATIC, [dnl
64372c
 test "$use_gprof" = yes -o "$use_gcov" = yes])
64372c
 
64372c
+AC_ARG_ENABLE([werror],
64372c
+AS_HELP_STRING([--disable-werror],[do not build with -Werror]),
64372c
+	       [enable_werror=$enableval], [enable_werror=yes])
64372c
+AM_CONDITIONAL(BUILD_WERROR, test "$enable_werror" = yes)
64372c
+
64372c
 AC_ARG_ENABLE([tests-rpath],
64372c
 AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
64372c
 	       [tests_use_rpath=$enableval], [tests_use_rpath=no])
64372c
@@ -297,7 +353,7 @@ case "$eu_version" in
64372c
 esac
64372c
 
64372c
 # Round up to the next release API (x.y) version.
64372c
-eu_version=$(( (eu_version + 999) / 1000 ))
64372c
+eu_version=`expr \( $eu_version + 999 \) / 1000`
64372c
 
64372c
 AC_CHECK_SIZEOF(long)
64372c
 
64372c
--- elfutils/lib/ChangeLog
64372c
+++ elfutils/lib/ChangeLog
64372c
@@ -65,6 +65,9 @@
64372c
 
64372c
 2009-01-23  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
+	* eu-config.h [! HAVE_BUILTIN_POPCOUNT]
64372c
+	(__builtin_popcount): New inline function.
64372c
+
64372c
 	* eu-config.h: Add multiple inclusion protection.
64372c
 
64372c
 2009-01-17  Ulrich Drepper  <drepper@redhat.com>
64372c
@@ -121,6 +124,11 @@
64372c
 	* Makefile.am (libeu_a_SOURCES): Add it.
64372c
 	* system.h: Declare crc32_file.
64372c
 
64372c
+2005-02-07  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* Makefile.am (WEXTRA): New variable, substituted by configure.
64372c
+	(AM_CFLAGS): Use it in place of -Wextra.
64372c
+
64372c
 2005-04-30  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* Makefile.am: Use -ffunction-sections for xmalloc.c.
64372c
--- elfutils/lib/eu-config.h
64372c
+++ elfutils/lib/eu-config.h
64372c
@@ -162,6 +162,17 @@ asm (".section predict_data, \"aw\"; .pr
64372c
 /* This macro is used by the tests conditionalize for standalone building.  */
64372c
 #define ELFUTILS_HEADER(name) <lib##name.h>
64372c
 
64372c
+#ifndef HAVE_BUILTIN_POPCOUNT
64372c
+# define __builtin_popcount hakmem_popcount
64372c
+static inline unsigned int __attribute__ ((unused))
64372c
+hakmem_popcount (unsigned int x)
64372c
+{
64372c
+  /* HAKMEM 169 */
64372c
+  unsigned int n = x - ((x >> 1) & 033333333333) - ((x >> 2) & 011111111111);
64372c
+  return ((n + (n >> 3)) & 030707070707) % 63;
64372c
+}
64372c
+#endif	/* HAVE_BUILTIN_POPCOUNT */
64372c
+
64372c
 
64372c
 #ifdef SHARED
64372c
 # define OLD_VERSION(name, version) \
64372c
--- elfutils/lib/Makefile.in
64372c
+++ elfutils/lib/Makefile.in
64372c
@@ -82,6 +82,7 @@ host_triplet = @host@
64372c
 DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \
64372c
 	$(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
64372c
 	$(noinst_HEADERS) ChangeLog
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
 subdir = lib
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
 am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
64372c
@@ -197,6 +198,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -228,6 +230,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = @VERSION@
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -289,9 +292,11 @@ top_srcdir = @top_srcdir@
64372c
 zip_LIBS = @zip_LIBS@
64372c
 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
64372c
 	-I$(srcdir)/../libelf
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
 	$($(*F)_no_Werror),,-Werror) $(if \
64372c
-	$($(*F)_no_Wunused),,-Wunused -Wextra) $($(*F)_CFLAGS) -fpic
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1) -fpic
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda
64372c
 textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
64372c
--- elfutils/libasm/ChangeLog
64372c
+++ elfutils/libasm/ChangeLog
64372c
@@ -79,6 +79,11 @@
64372c
 	* asm_error.c: Add new error ASM_E_IOERROR.
64372c
 	* libasmP.h: Add ASM_E_IOERROR definition.
64372c
 
64372c
+2005-05-31  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* Makefile.am (WEXTRA): New variable, substituted by configure.
64372c
+	(AM_CFLAGS): Use it in place of -Wextra.
64372c
+
64372c
 2005-02-15  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* Makefile.am (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
64372c
--- elfutils/libasm/Makefile.in
64372c
+++ elfutils/libasm/Makefile.in
64372c
@@ -83,8 +83,9 @@ host_triplet = @host@
64372c
 DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \
64372c
 	$(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
64372c
 	$(noinst_HEADERS) $(pkginclude_HEADERS) ChangeLog
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
 noinst_PROGRAMS = $(am__EXEEXT_1)
64372c
-@USE_LOCKS_TRUE@am__append_1 = -lpthread
64372c
+@USE_LOCKS_TRUE@am__append_2 = -lpthread
64372c
 subdir = libasm
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
 am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
64372c
@@ -248,6 +249,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -279,6 +281,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = 1
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -341,11 +344,11 @@ zip_LIBS = @zip_LIBS@
64372c
 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
64372c
 	-I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \
64372c
 	-I$(top_srcdir)/libdw
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
64372c
-	    $(if $($(*F)_no_Werror),,-Werror) \
64372c
-	    $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
64372c
-	    $($(*F)_CFLAGS)
64372c
-
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
+	$($(*F)_no_Werror),,-Werror) $(if \
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1)
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda $(am_libasm_pic_a_OBJECTS) \
64372c
 	libasm.so.$(VERSION)
64372c
@@ -370,7 +373,7 @@ libasm_a_SOURCES = asm_begin.c asm_abort
64372c
 
64372c
 libasm_pic_a_SOURCES = 
64372c
 am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
64372c
-libasm_so_LDLIBS = $(am__append_1)
64372c
+libasm_so_LDLIBS = $(am__append_2)
64372c
 libasm_so_SOURCES = 
64372c
 noinst_HEADERS = libasmP.h symbolhash.h
64372c
 EXTRA_DIST = libasm.map
64372c
--- elfutils/libcpu/ChangeLog
64372c
+++ elfutils/libcpu/ChangeLog
64372c
@@ -51,6 +51,9 @@
64372c
 
64372c
 2009-01-23  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
+	* i386_disasm.c (i386_disasm): Add abort after assert-constant for old
64372c
+	compilers that don't realize it's noreturn.
64372c
+
64372c
 	* Makefile.am (i386_parse_CFLAGS): Use quotes around command
64372c
 	substitution that can produce leading whitespace.
64372c
 
64372c
@@ -380,6 +383,11 @@
64372c
 	* defs/i386.doc: New file.
64372c
 	* defs/x86_64: New file.
64372c
 
64372c
+2005-04-04  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* Makefile.am (WEXTRA): New variable, substituted by configure.
64372c
+	(AM_CFLAGS): Use it instead of -Wextra.
64372c
+
64372c
 2005-02-15  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
64372c
--- elfutils/libcpu/i386_disasm.c
64372c
+++ elfutils/libcpu/i386_disasm.c
64372c
@@ -822,6 +822,7 @@ i386_disasm (const uint8_t **startp, con
64372c
 
64372c
 			default:
64372c
 			  assert (! "INVALID not handled");
64372c
+			  abort ();
64372c
 			}
64372c
 		    }
64372c
 		  else
64372c
--- elfutils/libcpu/Makefile.in
64372c
+++ elfutils/libcpu/Makefile.in
64372c
@@ -84,6 +84,7 @@ DIST_COMMON = $(top_srcdir)/config/eu.am
64372c
 	$(srcdir)/Makefile.am i386_lex.c i386_parse.c \
64372c
 	$(top_srcdir)/config/depcomp $(top_srcdir)/config/ylwrap \
64372c
 	$(am__noinst_HEADERS_DIST) ChangeLog
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
 @MAINTAINER_MODE_TRUE@noinst_PROGRAMS = i386_gendis$(EXEEXT)
64372c
 subdir = libcpu
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
@@ -223,6 +224,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = lex.$(
64372c
@@ -254,6 +256,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = @VERSION@
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -316,10 +319,11 @@ zip_LIBS = @zip_LIBS@
64372c
 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
64372c
 	-I$(srcdir)/../libelf -I$(srcdir)/../libebl \
64372c
 	-I$(srcdir)/../libdw -I$(srcdir)/../libasm
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
 	$($(*F)_no_Werror),,-Werror) $(if \
64372c
-	$($(*F)_no_Wunused),,-Wunused -Wextra) $($(*F)_CFLAGS) -fpic \
64372c
-	-fdollars-in-identifiers
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1) -fpic -fdollars-in-identifiers
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda $(foreach P,i386 x86_64,$P_defs \
64372c
 	$P.mnemonics)
64372c
--- elfutils/libdw/ChangeLog
64372c
+++ elfutils/libdw/ChangeLog
64372c
@@ -420,6 +420,10 @@
64372c
 
64372c
 	* Makefile.am (known-dwarf.h): Run gawk on config/known-dwarf.awk.
64372c
 
64372c
+2011-07-20  Mark Wielaard  <mjw@redhat.com>
64372c
+
64372c
+	* dwarf_begin_elf.c: Add fallback for be64toh if not defined.
64372c
+
64372c
 2011-07-14  Mark Wielaard  <mjw@redhat.com>
64372c
 
64372c
 	* libdw.h (dwarf_offdie): Fix documentation to mention .debug_info.
64372c
@@ -779,6 +783,10 @@
64372c
 
64372c
 	* dwarf_hasattr_integrate.c: Integrate DW_AT_specification too.
64372c
 
64372c
+2009-08-17  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* libdw.h: Disable extern inlines for GCC 4.2.
64372c
+
64372c
 2009-08-10  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
 	* dwarf_getscopevar.c: Use dwarf_diename.
64372c
@@ -1547,6 +1555,11 @@
64372c
 
64372c
 2005-05-31  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
+	* Makefile.am (WEXTRA): New variable, substituted by configure.
64372c
+	(AM_CFLAGS): Use it in place of -Wextra.
64372c
+
64372c
+2005-05-31  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
 	* dwarf_formref_die.c (dwarf_formref_die): Add CU header offset to
64372c
 	formref offset.
64372c
 
64372c
--- elfutils/libdw/dwarf_begin_elf.c
64372c
+++ elfutils/libdw/dwarf_begin_elf.c
64372c
@@ -47,6 +47,14 @@
64372c
 #if USE_ZLIB
64372c
 # include <endian.h>
64372c
 # define crc32		loser_crc32
64372c
+# ifndef be64toh
64372c
+#  include <byteswap.h>
64372c
+#  if __BYTE_ORDER == __LITTLE_ENDIAN
64372c
+#   define be64toh(x) bswap_64 (x)
64372c
+#  else
64372c
+#   define be64toh(x) (x)
64372c
+#  endif
64372c
+# endif
64372c
 # include <zlib.h>
64372c
 # undef crc32
64372c
 #endif
64372c
--- elfutils/libdw/libdw.h
64372c
+++ elfutils/libdw/libdw.h
64372c
@@ -891,7 +891,7 @@ extern Dwarf_OOM dwarf_new_oom_handler (
64372c
 
64372c
 
64372c
 /* Inline optimizations.  */
64372c
-#ifdef __OPTIMIZE__
64372c
+#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
64372c
 /* Return attribute code of given attribute.  */
64372c
 __libdw_extern_inline unsigned int
64372c
 dwarf_whatattr (Dwarf_Attribute *attr)
64372c
--- elfutils/libdw/Makefile.in
64372c
+++ elfutils/libdw/Makefile.in
64372c
@@ -84,7 +84,8 @@ DIST_COMMON = $(top_srcdir)/config/eu.am
64372c
 	$(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
64372c
 	$(include_HEADERS) $(noinst_HEADERS) $(pkginclude_HEADERS) \
64372c
 	ChangeLog
64372c
-@BUILD_STATIC_TRUE@am__append_1 = -fpic
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
+@BUILD_STATIC_TRUE@am__append_2 = -fpic
64372c
 noinst_PROGRAMS = $(am__EXEEXT_1)
64372c
 subdir = libdw
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
@@ -295,6 +296,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -326,6 +328,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = 1
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -387,10 +390,11 @@ top_srcdir = @top_srcdir@
64372c
 zip_LIBS = @zip_LIBS@
64372c
 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
64372c
 	-I$(srcdir)/../libelf
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
 	$($(*F)_no_Werror),,-Werror) $(if \
64372c
-	$($(*F)_no_Wunused),,-Wunused -Wextra) $($(*F)_CFLAGS) \
64372c
-	$(am__append_1)
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1) $(am__append_2)
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda
64372c
 textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
64372c
--- elfutils/libdwelf/Makefile.in
64372c
+++ elfutils/libdwelf/Makefile.in
64372c
@@ -82,6 +82,7 @@ host_triplet = @host@
64372c
 DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \
64372c
 	$(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
64372c
 	$(noinst_HEADERS) $(pkginclude_HEADERS) ChangeLog
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
 subdir = libdwelf
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
 am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
64372c
@@ -227,6 +228,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -258,6 +260,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = 1
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -320,11 +323,11 @@ zip_LIBS = @zip_LIBS@
64372c
 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
64372c
 	-I$(srcdir)/../libelf -I$(srcdir)/../libdw \
64372c
 	-I$(srcdir)/../libdwfl -I$(srcdir)/../libebl
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
64372c
-	    $(if $($(*F)_no_Werror),,-Werror) \
64372c
-	    $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
64372c
-	    $($(*F)_CFLAGS)
64372c
-
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
+	$($(*F)_no_Werror),,-Werror) $(if \
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1)
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda $(am_libdwelf_pic_a_OBJECTS)
64372c
 textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
64372c
--- elfutils/libdwfl/ChangeLog
64372c
+++ elfutils/libdwfl/ChangeLog
64372c
@@ -421,6 +421,21 @@
64372c
 	(dwfl_module_addrsym) (i_to_symfile): New function.
64372c
 	(dwfl_module_addrsym) (search_table): Use it.
64372c
 
64372c
+2013-11-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
64372c
+
64372c
+	Older OS compatibility bits.
64372c
+	* linux-core-attach.c (be64toh, le64toh, be32toh, le32toh): Provide
64372c
+	fallbacks if not defined by system.
64372c
+
64372c
+2013-11-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
64372c
+
64372c
+	Handle T-stopped detach for old kernels.
64372c
+	* linux-pid-attach.c (struct pid_arg): New field stopped.
64372c
+	(ptrace_attach): New parameter stoppedp.  Set it appropriately.
64372c
+	(pid_set_initial_registers): Pass the new field.
64372c
+	(pid_thread_detach): Handle the case of STOPPED for old kernels.
64372c
+	(__libdwfl_attach_state_for_pid): Initialize STOPPED.
64372c
+
64372c
 2013-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
64372c
 	    Mark Wielaard  <mjw@redhat.com>
64372c
 
64372c
@@ -2186,6 +2201,11 @@
64372c
 
64372c
 2005-07-21  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
+	* Makefile.am (WEXTRA): New variable, substituted by configure.
64372c
+	(AM_CFLAGS): Use it in place of -Wextra.
64372c
+
64372c
+2005-07-21  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
 	* Makefile.am (noinst_HEADERS): Add loc2c.c.
64372c
 
64372c
 	* test2.c (main): Check sscanf result to quiet warning.
64372c
--- elfutils/libdwfl/linux-core-attach.c
64372c
+++ elfutils/libdwfl/linux-core-attach.c
64372c
@@ -29,6 +29,35 @@
64372c
 #include "libdwflP.h"
64372c
 #include <fcntl.h>
64372c
 #include "system.h"
64372c
+#include <endian.h>
64372c
+#include <byteswap.h>
64372c
+#if __BYTE_ORDER == __LITTLE_ENDIAN
64372c
+# ifndef be64toh
64372c
+#  define be64toh(x) bswap_64 (x)
64372c
+# endif
64372c
+# ifndef le64toh
64372c
+#  define le64toh(x) (x)
64372c
+# endif
64372c
+# ifndef be32toh
64372c
+#  define be32toh(x) bswap_32 (x)
64372c
+# endif
64372c
+# ifndef le32toh
64372c
+#  define le32toh(x) (x)
64372c
+# endif
64372c
+#else
64372c
+# ifndef be64toh
64372c
+#  define be64toh(x) (x)
64372c
+# endif
64372c
+# ifndef le64toh
64372c
+#  define le64toh(x) bswap_64 (x)
64372c
+# endif
64372c
+# ifndef be32toh
64372c
+#  define be32toh(x) (x)
64372c
+# endif
64372c
+# ifndef le32toh
64372c
+#  define le32toh(x) bswap_32 (x)
64372c
+# endif
64372c
+#endif
64372c
 
64372c
 #ifndef MIN
64372c
 # define MIN(a, b) ((a) < (b) ? (a) : (b))
64372c
--- elfutils/libdwfl/linux-pid-attach.c
64372c
+++ elfutils/libdwfl/linux-pid-attach.c
64372c
@@ -255,6 +255,11 @@ void
64372c
 internal_function
64372c
 __libdwfl_ptrace_detach (pid_t tid, bool tid_was_stopped)
64372c
 {
64372c
+  // Older kernels (tested kernel-2.6.18-348.12.1.el5.x86_64) need special
64372c
+  // handling of the detachment to keep the process State: T (stopped).
64372c
+  if (tid_was_stopped)
64372c
+    syscall (__NR_tkill, tid, SIGSTOP);
64372c
+
64372c
   /* This handling is needed only on older Linux kernels such as
64372c
      2.6.32-358.23.2.el6.ppc64.  Later kernels such as
64372c
      3.11.7-200.fc19.x86_64 remember the T (stopped) state
64372c
@@ -262,6 +267,15 @@ __libdwfl_ptrace_detach (pid_t tid, bool
64372c
      PTRACE_DETACH.  */
64372c
   ptrace (PTRACE_DETACH, tid, NULL,
64372c
 	  (void *) (intptr_t) (tid_was_stopped ? SIGSTOP : 0));
64372c
+
64372c
+  if (tid_was_stopped)
64372c
+    {
64372c
+      // Wait till the SIGSTOP settles down.
64372c
+      int i;
64372c
+      for (i = 0; i < 100000; i++)
64372c
+	if (linux_proc_pid_is_stopped (tid))
64372c
+	  break;
64372c
+    }
64372c
 }
64372c
 
64372c
 static void
64372c
--- elfutils/libdwfl/Makefile.in
64372c
+++ elfutils/libdwfl/Makefile.in
64372c
@@ -82,9 +82,10 @@ host_triplet = @host@
64372c
 DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \
64372c
 	$(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
64372c
 	$(noinst_HEADERS) $(pkginclude_HEADERS) ChangeLog
64372c
-@ZLIB_TRUE@am__append_1 = gzip.c
64372c
-@BZLIB_TRUE@am__append_2 = bzip2.c
64372c
-@LZMA_TRUE@am__append_3 = lzma.c
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
+@ZLIB_TRUE@am__append_2 = gzip.c
64372c
+@BZLIB_TRUE@am__append_3 = bzip2.c
64372c
+@LZMA_TRUE@am__append_4 = lzma.c
64372c
 subdir = libdwfl
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
 am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
64372c
@@ -286,6 +287,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -317,6 +319,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = 1
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -379,11 +382,11 @@ zip_LIBS = @zip_LIBS@
64372c
 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. -I$(srcdir) \
64372c
 	-I$(srcdir)/../libelf -I$(srcdir)/../libebl \
64372c
 	-I$(srcdir)/../libdw -I$(srcdir)/../libdwelf
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
64372c
-	    $(if $($(*F)_no_Werror),,-Werror) \
64372c
-	    $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
64372c
-	    $($(*F)_CFLAGS)
64372c
-
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
+	$($(*F)_no_Werror),,-Werror) $(if \
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1)
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda $(am_libdwfl_pic_a_OBJECTS)
64372c
 textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
64372c
@@ -410,8 +413,8 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en
64372c
 	dwfl_module_register_names.c dwfl_segment_report_module.c \
64372c
 	link_map.c core-file.c open.c image-header.c dwfl_frame.c \
64372c
 	frame_unwind.c dwfl_frame_pc.c linux-pid-attach.c \
64372c
-	linux-core-attach.c dwfl_frame_regs.c $(am__append_1) \
64372c
-	$(am__append_2) $(am__append_3)
64372c
+	linux-core-attach.c dwfl_frame_regs.c $(am__append_2) \
64372c
+	$(am__append_3) $(am__append_4)
64372c
 libdwfl = $(libdw)
64372c
 libdw = ../libdw/libdw.so
64372c
 libelf = ../libelf/libelf.so
64372c
--- elfutils/libebl/ChangeLog
64372c
+++ elfutils/libebl/ChangeLog
64372c
@@ -748,6 +748,11 @@
64372c
 	* Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency
64372c
 	tracking works right.
64372c
 
64372c
+2005-05-31  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* Makefile.am (WEXTRA): New variable, substituted by configure.
64372c
+	(AM_CFLAGS): Use it in place of -Wextra.
64372c
+
64372c
 2005-05-21  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* libebl_x86_64.map: Add x86_64_core_note.
64372c
--- elfutils/libebl/Makefile.in
64372c
+++ elfutils/libebl/Makefile.in
64372c
@@ -82,6 +82,7 @@ host_triplet = @host@
64372c
 DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \
64372c
 	$(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
64372c
 	$(noinst_HEADERS) $(pkginclude_HEADERS) ChangeLog
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
 subdir = libebl
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
 am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
64372c
@@ -249,6 +250,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -280,6 +282,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = 1
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -342,9 +345,11 @@ zip_LIBS = @zip_LIBS@
64372c
 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
64372c
 	-I$(srcdir)/../libelf -I$(srcdir)/../libdw \
64372c
 	-I$(srcdir)/../libasm
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
 	$($(*F)_no_Werror),,-Werror) $(if \
64372c
-	$($(*F)_no_Wunused),,-Wunused -Wextra) $($(*F)_CFLAGS) -fpic
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1) -fpic
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda $(am_libebl_pic_a_OBJECTS)
64372c
 textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
64372c
--- elfutils/libelf/ChangeLog
64372c
+++ elfutils/libelf/ChangeLog
64372c
@@ -135,6 +135,11 @@
64372c
 
64372c
 	* elf-knowledge.h (SECTION_STRIP_P): Remove < SHT_NUM check.
64372c
 
64372c
+2011-03-10  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* gnuhash_xlate.h (elf_cvt_gnuhash): Avoid post-increment in bswap_32
64372c
+	argument, since some implementations are buggy macros.
64372c
+
64372c
 2011-02-26  Mark Wielaard  <mjw@redhat.com>
64372c
 
64372c
 	* elf_end.c (elf_end): Call rwlock_unlock before rwlock_fini.
64372c
@@ -812,6 +817,11 @@
64372c
 
64372c
 	* elf.h: Update from glibc.
64372c
 
64372c
+2005-05-31  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* Makefile.am (WEXTRA): New variable, substituted by configure.
64372c
+	(AM_CFLAGS): Use it in place of -Wextra.
64372c
+
64372c
 2005-05-08  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
 	* elf_begin.c (read_file) [_MUDFLAP]: Don't use mmap for now.
64372c
--- elfutils/libelf/common.h
64372c
+++ elfutils/libelf/common.h
64372c
@@ -139,7 +139,7 @@ libelf_release_all (Elf *elf)
64372c
   (Var) = (sizeof (Var) == 1						      \
64372c
 	   ? (unsigned char) (Var)					      \
64372c
 	   : (sizeof (Var) == 2						      \
64372c
-	      ? bswap_16 (Var)						      \
64372c
+	      ? (unsigned short int) bswap_16 (Var)			      \
64372c
 	      : (sizeof (Var) == 4					      \
64372c
 		 ? bswap_32 (Var)					      \
64372c
 		 : bswap_64 (Var))))
64372c
@@ -148,7 +148,7 @@ libelf_release_all (Elf *elf)
64372c
   (Dst) = (sizeof (Var) == 1						      \
64372c
 	   ? (unsigned char) (Var)					      \
64372c
 	   : (sizeof (Var) == 2						      \
64372c
-	      ? bswap_16 (Var)						      \
64372c
+	      ? (unsigned short int) bswap_16 (Var)			      \
64372c
 	      : (sizeof (Var) == 4					      \
64372c
 		 ? bswap_32 (Var)					      \
64372c
 		 : bswap_64 (Var))))
64372c
--- elfutils/libelf/gnuhash_xlate.h
64372c
+++ elfutils/libelf/gnuhash_xlate.h
64372c
@@ -1,5 +1,5 @@
64372c
 /* Conversion functions for versioning information.
64372c
-   Copyright (C) 2006, 2007 Red Hat, Inc.
64372c
+   Copyright (C) 2006-2011 Red Hat, Inc.
64372c
    This file is part of elfutils.
64372c
    Written by Ulrich Drepper <drepper@redhat.com>, 2006.
64372c
 
64372c
@@ -68,7 +68,9 @@ elf_cvt_gnuhash (void *dest, const void
64372c
   dest32 = (Elf32_Word *) &dest64[bitmask_words];
64372c
   while (len >= 4)
64372c
     {
64372c
-      *dest32++ = bswap_32 (*src32++);
64372c
+      *dest32 = bswap_32 (*src32);
64372c
+      ++dest32;
64372c
+      ++src32;
64372c
       len -= 4;
64372c
     }
64372c
 }
64372c
--- elfutils/libelf/Makefile.in
64372c
+++ elfutils/libelf/Makefile.in
64372c
@@ -84,9 +84,10 @@ DIST_COMMON = $(top_srcdir)/config/eu.am
64372c
 	$(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
64372c
 	$(include_HEADERS) $(noinst_HEADERS) $(pkginclude_HEADERS) \
64372c
 	ChangeLog
64372c
-@BUILD_STATIC_TRUE@am__append_1 = -fpic
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
+@BUILD_STATIC_TRUE@am__append_2 = -fpic
64372c
 noinst_PROGRAMS = $(am__EXEEXT_1)
64372c
-@USE_LOCKS_TRUE@am__append_2 = -lpthread
64372c
+@USE_LOCKS_TRUE@am__append_3 = -lpthread
64372c
 subdir = libelf
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
 am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
64372c
@@ -291,6 +292,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -322,6 +324,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = 1
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -382,10 +385,11 @@ top_builddir = @top_builddir@
64372c
 top_srcdir = @top_srcdir@
64372c
 zip_LIBS = @zip_LIBS@
64372c
 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
 	$($(*F)_no_Werror),,-Werror) $(if \
64372c
-	$($(*F)_no_Wunused),,-Wunused -Wextra) $($(*F)_CFLAGS) \
64372c
-	$(am__append_1)
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1) $(am__append_2)
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda $(am_libelf_pic_a_OBJECTS) \
64372c
 	libelf.so.$(VERSION)
64372c
@@ -446,7 +450,7 @@ libelf_a_SOURCES = elf_version.c elf_has
64372c
 
64372c
 libelf_pic_a_SOURCES = 
64372c
 am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
64372c
-libelf_so_LDLIBS = $(am__append_2)
64372c
+libelf_so_LDLIBS = $(am__append_3)
64372c
 libelf_so_SOURCES = 
64372c
 noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
64372c
 		 version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h
64372c
--- elfutils/m4/Makefile.in
64372c
+++ elfutils/m4/Makefile.in
64372c
@@ -145,6 +145,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -176,6 +177,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = @VERSION@
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
--- elfutils/Makefile.in
64372c
+++ elfutils/Makefile.in
64372c
@@ -263,6 +263,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -294,6 +295,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = @VERSION@
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
--- elfutils/src/addr2line.c
64372c
+++ elfutils/src/addr2line.c
64372c
@@ -540,10 +540,10 @@ handle_address (const char *string, Dwfl
64372c
       bool parsed = false;
64372c
       int i, j;
64372c
       char *name = NULL;
64372c
-      if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
64372c
+      if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
64372c
 	  && string[i] == '\0')
64372c
 	parsed = adjust_to_section (name, &addr, dwfl);
64372c
-      switch (sscanf (string, "%m[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
64372c
+      switch (sscanf (string, "%a[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
64372c
 	{
64372c
 	default:
64372c
 	  break;
64372c
--- elfutils/src/ChangeLog
64372c
+++ elfutils/src/ChangeLog
64372c
@@ -1112,8 +1112,16 @@
64372c
 	* readelf.c (attr_callback): Use print_block only when we don't use
64372c
 	print_ops.
64372c
 
64372c
+2009-08-17  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* ld.h: Disable extern inlines for GCC 4.2.
64372c
+
64372c
 2009-08-14  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
+	* strings.c (read_block): Conditionalize posix_fadvise use
64372c
+	on [POSIX_FADV_SEQUENTIAL].
64372c
+	From Petr Salinger <Petr.Salinger@seznam.cz>.
64372c
+
64372c
 	* ar.c (do_oper_extract): Use pathconf instead of statfs.
64372c
 
64372c
 2009-08-01  Ulrich Drepper  <drepper@redhat.com>
64372c
@@ -1277,6 +1285,8 @@
64372c
 	* readelf.c (print_debug_frame_section): Use t instead of j formats
64372c
 	for ptrdiff_t OFFSET.
64372c
 
64372c
+	* addr2line.c (handle_address): Use %a instead of %m for compatibility.
64372c
+
64372c
 2009-01-21  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* elflint.c (check_program_header): Fix typo in .eh_frame_hdr section
64372c
@@ -1460,6 +1470,11 @@
64372c
 	that matches its PT_LOAD's p_flags &~ PF_W.  On sparc, PF_X really
64372c
 	is valid in RELRO.
64372c
 
64372c
+2008-03-01  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* readelf.c (dump_archive_index): Tweak portability hack
64372c
+	to match [__GNUC__ < 4] too.
64372c
+
64372c
 2008-02-29  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
 	* readelf.c (print_attributes): Add a cast.
64372c
@@ -1711,6 +1726,8 @@
64372c
 
64372c
 	* readelf.c (hex_dump): Fix rounding error in whitespace calculation.
64372c
 
64372c
+	* Makefile.am (readelf_no_Werror): New variable.
64372c
+
64372c
 2007-10-15  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
 	* make-debug-archive.in: New file.
64372c
@@ -2150,6 +2167,10 @@
64372c
 	* elflint.c (valid_e_machine): Add EM_ALPHA.
64372c
 	Reported by Christian Aichinger <Greek0@gmx.net>.
64372c
 
64372c
+	* strings.c (map_file): Define POSIX_MADV_SEQUENTIAL to
64372c
+	MADV_SEQUENTIAL if undefined.  	Don't call posix_madvise
64372c
+	if neither is defined.
64372c
+
64372c
 2006-08-08  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
64372c
@@ -2226,6 +2247,10 @@
64372c
 	* Makefile.am: Add hacks to create dependency files for non-generic
64372c
 	linker.
64372c
 
64372c
+2006-04-05  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* strings.c (MAP_POPULATE): Define to 0 if undefined.
64372c
+
64372c
 2006-06-12  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* ldgeneric.c (ld_generic_generate_sections): Don't create .interp
64372c
@@ -2574,6 +2599,11 @@
64372c
 	* readelf.c (print_debug_loc_section): Fix indentation for larger
64372c
 	address size.
64372c
 
64372c
+2005-05-31  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* Makefile.am (WEXTRA): New variable, substituted by configure.
64372c
+	(AM_CFLAGS): Use it in place of -Wextra.
64372c
+
64372c
 2005-05-30  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
 	* readelf.c (print_debug_line_section): Print section offset of each
64372c
--- elfutils/src/findtextrel.c
64372c
+++ elfutils/src/findtextrel.c
64372c
@@ -496,7 +496,11 @@ ptrcompare (const void *p1, const void *
64372c
 
64372c
 
64372c
 static void
64372c
-check_rel (size_t nsegments, struct segments segments[nsegments],
64372c
+check_rel (size_t nsegments, struct segments segments[
64372c
+#if __GNUC__ >= 4
64372c
+						      nsegments
64372c
+#endif
64372c
+	   ],
64372c
 	   GElf_Addr addr, Elf *elf, Elf_Scn *symscn, Dwarf *dw,
64372c
 	   const char *fname, bool more_than_one, void **knownsrcs)
64372c
 {
64372c
--- elfutils/src/ld.h
64372c
+++ elfutils/src/ld.h
64372c
@@ -1114,6 +1114,7 @@ extern bool dynamically_linked_p (void);
64372c
 
64372c
 /* Checked whether the symbol is undefined and referenced from a DSO.  */
64372c
 extern bool linked_from_dso_p (struct scninfo *scninfo, size_t symidx);
64372c
+#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
64372c
 #ifdef __GNUC_STDC_INLINE__
64372c
 __attribute__ ((__gnu_inline__))
64372c
 #endif
64372c
@@ -1131,5 +1132,6 @@ linked_from_dso_p (struct scninfo *scnin
64372c
 
64372c
   return sym->defined && sym->in_dso;
64372c
 }
64372c
+#endif	/* Optimizing and not GCC 4.2.  */
64372c
 
64372c
 #endif	/* ld.h */
64372c
--- elfutils/src/Makefile.am
64372c
+++ elfutils/src/Makefile.am
64372c
@@ -89,6 +89,11 @@ endif
64372c
 # XXX While the file is not finished, don't warn about this
64372c
 ldgeneric_no_Wunused = yes
64372c
 
64372c
+# Buggy old compilers or libc headers.
64372c
+readelf_no_Werror = yes
64372c
+strings_no_Werror = yes
64372c
+addr2line_no_Wformat = yes
64372c
+
64372c
 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl
64372c
 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl \
64372c
 	   $(demanglelib)
64372c
--- elfutils/src/Makefile.in
64372c
+++ elfutils/src/Makefile.in
64372c
@@ -85,6 +85,7 @@ DIST_COMMON = $(top_srcdir)/config/eu.am
64372c
 	$(srcdir)/Makefile.am ldlex.c ldscript.c \
64372c
 	$(top_srcdir)/config/depcomp $(top_srcdir)/config/ylwrap \
64372c
 	$(noinst_HEADERS) ChangeLog
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
 bin_PROGRAMS = readelf$(EXEEXT) nm$(EXEEXT) size$(EXEEXT) \
64372c
 	strip$(EXEEXT) ld$(EXEEXT) elflint$(EXEEXT) \
64372c
 	findtextrel$(EXEEXT) addr2line$(EXEEXT) elfcmp$(EXEEXT) \
64372c
@@ -93,9 +94,9 @@ bin_PROGRAMS = readelf$(EXEEXT) nm$(EXEE
64372c
 @NATIVE_LD_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1)
64372c
 # We never build this library but we need to get the dependency files
64372c
 # of all the linker backends that might be used in a non-generic linker.
64372c
-@NEVER_TRUE@am__append_1 = libdummy.a
64372c
+@NEVER_TRUE@am__append_2 = libdummy.a
64372c
 # -ldl is always needed for libebl.
64372c
-@NATIVE_LD_TRUE@am__append_2 = libld_elf.a
64372c
+@NATIVE_LD_TRUE@am__append_3 = libld_elf.a
64372c
 @NATIVE_LD_TRUE@am_libld_elf_i386_pic_a_OBJECTS =
64372c
 subdir = src
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
@@ -159,7 +160,7 @@ am_ld_OBJECTS = ld.$(OBJEXT) ldgeneric.$
64372c
 	ldscript.$(OBJEXT) symbolhash.$(OBJEXT) sectionhash.$(OBJEXT) \
64372c
 	versionhash.$(OBJEXT)
64372c
 ld_OBJECTS = $(am_ld_OBJECTS)
64372c
-ld_DEPENDENCIES = $(libebl) $(libelf) $(libeu) $(am__append_2)
64372c
+ld_DEPENDENCIES = $(libebl) $(libelf) $(libeu) $(am__append_3)
64372c
 ld_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ld_LDFLAGS) $(LDFLAGS) -o \
64372c
 	$@
64372c
 am_libld_elf_i386_so_OBJECTS =
64372c
@@ -340,6 +341,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -371,6 +373,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = @VERSION@
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -434,11 +437,11 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
64372c
 	-I$(srcdir)/../libelf -I$(srcdir)/../libebl \
64372c
 	-I$(srcdir)/../libdw -I$(srcdir)/../libdwelf \
64372c
 	-I$(srcdir)/../libdwfl -I$(srcdir)/../libasm
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
64372c
-	    $(if $($(*F)_no_Werror),,-Werror) \
64372c
-	    $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
64372c
-	    $($(*F)_CFLAGS)
64372c
-
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
+	$($(*F)_no_Werror),,-Werror) $(if \
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1)
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda make-debug-archive none_ld.os \
64372c
 	$(ld_modules:.c=.os) *.gconv
64372c
@@ -449,8 +452,8 @@ AM_LFLAGS = -Pld -olex.yy.c
64372c
 native_ld = @native_ld@
64372c
 ld_dsos = libld_elf_i386_pic.a
64372c
 @NATIVE_LD_FALSE@noinst_LIBRARIES = libld_elf.a libar.a $(ld_dsos) \
64372c
-@NATIVE_LD_FALSE@	$(am__append_1)
64372c
-@NATIVE_LD_TRUE@noinst_LIBRARIES = libld_elf.a libar.a $(am__append_1)
64372c
+@NATIVE_LD_FALSE@	$(am__append_2)
64372c
+@NATIVE_LD_TRUE@noinst_LIBRARIES = libld_elf.a libar.a $(am__append_2)
64372c
 @NATIVE_LD_TRUE@native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu)
64372c
 @NEVER_TRUE@libdummy_a_SOURCES = i386_ld.c
64372c
 ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \
64372c
@@ -476,13 +479,18 @@ libeu = ../lib/libeu.a
64372c
 
64372c
 # XXX While the file is not finished, don't warn about this
64372c
 ldgeneric_no_Wunused = yes
64372c
+
64372c
+# Buggy old compilers or libc headers.
64372c
+readelf_no_Werror = yes
64372c
+strings_no_Werror = yes
64372c
+addr2line_no_Wformat = yes
64372c
 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl
64372c
 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl \
64372c
 	   $(demanglelib)
64372c
 
64372c
 size_LDADD = $(libelf) $(libeu)
64372c
 strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl
64372c
-ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(am__append_2)
64372c
+ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl $(am__append_3)
64372c
 ld_LDFLAGS = -rdynamic
64372c
 elflint_LDADD = $(libebl) $(libelf) $(libeu) -ldl
64372c
 findtextrel_LDADD = $(libdw) $(libelf)
64372c
--- elfutils/src/readelf.c
64372c
+++ elfutils/src/readelf.c
64372c
@@ -4239,10 +4239,12 @@ listptr_base (struct listptr *p)
64372c
   return base;
64372c
 }
64372c
 
64372c
+static const char *listptr_name;
64372c
+
64372c
 static int
64372c
-compare_listptr (const void *a, const void *b, void *arg)
64372c
+compare_listptr (const void *a, const void *b)
64372c
 {
64372c
-  const char *name = arg;
64372c
+  const char *const name = listptr_name;
64372c
   struct listptr *p1 = (void *) a;
64372c
   struct listptr *p2 = (void *) b;
64372c
 
64372c
@@ -4331,8 +4333,11 @@ static void
64372c
 sort_listptr (struct listptr_table *table, const char *name)
64372c
 {
64372c
   if (table->n > 0)
64372c
-    qsort_r (table->table, table->n, sizeof table->table[0],
64372c
-	     &compare_listptr, (void *) name);
64372c
+    {
64372c
+      listptr_name = name;
64372c
+      qsort (table->table, table->n, sizeof table->table[0],
64372c
+	     &compare_listptr);
64372c
+    }
64372c
 }
64372c
 
64372c
 static bool
64372c
@@ -9252,7 +9257,7 @@ dump_archive_index (Elf *elf, const char
64372c
 	  if (unlikely (elf_rand (elf, as_off) == 0)
64372c
 	      || unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf))
64372c
 			   == NULL))
64372c
-#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7)
64372c
+#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7) || __GNUC__ < 4
64372c
 	    while (1)
64372c
 #endif
64372c
 	      error (EXIT_FAILURE, 0,
64372c
--- elfutils/src/strings.c
64372c
+++ elfutils/src/strings.c
64372c
@@ -43,6 +43,10 @@
64372c
 
64372c
 #include <system.h>
64372c
 
64372c
+#ifndef MAP_POPULATE
64372c
+# define MAP_POPULATE 0
64372c
+#endif
64372c
+
64372c
 
64372c
 /* Prototypes of local functions.  */
64372c
 static int read_fd (int fd, const char *fname, off64_t fdlen);
64372c
@@ -489,8 +493,13 @@ map_file (int fd, off64_t start_off, off
64372c
 		    fd, start_off);
64372c
       if (mem != MAP_FAILED)
64372c
 	{
64372c
+#if !defined POSIX_MADV_SEQUENTIAL && defined MADV_SEQUENTIAL
64372c
+# define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
64372c
+#endif
64372c
+#ifdef POSIX_MADV_SEQUENTIAL
64372c
 	  /* We will go through the mapping sequentially.  */
64372c
 	  (void) posix_madvise (mem, map_size, POSIX_MADV_SEQUENTIAL);
64372c
+#endif
64372c
 	  break;
64372c
 	}
64372c
       if (errno != EINVAL && errno != ENOMEM)
64372c
@@ -581,9 +590,11 @@ read_block (int fd, const char *fname, o
64372c
       elfmap_off = from & ~(ps - 1);
64372c
       elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size);
64372c
 
64372c
+#ifdef POSIX_FADV_SEQUENTIAL
64372c
       if (unlikely (elfmap == MAP_FAILED))
64372c
 	/* Let the kernel know we are going to read everything in sequence.  */
64372c
 	(void) posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
64372c
+#endif
64372c
     }
64372c
 
64372c
   if (unlikely (elfmap == MAP_FAILED))
64372c
--- elfutils/src/strip.c
64372c
+++ elfutils/src/strip.c
64372c
@@ -45,6 +45,12 @@
64372c
 #include <libebl.h>
64372c
 #include <system.h>
64372c
 
64372c
+#ifdef HAVE_FUTIMES
64372c
+# define FUTIMES(fd, fname, tvp) futimes (fd, tvp)
64372c
+#else
64372c
+# define FUTIMES(fd, fname, tvp) utimes (fname, tvp)
64372c
+#endif
64372c
+
64372c
 typedef uint8_t GElf_Byte;
64372c
 
64372c
 /* Name and version of program.  */
64372c
@@ -318,8 +324,18 @@ process_file (const char *fname)
64372c
 
64372c
       /* If we have to preserve the timestamp, we need it in the
64372c
 	 format utimes() understands.  */
64372c
+#ifdef HAVE_STRUCT_STAT_ST_ATIM
64372c
       TIMESPEC_TO_TIMEVAL (&tv[0], &pre_st.st_atim);
64372c
+#else
64372c
+      tv[0].tv_sec = pre_st.st_atime;
64372c
+      tv[0].tv_usec = 0;
64372c
+#endif
64372c
+#ifdef HAVE_STRUCT_STAT_ST_MTIM
64372c
       TIMESPEC_TO_TIMEVAL (&tv[1], &pre_st.st_mtim);
64372c
+#else
64372c
+      tv[1].tv_sec = pre_st.st_atime;
64372c
+      tv[1].tv_usec = 0;
64372c
+#endif
64372c
     }
64372c
 
64372c
   /* Open the file.  */
64372c
@@ -2086,7 +2102,7 @@ while computing checksum for debug infor
64372c
   /* If requested, preserve the timestamp.  */
64372c
   if (tvp != NULL)
64372c
     {
64372c
-      if (futimes (fd, tvp) != 0)
64372c
+      if (FUTIMES (fd, output_fname, tvp) != 0)
64372c
 	{
64372c
 	  error (0, errno, gettext ("\
64372c
 cannot set access and modification date of '%s'"),
64372c
@@ -2143,7 +2159,7 @@ handle_ar (int fd, Elf *elf, const char
64372c
 
64372c
   if (tvp != NULL)
64372c
     {
64372c
-      if (unlikely (futimes (fd, tvp) != 0))
64372c
+      if (unlikely (FUTIMES (fd, fname, tvp) != 0))
64372c
 	{
64372c
 	  error (0, errno, gettext ("\
64372c
 cannot set access and modification date of '%s'"), fname);
64372c
--- elfutils/tests/backtrace.c
64372c
+++ elfutils/tests/backtrace.c
64372c
@@ -36,6 +36,7 @@
64372c
 #include <fcntl.h>
64372c
 #include <string.h>
64372c
 #include <argp.h>
64372c
+#include <sys/syscall.h>
64372c
 #include ELFUTILS_HEADER(dwfl)
64372c
 
64372c
 #ifndef __linux__
64372c
--- elfutils/tests/ChangeLog
64372c
+++ elfutils/tests/ChangeLog
64372c
@@ -283,6 +283,13 @@
64372c
 
64372c
 2013-12-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
64372c
 
64372c
+	Handle T-stopped detach for old kernels.
64372c
+	* backtrace.c: Include sys/syscall.h.
64372c
+	(linux_proc_pid_is_stopped): New function.
64372c
+	(ptrace_detach_stopped): Handle old kernels.
64372c
+
64372c
+2013-12-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
64372c
+
64372c
 	* Makefile.am (check_PROGRAMS): Add backtrace, backtrace-child,
64372c
 	backtrace-data and backtrace-dwarf.
64372c
 	(BUILT_SOURCES, clean-local, backtrace-child-biarch): New.
64372c
@@ -1147,6 +1154,8 @@
64372c
 
64372c
 2008-01-21  Roland McGrath  <roland@redhat.com>
64372c
 
64372c
+	* line2addr.c (main): Revert last change.
64372c
+
64372c
 	* testfile45.S.bz2: Add tests for cltq, cqto.
64372c
 	* testfile45.expect.bz2: Adjust.
64372c
 
64372c
@@ -1855,6 +1864,11 @@
64372c
 	* Makefile.am (TESTS): Add run-elflint-test.sh.
64372c
 	(EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2.
64372c
 
64372c
+2005-05-31  Roland McGrath  <roland@redhat.com>
64372c
+
64372c
+	* Makefile.am (WEXTRA): New variable, substituted by configure.
64372c
+	(AM_CFLAGS): Use it in place of -Wextra.
64372c
+
64372c
 2005-05-24  Ulrich Drepper  <drepper@redhat.com>
64372c
 
64372c
 	* get-files.c (main): Use correct format specifier.
64372c
--- elfutils/tests/line2addr.c
64372c
+++ elfutils/tests/line2addr.c
64372c
@@ -124,7 +124,7 @@ main (int argc, char *argv[])
64372c
     {
64372c
       struct args a = { .arg = argv[cnt] };
64372c
 
64372c
-      switch (sscanf (a.arg, "%m[^:]:%d", &a.file, &a.line))
64372c
+      switch (sscanf (a.arg, "%a[^:]:%d", &a.file, &a.line))
64372c
 	{
64372c
 	default:
64372c
 	case 0:
64372c
--- elfutils/tests/Makefile.am
64372c
+++ elfutils/tests/Makefile.am
64372c
@@ -356,6 +356,7 @@ get_lines_LDADD = $(libdw) $(libelf)
64372c
 get_files_LDADD = $(libdw) $(libelf)
64372c
 get_aranges_LDADD = $(libdw) $(libelf)
64372c
 allfcts_LDADD = $(libdw) $(libelf)
64372c
+line2addr_no_Wformat = yes
64372c
 line2addr_LDADD = $(libdw)
64372c
 addrscopes_LDADD = $(libdw)
64372c
 funcscopes_LDADD = $(libdw)
64372c
--- elfutils/tests/Makefile.in
64372c
+++ elfutils/tests/Makefile.in
64372c
@@ -80,13 +80,14 @@ host_triplet = @host@
64372c
 DIST_COMMON = $(top_srcdir)/config/eu.am $(srcdir)/Makefile.in \
64372c
 	$(srcdir)/Makefile.am $(top_srcdir)/config/depcomp \
64372c
 	$(top_srcdir)/config/test-driver ChangeLog
64372c
-@STANDALONE_FALSE@am__append_1 = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \
64372c
+@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
64372c
+@STANDALONE_FALSE@am__append_2 = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \
64372c
 @STANDALONE_FALSE@	    -I$(top_srcdir)/libdwfl -I$(top_srcdir)/libdwelf \
64372c
 @STANDALONE_FALSE@	    -I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \
64372c
 @STANDALONE_FALSE@	    -I$(top_srcdir)/lib -I..
64372c
 
64372c
-@STANDALONE_FALSE@am__append_2 = -Wl,-rpath-link,../libasm:../libdw:../libelf
64372c
-@TESTS_RPATH_TRUE@am__append_3 = -Wl,-rpath,$(BUILD_RPATH)
64372c
+@STANDALONE_FALSE@am__append_3 = -Wl,-rpath-link,../libasm:../libdw:../libelf
64372c
+@TESTS_RPATH_TRUE@am__append_4 = -Wl,-rpath,$(BUILD_RPATH)
64372c
 check_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \
64372c
 	newfile$(EXEEXT) saridx$(EXEEXT) scnnames$(EXEEXT) \
64372c
 	sectiondump$(EXEEXT) showptable$(EXEEXT) update1$(EXEEXT) \
64372c
@@ -111,7 +112,7 @@ check_PROGRAMS = arextract$(EXEEXT) arsy
64372c
 	backtrace-data$(EXEEXT) backtrace-dwarf$(EXEEXT) \
64372c
 	debuglink$(EXEEXT) debugaltlink$(EXEEXT) buildid$(EXEEXT) \
64372c
 	$(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_4)
64372c
-@BIARCH_TRUE@am__append_4 = backtrace-child-biarch
64372c
+@BIARCH_TRUE@am__append_5 = backtrace-child-biarch
64372c
 TESTS = run-arextract.sh run-arsymtest.sh newfile$(EXEEXT) \
64372c
 	test-nlist$(EXEEXT) update1$(EXEEXT) update2$(EXEEXT) \
64372c
 	update3$(EXEEXT) update4$(EXEEXT) run-show-die-info.sh \
64372c
@@ -155,14 +156,14 @@ TESTS = run-arextract.sh run-arsymtest.s
64372c
 	run-backtrace-core-s390.sh run-backtrace-core-aarch64.sh \
64372c
 	run-backtrace-demangle.sh run-stack-d-test.sh \
64372c
 	run-stack-i-test.sh run-readelf-dwz-multi.sh \
64372c
-	run-allfcts-multi.sh $(am__EXEEXT_2) $(am__append_7) \
64372c
-	$(am__append_8) $(am__EXEEXT_4)
64372c
-@STANDALONE_FALSE@am__append_5 = msg_tst md5-sha1-test
64372c
+	run-allfcts-multi.sh $(am__EXEEXT_2) $(am__append_8) \
64372c
+	$(am__append_9) $(am__EXEEXT_4)
64372c
 @STANDALONE_FALSE@am__append_6 = msg_tst md5-sha1-test
64372c
-@LZMA_TRUE@am__append_7 = run-readelf-s.sh run-dwflsyms.sh
64372c
-@ZLIB_TRUE@am__append_8 = run-readelf-zdebug.sh
64372c
-@HAVE_LIBASM_TRUE@am__append_9 = $(asm_TESTS)
64372c
+@STANDALONE_FALSE@am__append_7 = msg_tst md5-sha1-test
64372c
+@LZMA_TRUE@am__append_8 = run-readelf-s.sh run-dwflsyms.sh
64372c
+@ZLIB_TRUE@am__append_9 = run-readelf-zdebug.sh
64372c
 @HAVE_LIBASM_TRUE@am__append_10 = $(asm_TESTS)
64372c
+@HAVE_LIBASM_TRUE@am__append_11 = $(asm_TESTS)
64372c
 subdir = tests
64372c
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
64372c
 am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
64372c
@@ -768,6 +769,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
64372c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
64372c
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
64372c
 LDFLAGS = @LDFLAGS@
64372c
+LD_AS_NEEDED = @LD_AS_NEEDED@
64372c
 LEX = @LEX@
64372c
 LEXLIB = @LEXLIB@
64372c
 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
64372c
@@ -799,6 +801,7 @@ SHELL = @SHELL@
64372c
 STRIP = @STRIP@
64372c
 USE_NLS = @USE_NLS@
64372c
 VERSION = @VERSION@
64372c
+WEXTRA = @WEXTRA@
64372c
 XGETTEXT = @XGETTEXT@
64372c
 XGETTEXT_015 = @XGETTEXT_015@
64372c
 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
64372c
@@ -858,17 +861,17 @@ top_build_prefix = @top_build_prefix@
64372c
 top_builddir = @top_builddir@
64372c
 top_srcdir = @top_srcdir@
64372c
 zip_LIBS = @zip_LIBS@
64372c
-AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. $(am__append_1)
64372c
-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
64372c
-	    $(if $($(*F)_no_Werror),,-Werror) \
64372c
-	    $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
64372c
-	    $($(*F)_CFLAGS)
64372c
-
64372c
+AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. $(am__append_2)
64372c
+AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
64372c
+	$($(*F)_no_Werror),,-Werror) $(if \
64372c
+	$($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
64372c
+	$($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
64372c
+	$(am__append_1)
64372c
 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
64372c
 CLEANFILES = *.gcno *.gcda
64372c
 textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then exit 1; fi
64372c
 BUILD_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf
64372c
-AM_LDFLAGS = $(am__append_2) $(am__append_3)
64372c
+AM_LDFLAGS = $(am__append_3) $(am__append_4)
64372c
 @TESTS_RPATH_FALSE@tests_rpath = no
64372c
 @TESTS_RPATH_TRUE@tests_rpath = yes
64372c
 asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
64372c
@@ -1077,6 +1080,7 @@ get_lines_LDADD = $(libdw) $(libelf)
64372c
 get_files_LDADD = $(libdw) $(libelf)
64372c
 get_aranges_LDADD = $(libdw) $(libelf)
64372c
 allfcts_LDADD = $(libdw) $(libelf)
64372c
+line2addr_no_Wformat = yes
64372c
 line2addr_LDADD = $(libdw)
64372c
 addrscopes_LDADD = $(libdw)
64372c
 funcscopes_LDADD = $(libdw)