elfutils: bump to 0.163
[openwrt.git] / package / libs / elfutils / patches / 001-elfutils-portability.patch
1 diffelfutils/backends/ChangeLog git-portable/backends/ChangeLog
2 --- a/backends/ChangeLog
3 +++ b/backends/ChangeLog
4 @@ -498,6 +498,10 @@
5         * ppc_attrs.c (ppc_check_object_attribute): Handle tag
6         GNU_Power_ABI_Struct_Return.
7  
8 +2009-01-23  Roland McGrath  <roland@redhat.com>
9 +
10 +       * Makefile.am (libebl_%.so): Use $(LD_AS_NEEDED).
11 +
12  2008-10-04  Ulrich Drepper  <drepper@redhat.com>
13  
14         * i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and
15 @@ -825,6 +829,11 @@
16         * sparc_init.c: Likewise.
17         * x86_64_init.c: Likewise.
18  
19 +2005-11-22  Roland McGrath  <roland@redhat.com>
20 +
21 +       * Makefile.am (LD_AS_NEEDED): New variable, substituted by configure.
22 +       (libebl_%.so rule): Use it in place of -Wl,--as-needed.
23 +
24  2005-11-19  Roland McGrath  <roland@redhat.com>
25  
26         * ppc64_reloc.def: REL30 -> ADDR30.
27 @@ -847,6 +856,9 @@
28         * Makefile.am (uninstall): Don't try to remove $(pkgincludedir).
29         (CLEANFILES): Add libebl_$(m).so.
30  
31 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
32 +       (AM_CFLAGS): Use it in place of -Wextra.
33 +
34         * ppc_reloc.def: Update bits per Alan Modra <amodra@bigpond.net.au>.
35         * ppc64_reloc.def: Likewise.
36  
37 --- a/backends/Makefile.am
38 +++ b/backends/Makefile.am
39 @@ -119,7 +119,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
40         $(LINK) -shared -o $(@:.map=.so) \
41                 -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
42                 -Wl,--version-script,$(@:.so=.map) \
43 -               -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw)
44 +               -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw)
45         @$(textrel_check)
46  
47  libebl_i386.so: $(cpu_i386)
48 --- a/backends/Makefile.in
49 +++ b/backends/Makefile.in
50 @@ -90,7 +90,8 @@ PRE_UNINSTALL = :
51  POST_UNINSTALL = :
52  build_triplet = @build@
53  host_triplet = @host@
54 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
55 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
56 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
57  subdir = backends
58  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
59  am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
60 @@ -300,6 +301,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
61  INSTALL_SCRIPT = @INSTALL_SCRIPT@
62  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
63  LDFLAGS = @LDFLAGS@
64 +LD_AS_NEEDED = @LD_AS_NEEDED@
65  LEX = @LEX@
66  LEXLIB = @LEXLIB@
67  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
68 @@ -331,6 +333,7 @@ SHELL = @SHELL@
69  STRIP = @STRIP@
70  USE_NLS = @USE_NLS@
71  VERSION = @VERSION@
72 +WEXTRA = @WEXTRA@
73  XGETTEXT = @XGETTEXT@
74  XGETTEXT_015 = @XGETTEXT_015@
75  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
76 @@ -398,14 +401,14 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
77  
78  # Warn about stack usage of more than 256K = 262144 bytes.
79  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
80 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
81 -           $(if $($(*F)_no_Werror),,-Werror) \
82 -           $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
83 -           $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
84 -           $($(*F)_CFLAGS)
85 -
86 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
87 +       $($(*F)_no_Werror),,-Werror) $(if \
88 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
89 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
90 +       $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
91 +       $($(*F)_CFLAGS) $(am__append_1)
92  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
93 -DEFS.os = -DPIC -DSHARED $(am__append_1)
94 +DEFS.os = -DPIC -DSHARED $(am__append_2)
95  CLEANFILES = *.gcno *.gcda $(foreach m,$(modules), libebl_$(m).map \
96         libebl_$(m).so $(am_libebl_$(m)_pic_a_OBJECTS))
97  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
98 @@ -912,7 +915,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
99         $(LINK) -shared -o $(@:.map=.so) \
100                 -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
101                 -Wl,--version-script,$(@:.so=.map) \
102 -               -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw)
103 +               -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw)
104         @$(textrel_check)
105  
106  libebl_i386.so: $(cpu_i386)
107 --- a/ChangeLog
108 +++ b/ChangeLog
109 @@ -258,6 +258,8 @@
110  
111  2012-01-24  Mark Wielaard  <mjw@redhat.com>
112  
113 +       * configure.ac: Wrap AC_COMPILE_IFELSE sources in AC_LANG_SOURCE.
114 +
115         * COPYING: Fix address. Updated version from gnulib.
116  
117  2012-01-23  Mark Wielaard  <mjw@redhat.com>
118 @@ -276,6 +278,9 @@
119  
120  2011-10-08  Mike Frysinger  <vapier@gentoo.org>
121  
122 +       * configure.ac (--disable-werror): Handle it, controlling BUILD_WERROR
123 +       automake option.
124 +
125         * configure.ac: Fix use of AC_ARG_ENABLE to handle $enableval correctly.
126  
127  2011-10-02  Ulrich Drepper  <drepper@gmail.com>
128 @@ -297,6 +302,10 @@
129  
130         * configure.ac (LOCALEDIR, DATADIRNAME): Removed.
131  
132 +2009-11-22  Roland McGrath  <roland@redhat.com>
133 +
134 +       * configure.ac: Use sed and expr instead of modern bash extensions.
135 +
136  2009-09-21  Ulrich Drepper  <drepper@redhat.com>
137  
138         * configure.ac: Update for more modern autoconf.
139 @@ -305,6 +314,10 @@
140  
141         * configure.ac (zip_LIBS): Check for liblzma too.
142  
143 +2009-08-17  Roland McGrath  <roland@redhat.com>
144 +
145 +       * configure.ac: Check for -fgnu89-inline; add it to WEXTRA if it works.
146 +
147  2009-04-19  Roland McGrath  <roland@redhat.com>
148  
149         * configure.ac (eu_version): Round down here, not in version.h macros.
150 @@ -316,6 +329,8 @@
151  
152  2009-01-23  Roland McGrath  <roland@redhat.com>
153  
154 +       * configure.ac: Check for __builtin_popcount.
155 +
156         * configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3.
157  
158         * configure.ac (__thread check): Use AC_LINK_IFELSE, in case of
159 @@ -396,6 +411,10 @@
160         * configure.ac: Add dummy automake conditional to get dependencies
161         for non-generic linker right.  See src/Makefile.am.
162  
163 +2005-11-22  Roland McGrath  <roland@redhat.com>
164 +
165 +       * configure.ac: Check for --as-needed linker option.
166 +
167  2005-11-18  Roland McGrath  <roland@redhat.com>
168  
169         * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable.
170 @@ -443,6 +462,17 @@
171         * Makefile.am (all_SUBDIRS): Add libdwfl.
172         * configure.ac: Write libdwfl/Makefile.
173  
174 +2005-05-31  Roland McGrath  <roland@redhat.com>
175 +
176 +       * configure.ac (WEXTRA): Check for -Wextra and set this substitution.
177 +
178 +       * configure.ac: Check for struct stat st_?tim members.
179 +       * src/strip.c (process_file): Use st_?time if st_?tim are not there.
180 +
181 +       * configure.ac: Check for futimes function.
182 +       * src/strip.c (handle_elf) [! HAVE_FUTIMES]: Use utimes instead.
183 +       (handle_ar) [! HAVE_FUTIMES]: Likewise.
184 +
185  2005-05-19  Roland McGrath  <roland@redhat.com>
186  
187         * configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros.
188 --- a/config/ChangeLog
189 +++ b/config/ChangeLog
190 @@ -110,6 +110,10 @@
191  
192         * known-dwarf.awk: Use gawk.
193  
194 +2011-10-08  Mike Frysinger  <vapier@gentoo.org>
195 +
196 +       * eu.am [BUILD_WERROR]: Conditionalize -Werror use on this.
197 +
198  2010-07-02  Ulrich Drepper  <drepper@redhat.com>
199  
200         * elfutils.spec.in: Add more BuildRequires.
201 --- a/config/eu.am
202 +++ b/config/eu.am
203 @@ -1,6 +1,6 @@
204  ## Common automake fragments for elfutils subdirectory makefiles.
205  ##
206 -## Copyright (C) 2010, 2014 Red Hat, Inc.
207 +## Copyright (C) 2010-2011, 2014 Red Hat, Inc.
208  ##
209  ## This file is part of elfutils.
210  ##
211 @@ -29,6 +29,9 @@
212  ## not, see <http://www.gnu.org/licenses/>.
213  ##
214  
215 +WEXTRA = @WEXTRA@
216 +LD_AS_NEEDED = @LD_AS_NEEDED@
217 +
218  DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
219  AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
220  
221 @@ -38,12 +41,17 @@ STACK_USAGE_WARNING=-Wstack-usage=262144
222  else
223  STACK_USAGE_WARNING=
224  endif
225 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
226 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
227             $(if $($(*F)_no_Werror),,-Werror) \
228 -           $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
229 +           $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \
230 +           $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
231             $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
232             $($(*F)_CFLAGS)
233  
234 +if BUILD_WERROR
235 +AM_CFLAGS += $(if $($(*F)_no_Werror),,-Werror)
236 +endif
237 +
238  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
239  
240  DEFS.os = -DPIC -DSHARED
241 --- a/config/Makefile.in
242 +++ b/config/Makefile.in
243 @@ -160,6 +160,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
244  INSTALL_SCRIPT = @INSTALL_SCRIPT@
245  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
246  LDFLAGS = @LDFLAGS@
247 +LD_AS_NEEDED = @LD_AS_NEEDED@
248  LEX = @LEX@
249  LEXLIB = @LEXLIB@
250  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
251 @@ -191,6 +192,7 @@ SHELL = @SHELL@
252  STRIP = @STRIP@
253  USE_NLS = @USE_NLS@
254  VERSION = @VERSION@
255 +WEXTRA = @WEXTRA@
256  XGETTEXT = @XGETTEXT@
257  XGETTEXT_015 = @XGETTEXT_015@
258  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
259 --- a/config.h.in
260 +++ b/config.h.in
261 @@ -6,6 +6,12 @@
262  /* Should ar and ranlib use -D behavior by default? */
263  #undef DEFAULT_AR_DETERMINISTIC
264  
265 +/* Have __builtin_popcount. */
266 +#undef HAVE_BUILTIN_POPCOUNT
267 +
268 +/* Define to 1 if you have the `futimens' function. */
269 +#undef HAVE_FUTIMENS
270 +
271  /* Define to 1 if you have the <inttypes.h> header file. */
272  #undef HAVE_INTTYPES_H
273  
274 @@ -105,4 +111,7 @@
275  /* Define for large files, on AIX-style hosts. */
276  #undef _LARGE_FILES
277  
278 +/* Stubbed out if missing compiler support. */
279 +#undef __thread
280 +
281  #include <eu-config.h>
282 --- a/configure
283 +++ b/configure
284 @@ -672,6 +672,8 @@ ZLIB_TRUE
285  LIBEBL_SUBDIR
286  TESTS_RPATH_FALSE
287  TESTS_RPATH_TRUE
288 +BUILD_WERROR_FALSE
289 +BUILD_WERROR_TRUE
290  BUILD_STATIC_FALSE
291  BUILD_STATIC_TRUE
292  USE_VALGRIND_FALSE
293 @@ -687,6 +689,8 @@ NEVER_TRUE
294  base_cpu
295  NATIVE_LD_FALSE
296  NATIVE_LD_TRUE
297 +LD_AS_NEEDED
298 +WEXTRA
299  NM
300  READELF
301  ac_ct_AR
302 @@ -807,6 +811,7 @@ enable_gprof
303  enable_gcov
304  enable_sanitize_undefined
305  enable_valgrind
306 +enable_werror
307  enable_tests_rpath
308  enable_libebl_subdir
309  with_zlib
310 @@ -1467,6 +1472,7 @@ Optional Features:
311    --enable-sanitize-undefined
312                            Use gcc undefined behaviour sanitizer
313    --enable-valgrind       run all tests under valgrind
314 +  --disable-werror        do not build with -Werror
315    --enable-tests-rpath    build $ORIGIN-using rpath into tests
316    --enable-libebl-subdir=DIR
317                            install libebl_CPU modules in $(libdir)/DIR
318 @@ -1665,6 +1671,73 @@ fi
319  
320  } # ac_fn_c_try_link
321  
322 +# ac_fn_c_check_func LINENO FUNC VAR
323 +# ----------------------------------
324 +# Tests whether FUNC exists, setting the cache variable VAR accordingly
325 +ac_fn_c_check_func ()
326 +{
327 +  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
328 +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
329 +$as_echo_n "checking for $2... " >&6; }
330 +if eval \${$3+:} false; then :
331 +  $as_echo_n "(cached) " >&6
332 +else
333 +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
334 +/* end confdefs.h.  */
335 +/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
336 +   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
337 +#define $2 innocuous_$2
338 +
339 +/* System header to define __stub macros and hopefully few prototypes,
340 +    which can conflict with char $2 (); below.
341 +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
342 +    <limits.h> exists even on freestanding compilers.  */
343 +
344 +#ifdef __STDC__
345 +# include <limits.h>
346 +#else
347 +# include <assert.h>
348 +#endif
349 +
350 +#undef $2
351 +
352 +/* Override any GCC internal prototype to avoid an error.
353 +   Use char because int might match the return type of a GCC
354 +   builtin and then its argument prototype would still apply.  */
355 +#ifdef __cplusplus
356 +extern "C"
357 +#endif
358 +char $2 ();
359 +/* The GNU C library defines this for functions which it implements
360 +    to always fail with ENOSYS.  Some functions are actually named
361 +    something starting with __ and the normal name is an alias.  */
362 +#if defined __stub_$2 || defined __stub___$2
363 +choke me
364 +#endif
365 +
366 +int
367 +main ()
368 +{
369 +return $2 ();
370 +  ;
371 +  return 0;
372 +}
373 +_ACEOF
374 +if ac_fn_c_try_link "$LINENO"; then :
375 +  eval "$3=yes"
376 +else
377 +  eval "$3=no"
378 +fi
379 +rm -f core conftest.err conftest.$ac_objext \
380 +    conftest$ac_exeext conftest.$ac_ext
381 +fi
382 +eval ac_res=\$$3
383 +              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
384 +$as_echo "$ac_res" >&6; }
385 +  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
386 +
387 +} # ac_fn_c_check_func
388 +
389  # ac_fn_c_try_run LINENO
390  # ----------------------
391  # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
392 @@ -4825,6 +4898,18 @@ else
393  fi
394  
395  
396 +for ac_func in futimens
397 +do :
398 +  ac_fn_c_check_func "$LINENO" "futimens" "ac_cv_func_futimens"
399 +if test "x$ac_cv_func_futimens" = xyes; then :
400 +  cat >>confdefs.h <<_ACEOF
401 +#define HAVE_FUTIMENS 1
402 +_ACEOF
403 +
404 +fi
405 +done
406 +
407 +
408  # We use -std=gnu99 but have explicit checks for some language constructs
409  # and GNU extensions since some compilers claim GNU99 support, but don't
410  # really support all language extensions. In particular we need
411 @@ -4873,6 +4958,130 @@ if test "x$ac_cv_c99" != xyes; then :
412    as_fn_error $? "gcc with GNU99 support required" "$LINENO" 5
413  fi
414  
415 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra option to $CC" >&5
416 +$as_echo_n "checking for -Wextra option to $CC... " >&6; }
417 +if ${ac_cv_cc_wextra+:} false; then :
418 +  $as_echo_n "(cached) " >&6
419 +else
420 +  old_CFLAGS="$CFLAGS"
421 +CFLAGS="$CFLAGS -Wextra"
422 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
423 +/* end confdefs.h.  */
424 +void foo (void) { }
425 +_ACEOF
426 +if ac_fn_c_try_compile "$LINENO"; then :
427 +  ac_cv_cc_wextra=yes
428 +else
429 +  ac_cv_cc_wextra=no
430 +fi
431 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
432 +CFLAGS="$old_CFLAGS"
433 +fi
434 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_wextra" >&5
435 +$as_echo "$ac_cv_cc_wextra" >&6; }
436 +
437 +if test "x$ac_cv_cc_wextra" = xyes; then :
438 +  WEXTRA=-Wextra
439 +else
440 +  WEXTRA=-W
441 +fi
442 +
443 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fgnu89-inline option to $CC" >&5
444 +$as_echo_n "checking for -fgnu89-inline option to $CC... " >&6; }
445 +if ${ac_cv_cc_gnu89_inline+:} false; then :
446 +  $as_echo_n "(cached) " >&6
447 +else
448 +  old_CFLAGS="$CFLAGS"
449 +CFLAGS="$CFLAGS -fgnu89-inline -Werror"
450 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
451 +/* end confdefs.h.  */
452 +
453 +void foo (void)
454 +{
455 +  inline void bar (void) {}
456 +  bar ();
457 +}
458 +extern inline void baz (void) {}
459 +
460 +_ACEOF
461 +if ac_fn_c_try_compile "$LINENO"; then :
462 +  ac_cv_cc_gnu89_inline=yes
463 +else
464 +  ac_cv_cc_gnu89_inline=no
465 +fi
466 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
467 +CFLAGS="$old_CFLAGS"
468 +fi
469 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_gnu89_inline" >&5
470 +$as_echo "$ac_cv_cc_gnu89_inline" >&6; }
471 +if test "x$ac_cv_cc_gnu89_inline" = xyes; then :
472 +  WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"
473 +fi
474 +
475 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --as-needed linker option" >&5
476 +$as_echo_n "checking for --as-needed linker option... " >&6; }
477 +if ${ac_cv_as_needed+:} false; then :
478 +  $as_echo_n "(cached) " >&6
479 +else
480 +  cat > conftest.c <<EOF
481 +int main (void) { return 0; }
482 +EOF
483 +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
484 +                           -fPIC -shared -o conftest.so conftest.c
485 +                           -Wl,--as-needed 1>&5'
486 +  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
487 +  (eval $ac_try) 2>&5
488 +  ac_status=$?
489 +  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
490 +  test $ac_status = 0; }; }
491 +then
492 +  ac_cv_as_needed=yes
493 +else
494 +  ac_cv_as_needed=no
495 +fi
496 +rm -f conftest*
497 +fi
498 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_as_needed" >&5
499 +$as_echo "$ac_cv_as_needed" >&6; }
500 +if test "x$ac_cv_as_needed" = xyes; then :
501 +  LD_AS_NEEDED=-Wl,--as-needed
502 +else
503 +  LD_AS_NEEDED=
504 +fi
505 +
506 +
507 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_popcount" >&5
508 +$as_echo_n "checking for __builtin_popcount... " >&6; }
509 +if ${ac_cv_popcount+:} false; then :
510 +  $as_echo_n "(cached) " >&6
511 +else
512 +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
513 +/* end confdefs.h.  */
514 +
515 +int
516 +main ()
517 +{
518 +exit (__builtin_popcount (127));
519 +  ;
520 +  return 0;
521 +}
522 +_ACEOF
523 +if ac_fn_c_try_link "$LINENO"; then :
524 +  ac_cv_popcount=yes
525 +else
526 +  ac_cv_popcount=no
527 +fi
528 +rm -f core conftest.err conftest.$ac_objext \
529 +    conftest$ac_exeext conftest.$ac_ext
530 +fi
531 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_popcount" >&5
532 +$as_echo "$ac_cv_popcount" >&6; }
533 +if test "x$ac_cv_popcount" = xyes; then :
534 +
535 +$as_echo "#define HAVE_BUILTIN_POPCOUNT 1" >>confdefs.h
536 +
537 +fi
538 +
539  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __thread support" >&5
540  $as_echo_n "checking for __thread support... " >&6; }
541  if ${ac_cv_tls+:} false; then :
542 @@ -4910,7 +5119,13 @@ fi
543  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5
544  $as_echo "$ac_cv_tls" >&6; }
545  if test "x$ac_cv_tls" != xyes; then :
546 -  as_fn_error $? "__thread support required" "$LINENO" 5
547 +  if test "$use_locks" = yes; then :
548 +  as_fn_error $? "--enable-thread-safety requires __thread support" "$LINENO" 5
549 +else
550 +
551 +$as_echo "#define __thread /* empty: no multi-thread support */" >>confdefs.h
552 +
553 +fi
554  fi
555  
556  # Check whether --enable-largefile was given.
557 @@ -5318,6 +5533,22 @@ else
558  fi
559  
560  
561 +# Check whether --enable-werror was given.
562 +if test "${enable_werror+set}" = set; then :
563 +  enableval=$enable_werror; enable_werror=$enableval
564 +else
565 +  enable_werror=yes
566 +fi
567 +
568 + if test "$enable_werror" = yes; then
569 +  BUILD_WERROR_TRUE=
570 +  BUILD_WERROR_FALSE='#'
571 +else
572 +  BUILD_WERROR_TRUE='#'
573 +  BUILD_WERROR_FALSE=
574 +fi
575 +
576 +
577  # Check whether --enable-tests-rpath was given.
578  if test "${enable_tests_rpath+set}" = set; then :
579    enableval=$enable_tests_rpath; tests_use_rpath=$enableval
580 @@ -6199,7 +6430,7 @@ case "$eu_version" in
581  esac
582  
583  # Round up to the next release API (x.y) version.
584 -eu_version=$(( (eu_version + 999) / 1000 ))
585 +eu_version=`expr \( $eu_version + 999 \) / 1000`
586  
587  MODVERSION="Build for ${LIBEBL_SUBDIR} ${eu_version} ${ac_cv_build}"
588  
589 @@ -7088,6 +7319,10 @@ if test -z "${BUILD_STATIC_TRUE}" && tes
590    as_fn_error $? "conditional \"BUILD_STATIC\" was never defined.
591  Usually this means the macro was only invoked conditionally." "$LINENO" 5
592  fi
593 +if test -z "${BUILD_WERROR_TRUE}" && test -z "${BUILD_WERROR_FALSE}"; then
594 +  as_fn_error $? "conditional \"BUILD_WERROR\" was never defined.
595 +Usually this means the macro was only invoked conditionally." "$LINENO" 5
596 +fi
597  if test -z "${TESTS_RPATH_TRUE}" && test -z "${TESTS_RPATH_FALSE}"; then
598    as_fn_error $? "conditional \"TESTS_RPATH\" was never defined.
599  Usually this means the macro was only invoked conditionally." "$LINENO" 5
600 --- a/configure.ac
601 +++ b/configure.ac
602 @@ -73,6 +73,8 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
603  AC_CHECK_TOOL([READELF], [readelf])
604  AC_CHECK_TOOL([NM], [nm])
605  
606 +AC_CHECK_FUNCS([futimens])
607 +
608  # We use -std=gnu99 but have explicit checks for some language constructs
609  # and GNU extensions since some compilers claim GNU99 support, but don't
610  # really support all language extensions. In particular we need
611 @@ -106,6 +108,54 @@ CFLAGS="$old_CFLAGS"])
612  AS_IF([test "x$ac_cv_c99" != xyes],
613        AC_MSG_ERROR([gcc with GNU99 support required]))
614  
615 +AC_CACHE_CHECK([for -Wextra option to $CC], ac_cv_cc_wextra, [dnl
616 +old_CFLAGS="$CFLAGS"
617 +CFLAGS="$CFLAGS -Wextra"
618 +AC_COMPILE_IFELSE([AC_LANG_SOURCE([void foo (void) { }])],
619 +                 ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no)
620 +CFLAGS="$old_CFLAGS"])
621 +AC_SUBST(WEXTRA)
622 +AS_IF([test "x$ac_cv_cc_wextra" = xyes], [WEXTRA=-Wextra], [WEXTRA=-W])
623 +
624 +AC_CACHE_CHECK([for -fgnu89-inline option to $CC], ac_cv_cc_gnu89_inline, [dnl
625 +old_CFLAGS="$CFLAGS"
626 +CFLAGS="$CFLAGS -fgnu89-inline -Werror"
627 +AC_COMPILE_IFELSE([AC_LANG_SOURCE([
628 +void foo (void)
629 +{
630 +  inline void bar (void) {}
631 +  bar ();
632 +}
633 +extern inline void baz (void) {}
634 +])], ac_cv_cc_gnu89_inline=yes, ac_cv_cc_gnu89_inline=no)
635 +CFLAGS="$old_CFLAGS"])
636 +AS_IF([test "x$ac_cv_cc_gnu89_inline" = xyes],
637 +      [WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"])
638 +
639 +AC_CACHE_CHECK([for --as-needed linker option],
640 +              ac_cv_as_needed, [dnl
641 +cat > conftest.c <<EOF
642 +int main (void) { return 0; }
643 +EOF
644 +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
645 +                           -fPIC -shared -o conftest.so conftest.c
646 +                           -Wl,--as-needed 1>&AS_MESSAGE_LOG_FD])
647 +then
648 +  ac_cv_as_needed=yes
649 +else
650 +  ac_cv_as_needed=no
651 +fi
652 +rm -f conftest*])
653 +AS_IF([test "x$ac_cv_as_needed" = xyes],
654 +      [LD_AS_NEEDED=-Wl,--as-needed], [LD_AS_NEEDED=])
655 +AC_SUBST(LD_AS_NEEDED)
656 +
657 +AC_CACHE_CHECK([for __builtin_popcount], ac_cv_popcount, [dnl
658 +AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[exit (__builtin_popcount (127));]])],
659 +              ac_cv_popcount=yes, ac_cv_popcount=no)])
660 +AS_IF([test "x$ac_cv_popcount" = xyes],
661 +      [AC_DEFINE([HAVE_BUILTIN_POPCOUNT], [1], [Have __builtin_popcount.])])
662 +
663  AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
664  # Use the same flags that we use for our DSOs, so the test is representative.
665  # Some old compiler/linker/libc combinations fail some ways and not others.
666 @@ -122,7 +172,10 @@ static __thread int a; int foo (int b) {
667  CFLAGS="$save_CFLAGS"
668  LDFLAGS="$save_LDFLAGS"])
669  AS_IF([test "x$ac_cv_tls" != xyes],
670 -      AC_MSG_ERROR([__thread support required]))
671 +      [AS_IF([test "$use_locks" = yes],
672 +            [AC_MSG_ERROR([--enable-thread-safety requires __thread support])],
673 +            [AC_DEFINE([__thread], [/* empty: no multi-thread support */],
674 +                       [Stubbed out if missing compiler support.])])])
675  
676  dnl This test must come as early as possible after the compiler configuration
677  dnl tests, because the choice of the file model can (in principle) affect
678 @@ -224,6 +277,11 @@ AM_CONDITIONAL(USE_VALGRIND, test "$use_
679  AM_CONDITIONAL(BUILD_STATIC, [dnl
680  test "$use_gprof" = yes -o "$use_gcov" = yes])
681  
682 +AC_ARG_ENABLE([werror],
683 +AS_HELP_STRING([--disable-werror],[do not build with -Werror]),
684 +              [enable_werror=$enableval], [enable_werror=yes])
685 +AM_CONDITIONAL(BUILD_WERROR, test "$enable_werror" = yes)
686 +
687  AC_ARG_ENABLE([tests-rpath],
688  AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
689                [tests_use_rpath=$enableval], [tests_use_rpath=no])
690 @@ -388,7 +446,7 @@ case "$eu_version" in
691  esac
692  
693  # Round up to the next release API (x.y) version.
694 -eu_version=$(( (eu_version + 999) / 1000 ))
695 +eu_version=`expr \( $eu_version + 999 \) / 1000`
696  
697  dnl Unique ID for this build.
698  MODVERSION="Build for ${LIBEBL_SUBDIR} ${eu_version} ${ac_cv_build}"
699 --- a/lib/ChangeLog
700 +++ b/lib/ChangeLog
701 @@ -73,6 +73,9 @@
702  
703  2009-01-23  Roland McGrath  <roland@redhat.com>
704  
705 +       * eu-config.h [! HAVE_BUILTIN_POPCOUNT]
706 +       (__builtin_popcount): New inline function.
707 +
708         * eu-config.h: Add multiple inclusion protection.
709  
710  2009-01-17  Ulrich Drepper  <drepper@redhat.com>
711 @@ -129,6 +132,11 @@
712         * Makefile.am (libeu_a_SOURCES): Add it.
713         * system.h: Declare crc32_file.
714  
715 +2005-02-07  Roland McGrath  <roland@redhat.com>
716 +
717 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
718 +       (AM_CFLAGS): Use it in place of -Wextra.
719 +
720  2005-04-30  Ulrich Drepper  <drepper@redhat.com>
721  
722         * Makefile.am: Use -ffunction-sections for xmalloc.c.
723 --- a/lib/eu-config.h
724 +++ b/lib/eu-config.h
725 @@ -163,6 +163,17 @@ asm (".section predict_data, \"aw\"; .pr
726  /* This macro is used by the tests conditionalize for standalone building.  */
727  #define ELFUTILS_HEADER(name) <lib##name.h>
728  
729 +#ifndef HAVE_BUILTIN_POPCOUNT
730 +# define __builtin_popcount hakmem_popcount
731 +static inline unsigned int __attribute__ ((unused))
732 +hakmem_popcount (unsigned int x)
733 +{
734 +  /* HAKMEM 169 */
735 +  unsigned int n = x - ((x >> 1) & 033333333333) - ((x >> 2) & 011111111111);
736 +  return ((n + (n >> 3)) & 030707070707) % 63;
737 +}
738 +#endif /* HAVE_BUILTIN_POPCOUNT */
739 +
740  
741  #ifdef SYMBOL_VERSIONING
742  # define OLD_VERSION(name, version) \
743 --- a/lib/Makefile.in
744 +++ b/lib/Makefile.in
745 @@ -89,7 +89,8 @@ PRE_UNINSTALL = :
746  POST_UNINSTALL = :
747  build_triplet = @build@
748  host_triplet = @host@
749 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
750 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
751 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
752  subdir = lib
753  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
754  am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
755 @@ -212,6 +213,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
756  INSTALL_SCRIPT = @INSTALL_SCRIPT@
757  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
758  LDFLAGS = @LDFLAGS@
759 +LD_AS_NEEDED = @LD_AS_NEEDED@
760  LEX = @LEX@
761  LEXLIB = @LEXLIB@
762  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
763 @@ -243,6 +245,7 @@ SHELL = @SHELL@
764  STRIP = @STRIP@
765  USE_NLS = @USE_NLS@
766  VERSION = @VERSION@
767 +WEXTRA = @WEXTRA@
768  XGETTEXT = @XGETTEXT@
769  XGETTEXT_015 = @XGETTEXT_015@
770  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
771 @@ -309,13 +312,14 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
772  
773  # Warn about stack usage of more than 256K = 262144 bytes.
774  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
775 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
776 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
777         $($(*F)_no_Werror),,-Werror) $(if \
778 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
779 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
780 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
781         $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
782 -       $($(*F)_CFLAGS) -fpic
783 +       $($(*F)_CFLAGS) $(am__append_1) -fpic
784  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
785 -DEFS.os = -DPIC -DSHARED $(am__append_1)
786 +DEFS.os = -DPIC -DSHARED $(am__append_2)
787  CLEANFILES = *.gcno *.gcda
788  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
789  @FATAL_TEXTREL_FALSE@textrel_found = $(textrel_msg)
790 --- a/libasm/ChangeLog
791 +++ b/libasm/ChangeLog
792 @@ -87,6 +87,11 @@
793         * asm_error.c: Add new error ASM_E_IOERROR.
794         * libasmP.h: Add ASM_E_IOERROR definition.
795  
796 +2005-05-31  Roland McGrath  <roland@redhat.com>
797 +
798 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
799 +       (AM_CFLAGS): Use it in place of -Wextra.
800 +
801  2005-02-15  Ulrich Drepper  <drepper@redhat.com>
802  
803         * Makefile.am (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
804 --- a/libasm/Makefile.in
805 +++ b/libasm/Makefile.in
806 @@ -90,9 +90,10 @@ PRE_UNINSTALL = :
807  POST_UNINSTALL = :
808  build_triplet = @build@
809  host_triplet = @host@
810 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
811 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
812 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
813  noinst_PROGRAMS = $(am__EXEEXT_1)
814 -@USE_LOCKS_TRUE@am__append_2 = -lpthread
815 +@USE_LOCKS_TRUE@am__append_3 = -lpthread
816  subdir = libasm
817  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
818  am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
819 @@ -263,6 +264,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
820  INSTALL_SCRIPT = @INSTALL_SCRIPT@
821  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
822  LDFLAGS = @LDFLAGS@
823 +LD_AS_NEEDED = @LD_AS_NEEDED@
824  LEX = @LEX@
825  LEXLIB = @LEXLIB@
826  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
827 @@ -294,6 +296,7 @@ SHELL = @SHELL@
828  STRIP = @STRIP@
829  USE_NLS = @USE_NLS@
830  VERSION = 1
831 +WEXTRA = @WEXTRA@
832  XGETTEXT = @XGETTEXT@
833  XGETTEXT_015 = @XGETTEXT_015@
834  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
835 @@ -361,14 +364,14 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
836  
837  # Warn about stack usage of more than 256K = 262144 bytes.
838  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
839 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
840 -           $(if $($(*F)_no_Werror),,-Werror) \
841 -           $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
842 -           $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
843 -           $($(*F)_CFLAGS)
844 -
845 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
846 +       $($(*F)_no_Werror),,-Werror) $(if \
847 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
848 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
849 +       $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
850 +       $($(*F)_CFLAGS) $(am__append_1)
851  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
852 -DEFS.os = -DPIC -DSHARED $(am__append_1)
853 +DEFS.os = -DPIC -DSHARED $(am__append_2)
854  CLEANFILES = *.gcno *.gcda $(am_libasm_pic_a_OBJECTS) \
855         libasm.so.$(VERSION)
856  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
857 @@ -395,7 +398,7 @@ libasm_a_SOURCES = asm_begin.c asm_abort
858  
859  libasm_pic_a_SOURCES = 
860  am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
861 -libasm_so_LDLIBS = $(am__append_2)
862 +libasm_so_LDLIBS = $(am__append_3)
863  libasm_so_SOURCES = 
864  noinst_HEADERS = libasmP.h symbolhash.h
865  EXTRA_DIST = libasm.map
866 --- a/libcpu/ChangeLog
867 +++ b/libcpu/ChangeLog
868 @@ -51,6 +51,9 @@
869  
870  2009-01-23  Roland McGrath  <roland@redhat.com>
871  
872 +       * i386_disasm.c (i386_disasm): Add abort after assert-constant for old
873 +       compilers that don't realize it's noreturn.
874 +
875         * Makefile.am (i386_parse_CFLAGS): Use quotes around command
876         substitution that can produce leading whitespace.
877  
878 @@ -380,6 +383,11 @@
879         * defs/i386.doc: New file.
880         * defs/x86_64: New file.
881  
882 +2005-04-04  Roland McGrath  <roland@redhat.com>
883 +
884 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
885 +       (AM_CFLAGS): Use it instead of -Wextra.
886 +
887  2005-02-15  Ulrich Drepper  <drepper@redhat.com>
888  
889         * Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
890 --- a/libcpu/i386_disasm.c
891 +++ b/libcpu/i386_disasm.c
892 @@ -822,6 +822,7 @@ i386_disasm (const uint8_t **startp, con
893  
894                         default:
895                           assert (! "INVALID not handled");
896 +                         abort ();
897                         }
898                     }
899                   else
900 --- a/libcpu/Makefile.in
901 +++ b/libcpu/Makefile.in
902 @@ -90,7 +90,8 @@ PRE_UNINSTALL = :
903  POST_UNINSTALL = :
904  build_triplet = @build@
905  host_triplet = @host@
906 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
907 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
908 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
909  @MAINTAINER_MODE_TRUE@noinst_PROGRAMS = i386_gendis$(EXEEXT)
910  subdir = libcpu
911  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
912 @@ -238,6 +239,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
913  INSTALL_SCRIPT = @INSTALL_SCRIPT@
914  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
915  LDFLAGS = @LDFLAGS@
916 +LD_AS_NEEDED = @LD_AS_NEEDED@
917  LEX = @LEX@
918  LEXLIB = @LEXLIB@
919  LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
920 @@ -269,6 +271,7 @@ SHELL = @SHELL@
921  STRIP = @STRIP@
922  USE_NLS = @USE_NLS@
923  VERSION = @VERSION@
924 +WEXTRA = @WEXTRA@
925  XGETTEXT = @XGETTEXT@
926  XGETTEXT_015 = @XGETTEXT_015@
927  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
928 @@ -336,13 +339,14 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
929  
930  # Warn about stack usage of more than 256K = 262144 bytes.
931  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
932 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
933 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
934         $($(*F)_no_Werror),,-Werror) $(if \
935 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
936 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
937 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
938         $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
939 -       $($(*F)_CFLAGS) -fpic -fdollars-in-identifiers
940 +       $($(*F)_CFLAGS) $(am__append_1) -fpic -fdollars-in-identifiers
941  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
942 -DEFS.os = -DPIC -DSHARED $(am__append_1)
943 +DEFS.os = -DPIC -DSHARED $(am__append_2)
944  CLEANFILES = *.gcno *.gcda $(foreach P,i386 x86_64,$P_defs \
945         $P.mnemonics)
946  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
947 --- a/libdw/ChangeLog
948 +++ b/libdw/ChangeLog
949 @@ -904,6 +904,10 @@
950  
951         * Makefile.am (known-dwarf.h): Run gawk on config/known-dwarf.awk.
952  
953 +2011-07-20  Mark Wielaard  <mjw@redhat.com>
954 +
955 +       * dwarf_begin_elf.c: Add fallback for be64toh if not defined.
956 +
957  2011-07-14  Mark Wielaard  <mjw@redhat.com>
958  
959         * libdw.h (dwarf_offdie): Fix documentation to mention .debug_info.
960 @@ -1263,6 +1267,10 @@
961  
962         * dwarf_hasattr_integrate.c: Integrate DW_AT_specification too.
963  
964 +2009-08-17  Roland McGrath  <roland@redhat.com>
965 +
966 +       * libdw.h: Disable extern inlines for GCC 4.2.
967 +
968  2009-08-10  Roland McGrath  <roland@redhat.com>
969  
970         * dwarf_getscopevar.c: Use dwarf_diename.
971 @@ -2031,6 +2039,11 @@
972  
973  2005-05-31  Roland McGrath  <roland@redhat.com>
974  
975 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
976 +       (AM_CFLAGS): Use it in place of -Wextra.
977 +
978 +2005-05-31  Roland McGrath  <roland@redhat.com>
979 +
980         * dwarf_formref_die.c (dwarf_formref_die): Add CU header offset to
981         formref offset.
982  
983 --- a/libdw/dwarf_begin_elf.c
984 +++ b/libdw/dwarf_begin_elf.c
985 @@ -47,6 +47,14 @@
986  #if USE_ZLIB
987  # include <endian.h>
988  # define crc32         loser_crc32
989 +# ifndef be64toh
990 +#  include <byteswap.h>
991 +#  if __BYTE_ORDER == __LITTLE_ENDIAN
992 +#   define be64toh(x) bswap_64 (x)
993 +#  else
994 +#   define be64toh(x) (x)
995 +#  endif
996 +# endif
997  # include <zlib.h>
998  # undef crc32
999  #endif
1000 --- a/libdw/libdw.h
1001 +++ b/libdw/libdw.h
1002 @@ -1004,7 +1004,7 @@ extern Dwarf_OOM dwarf_new_oom_handler (
1003  
1004  
1005  /* Inline optimizations.  */
1006 -#ifdef __OPTIMIZE__
1007 +#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
1008  /* Return attribute code of given attribute.  */
1009  __libdw_extern_inline unsigned int
1010  dwarf_whatattr (Dwarf_Attribute *attr)
1011 --- a/libdw/Makefile.in
1012 +++ b/libdw/Makefile.in
1013 @@ -90,8 +90,9 @@ PRE_UNINSTALL = :
1014  POST_UNINSTALL = :
1015  build_triplet = @build@
1016  host_triplet = @host@
1017 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
1018 -@BUILD_STATIC_TRUE@am__append_2 = -fpic
1019 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
1020 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
1021 +@BUILD_STATIC_TRUE@am__append_3 = -fpic
1022  noinst_PROGRAMS = $(am__EXEEXT_1)
1023  subdir = libdw
1024  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
1025 @@ -312,6 +313,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
1026  INSTALL_SCRIPT = @INSTALL_SCRIPT@
1027  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1028  LDFLAGS = @LDFLAGS@
1029 +LD_AS_NEEDED = @LD_AS_NEEDED@
1030  LEX = @LEX@
1031  LEXLIB = @LEXLIB@
1032  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1033 @@ -343,6 +345,7 @@ SHELL = @SHELL@
1034  STRIP = @STRIP@
1035  USE_NLS = @USE_NLS@
1036  VERSION = 1
1037 +WEXTRA = @WEXTRA@
1038  XGETTEXT = @XGETTEXT@
1039  XGETTEXT_015 = @XGETTEXT_015@
1040  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1041 @@ -409,13 +412,14 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
1042  
1043  # Warn about stack usage of more than 256K = 262144 bytes.
1044  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
1045 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
1046 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1047         $($(*F)_no_Werror),,-Werror) $(if \
1048 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
1049 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1050 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
1051         $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
1052 -       $($(*F)_CFLAGS) $(am__append_2)
1053 +       $($(*F)_CFLAGS) $(am__append_1) $(am__append_3)
1054  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
1055 -DEFS.os = -DPIC -DSHARED $(am__append_1)
1056 +DEFS.os = -DPIC -DSHARED $(am__append_2)
1057  CLEANFILES = *.gcno *.gcda
1058  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
1059  @FATAL_TEXTREL_FALSE@textrel_found = $(textrel_msg)
1060 --- a/libdwelf/Makefile.in
1061 +++ b/libdwelf/Makefile.in
1062 @@ -89,7 +89,8 @@ PRE_UNINSTALL = :
1063  POST_UNINSTALL = :
1064  build_triplet = @build@
1065  host_triplet = @host@
1066 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
1067 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
1068 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
1069  subdir = libdwelf
1070  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
1071  am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
1072 @@ -242,6 +243,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
1073  INSTALL_SCRIPT = @INSTALL_SCRIPT@
1074  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1075  LDFLAGS = @LDFLAGS@
1076 +LD_AS_NEEDED = @LD_AS_NEEDED@
1077  LEX = @LEX@
1078  LEXLIB = @LEXLIB@
1079  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1080 @@ -273,6 +275,7 @@ SHELL = @SHELL@
1081  STRIP = @STRIP@
1082  USE_NLS = @USE_NLS@
1083  VERSION = 1
1084 +WEXTRA = @WEXTRA@
1085  XGETTEXT = @XGETTEXT@
1086  XGETTEXT_015 = @XGETTEXT_015@
1087  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1088 @@ -340,14 +343,14 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
1089  
1090  # Warn about stack usage of more than 256K = 262144 bytes.
1091  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
1092 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
1093 -           $(if $($(*F)_no_Werror),,-Werror) \
1094 -           $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
1095 -           $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
1096 -           $($(*F)_CFLAGS)
1097 -
1098 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1099 +       $($(*F)_no_Werror),,-Werror) $(if \
1100 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1101 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
1102 +       $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
1103 +       $($(*F)_CFLAGS) $(am__append_1)
1104  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
1105 -DEFS.os = -DPIC -DSHARED $(am__append_1)
1106 +DEFS.os = -DPIC -DSHARED $(am__append_2)
1107  CLEANFILES = *.gcno *.gcda $(am_libdwelf_pic_a_OBJECTS)
1108  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
1109  @FATAL_TEXTREL_FALSE@textrel_found = $(textrel_msg)
1110 --- a/libdwfl/ChangeLog
1111 +++ b/libdwfl/ChangeLog
1112 @@ -713,6 +713,21 @@
1113         (dwfl_module_addrsym) (i_to_symfile): New function.
1114         (dwfl_module_addrsym) (search_table): Use it.
1115  
1116 +2013-11-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
1117 +
1118 +       Older OS compatibility bits.
1119 +       * linux-core-attach.c (be64toh, le64toh, be32toh, le32toh): Provide
1120 +       fallbacks if not defined by system.
1121 +
1122 +2013-11-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
1123 +
1124 +       Handle T-stopped detach for old kernels.
1125 +       * linux-pid-attach.c (struct pid_arg): New field stopped.
1126 +       (ptrace_attach): New parameter stoppedp.  Set it appropriately.
1127 +       (pid_set_initial_registers): Pass the new field.
1128 +       (pid_thread_detach): Handle the case of STOPPED for old kernels.
1129 +       (__libdwfl_attach_state_for_pid): Initialize STOPPED.
1130 +
1131  2013-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
1132             Mark Wielaard  <mjw@redhat.com>
1133  
1134 @@ -2478,6 +2493,11 @@
1135  
1136  2005-07-21  Roland McGrath  <roland@redhat.com>
1137  
1138 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
1139 +       (AM_CFLAGS): Use it in place of -Wextra.
1140 +
1141 +2005-07-21  Roland McGrath  <roland@redhat.com>
1142 +
1143         * Makefile.am (noinst_HEADERS): Add loc2c.c.
1144  
1145         * test2.c (main): Check sscanf result to quiet warning.
1146 --- a/libdwfl/linux-core-attach.c
1147 +++ b/libdwfl/linux-core-attach.c
1148 @@ -29,6 +29,35 @@
1149  #include "libdwflP.h"
1150  #include <fcntl.h>
1151  #include "system.h"
1152 +#include <endian.h>
1153 +#include <byteswap.h>
1154 +#if __BYTE_ORDER == __LITTLE_ENDIAN
1155 +# ifndef be64toh
1156 +#  define be64toh(x) bswap_64 (x)
1157 +# endif
1158 +# ifndef le64toh
1159 +#  define le64toh(x) (x)
1160 +# endif
1161 +# ifndef be32toh
1162 +#  define be32toh(x) bswap_32 (x)
1163 +# endif
1164 +# ifndef le32toh
1165 +#  define le32toh(x) (x)
1166 +# endif
1167 +#else
1168 +# ifndef be64toh
1169 +#  define be64toh(x) (x)
1170 +# endif
1171 +# ifndef le64toh
1172 +#  define le64toh(x) bswap_64 (x)
1173 +# endif
1174 +# ifndef be32toh
1175 +#  define be32toh(x) (x)
1176 +# endif
1177 +# ifndef le32toh
1178 +#  define le32toh(x) bswap_32 (x)
1179 +# endif
1180 +#endif
1181  
1182  #include "../libdw/memory-access.h"
1183  
1184 --- a/libdwfl/linux-pid-attach.c
1185 +++ b/libdwfl/linux-pid-attach.c
1186 @@ -255,6 +255,11 @@ void
1187  internal_function
1188  __libdwfl_ptrace_detach (pid_t tid, bool tid_was_stopped)
1189  {
1190 +  // Older kernels (tested kernel-2.6.18-348.12.1.el5.x86_64) need special
1191 +  // handling of the detachment to keep the process State: T (stopped).
1192 +  if (tid_was_stopped)
1193 +    syscall (__NR_tkill, tid, SIGSTOP);
1194 +
1195    /* This handling is needed only on older Linux kernels such as
1196       2.6.32-358.23.2.el6.ppc64.  Later kernels such as
1197       3.11.7-200.fc19.x86_64 remember the T (stopped) state
1198 @@ -262,6 +267,15 @@ __libdwfl_ptrace_detach (pid_t tid, bool
1199       PTRACE_DETACH.  */
1200    ptrace (PTRACE_DETACH, tid, NULL,
1201           (void *) (intptr_t) (tid_was_stopped ? SIGSTOP : 0));
1202 +
1203 +  if (tid_was_stopped)
1204 +    {
1205 +      // Wait till the SIGSTOP settles down.
1206 +      int i;
1207 +      for (i = 0; i < 100000; i++)
1208 +       if (linux_proc_pid_is_stopped (tid))
1209 +         break;
1210 +    }
1211  }
1212  
1213  static void
1214 --- a/libdwfl/Makefile.in
1215 +++ b/libdwfl/Makefile.in
1216 @@ -89,10 +89,11 @@ PRE_UNINSTALL = :
1217  POST_UNINSTALL = :
1218  build_triplet = @build@
1219  host_triplet = @host@
1220 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
1221 -@ZLIB_TRUE@am__append_2 = gzip.c
1222 -@BZLIB_TRUE@am__append_3 = bzip2.c
1223 -@LZMA_TRUE@am__append_4 = lzma.c
1224 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
1225 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
1226 +@ZLIB_TRUE@am__append_3 = gzip.c
1227 +@BZLIB_TRUE@am__append_4 = bzip2.c
1228 +@LZMA_TRUE@am__append_5 = lzma.c
1229  subdir = libdwfl
1230  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
1231  am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
1232 @@ -301,6 +302,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
1233  INSTALL_SCRIPT = @INSTALL_SCRIPT@
1234  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1235  LDFLAGS = @LDFLAGS@
1236 +LD_AS_NEEDED = @LD_AS_NEEDED@
1237  LEX = @LEX@
1238  LEXLIB = @LEXLIB@
1239  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1240 @@ -332,6 +334,7 @@ SHELL = @SHELL@
1241  STRIP = @STRIP@
1242  USE_NLS = @USE_NLS@
1243  VERSION = 1
1244 +WEXTRA = @WEXTRA@
1245  XGETTEXT = @XGETTEXT@
1246  XGETTEXT_015 = @XGETTEXT_015@
1247  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1248 @@ -399,14 +402,14 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
1249  
1250  # Warn about stack usage of more than 256K = 262144 bytes.
1251  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
1252 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
1253 -           $(if $($(*F)_no_Werror),,-Werror) \
1254 -           $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
1255 -           $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
1256 -           $($(*F)_CFLAGS)
1257 -
1258 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1259 +       $($(*F)_no_Werror),,-Werror) $(if \
1260 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1261 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
1262 +       $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
1263 +       $($(*F)_CFLAGS) $(am__append_1)
1264  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
1265 -DEFS.os = -DPIC -DSHARED $(am__append_1)
1266 +DEFS.os = -DPIC -DSHARED $(am__append_2)
1267  CLEANFILES = *.gcno *.gcda $(am_libdwfl_pic_a_OBJECTS)
1268  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
1269  @FATAL_TEXTREL_FALSE@textrel_found = $(textrel_msg)
1270 @@ -435,8 +438,8 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_en
1271         dwfl_module_register_names.c dwfl_segment_report_module.c \
1272         link_map.c core-file.c open.c image-header.c dwfl_frame.c \
1273         frame_unwind.c dwfl_frame_pc.c linux-pid-attach.c \
1274 -       linux-core-attach.c dwfl_frame_regs.c $(am__append_2) \
1275 -       $(am__append_3) $(am__append_4)
1276 +       linux-core-attach.c dwfl_frame_regs.c $(am__append_3) \
1277 +       $(am__append_4) $(am__append_5)
1278  libdwfl = $(libdw)
1279  libdw = ../libdw/libdw.so
1280  libelf = ../libelf/libelf.so
1281 --- a/libebl/ChangeLog
1282 +++ b/libebl/ChangeLog
1283 @@ -785,6 +785,11 @@
1284         * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency
1285         tracking works right.
1286  
1287 +2005-05-31  Roland McGrath  <roland@redhat.com>
1288 +
1289 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
1290 +       (AM_CFLAGS): Use it in place of -Wextra.
1291 +
1292  2005-05-21  Ulrich Drepper  <drepper@redhat.com>
1293  
1294         * libebl_x86_64.map: Add x86_64_core_note.
1295 --- a/libebl/Makefile.in
1296 +++ b/libebl/Makefile.in
1297 @@ -89,7 +89,8 @@ PRE_UNINSTALL = :
1298  POST_UNINSTALL = :
1299  build_triplet = @build@
1300  host_triplet = @host@
1301 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
1302 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
1303 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
1304  subdir = libebl
1305  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
1306  am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
1307 @@ -264,6 +265,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
1308  INSTALL_SCRIPT = @INSTALL_SCRIPT@
1309  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1310  LDFLAGS = @LDFLAGS@
1311 +LD_AS_NEEDED = @LD_AS_NEEDED@
1312  LEX = @LEX@
1313  LEXLIB = @LEXLIB@
1314  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1315 @@ -295,6 +297,7 @@ SHELL = @SHELL@
1316  STRIP = @STRIP@
1317  USE_NLS = @USE_NLS@
1318  VERSION = 1
1319 +WEXTRA = @WEXTRA@
1320  XGETTEXT = @XGETTEXT@
1321  XGETTEXT_015 = @XGETTEXT_015@
1322  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1323 @@ -362,13 +365,14 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
1324  
1325  # Warn about stack usage of more than 256K = 262144 bytes.
1326  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
1327 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
1328 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1329         $($(*F)_no_Werror),,-Werror) $(if \
1330 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
1331 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1332 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
1333         $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
1334 -       $($(*F)_CFLAGS) -fpic
1335 +       $($(*F)_CFLAGS) $(am__append_1) -fpic
1336  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
1337 -DEFS.os = -DPIC -DSHARED $(am__append_1)
1338 +DEFS.os = -DPIC -DSHARED $(am__append_2)
1339  CLEANFILES = *.gcno *.gcda $(am_libebl_pic_a_OBJECTS)
1340  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
1341  @FATAL_TEXTREL_FALSE@textrel_found = $(textrel_msg)
1342 --- a/libelf/ChangeLog
1343 +++ b/libelf/ChangeLog
1344 @@ -412,6 +412,11 @@
1345  
1346         * elf-knowledge.h (SECTION_STRIP_P): Remove < SHT_NUM check.
1347  
1348 +2011-03-10  Roland McGrath  <roland@redhat.com>
1349 +
1350 +       * gnuhash_xlate.h (elf_cvt_gnuhash): Avoid post-increment in bswap_32
1351 +       argument, since some implementations are buggy macros.
1352 +
1353  2011-02-26  Mark Wielaard  <mjw@redhat.com>
1354  
1355         * elf_end.c (elf_end): Call rwlock_unlock before rwlock_fini.
1356 @@ -1089,6 +1094,11 @@
1357  
1358         * elf.h: Update from glibc.
1359  
1360 +2005-05-31  Roland McGrath  <roland@redhat.com>
1361 +
1362 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
1363 +       (AM_CFLAGS): Use it in place of -Wextra.
1364 +
1365  2005-05-08  Roland McGrath  <roland@redhat.com>
1366  
1367         * elf_begin.c (read_file) [_MUDFLAP]: Don't use mmap for now.
1368 --- a/libelf/common.h
1369 +++ b/libelf/common.h
1370 @@ -139,7 +139,7 @@ libelf_release_all (Elf *elf)
1371    (Var) = (sizeof (Var) == 1                                                 \
1372            ? (unsigned char) (Var)                                            \
1373            : (sizeof (Var) == 2                                               \
1374 -             ? bswap_16 (Var)                                                \
1375 +             ? (unsigned short int) bswap_16 (Var)                           \
1376               : (sizeof (Var) == 4                                            \
1377                  ? bswap_32 (Var)                                             \
1378                  : bswap_64 (Var))))
1379 @@ -148,7 +148,7 @@ libelf_release_all (Elf *elf)
1380    (Dst) = (sizeof (Var) == 1                                                 \
1381            ? (unsigned char) (Var)                                            \
1382            : (sizeof (Var) == 2                                               \
1383 -             ? bswap_16 (Var)                                                \
1384 +             ? (unsigned short int) bswap_16 (Var)                           \
1385               : (sizeof (Var) == 4                                            \
1386                  ? bswap_32 (Var)                                             \
1387                  : bswap_64 (Var))))
1388 --- a/libelf/gnuhash_xlate.h
1389 +++ b/libelf/gnuhash_xlate.h
1390 @@ -1,5 +1,5 @@
1391  /* Conversion functions for versioning information.
1392 -   Copyright (C) 2006, 2007 Red Hat, Inc.
1393 +   Copyright (C) 2006-2011 Red Hat, Inc.
1394     This file is part of elfutils.
1395     Written by Ulrich Drepper <drepper@redhat.com>, 2006.
1396  
1397 @@ -68,7 +68,9 @@ elf_cvt_gnuhash (void *dest, const void
1398    dest32 = (Elf32_Word *) &dest64[bitmask_words];
1399    while (len >= 4)
1400      {
1401 -      *dest32++ = bswap_32 (*src32++);
1402 +      *dest32 = bswap_32 (*src32);
1403 +      ++dest32;
1404 +      ++src32;
1405        len -= 4;
1406      }
1407  }
1408 --- a/libelf/Makefile.in
1409 +++ b/libelf/Makefile.in
1410 @@ -90,10 +90,11 @@ PRE_UNINSTALL = :
1411  POST_UNINSTALL = :
1412  build_triplet = @build@
1413  host_triplet = @host@
1414 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
1415 -@BUILD_STATIC_TRUE@am__append_2 = -fpic
1416 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
1417 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
1418 +@BUILD_STATIC_TRUE@am__append_3 = -fpic
1419  noinst_PROGRAMS = $(am__EXEEXT_1)
1420 -@USE_LOCKS_TRUE@am__append_3 = -lpthread
1421 +@USE_LOCKS_TRUE@am__append_4 = -lpthread
1422  subdir = libelf
1423  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
1424  am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
1425 @@ -305,6 +306,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
1426  INSTALL_SCRIPT = @INSTALL_SCRIPT@
1427  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1428  LDFLAGS = @LDFLAGS@
1429 +LD_AS_NEEDED = @LD_AS_NEEDED@
1430  LEX = @LEX@
1431  LEXLIB = @LEXLIB@
1432  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1433 @@ -336,6 +338,7 @@ SHELL = @SHELL@
1434  STRIP = @STRIP@
1435  USE_NLS = @USE_NLS@
1436  VERSION = 1
1437 +WEXTRA = @WEXTRA@
1438  XGETTEXT = @XGETTEXT@
1439  XGETTEXT_015 = @XGETTEXT_015@
1440  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1441 @@ -401,13 +404,14 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
1442  
1443  # Warn about stack usage of more than 256K = 262144 bytes.
1444  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
1445 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 $(if \
1446 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1447         $($(*F)_no_Werror),,-Werror) $(if \
1448 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
1449 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1450 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
1451         $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
1452 -       $($(*F)_CFLAGS) $(am__append_2)
1453 +       $($(*F)_CFLAGS) $(am__append_1) $(am__append_3)
1454  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
1455 -DEFS.os = -DPIC -DSHARED $(am__append_1)
1456 +DEFS.os = -DPIC -DSHARED $(am__append_2)
1457  CLEANFILES = *.gcno *.gcda $(am_libelf_pic_a_OBJECTS) \
1458         libelf.so.$(VERSION)
1459  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
1460 @@ -470,7 +474,7 @@ libelf_a_SOURCES = elf_version.c elf_has
1461  
1462  libelf_pic_a_SOURCES = 
1463  am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
1464 -libelf_so_LDLIBS = $(am__append_3)
1465 +libelf_so_LDLIBS = $(am__append_4)
1466  libelf_so_SOURCES = 
1467  noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
1468                  version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h
1469 --- a/m4/Makefile.in
1470 +++ b/m4/Makefile.in
1471 @@ -159,6 +159,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
1472  INSTALL_SCRIPT = @INSTALL_SCRIPT@
1473  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1474  LDFLAGS = @LDFLAGS@
1475 +LD_AS_NEEDED = @LD_AS_NEEDED@
1476  LEX = @LEX@
1477  LEXLIB = @LEXLIB@
1478  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1479 @@ -190,6 +191,7 @@ SHELL = @SHELL@
1480  STRIP = @STRIP@
1481  USE_NLS = @USE_NLS@
1482  VERSION = @VERSION@
1483 +WEXTRA = @WEXTRA@
1484  XGETTEXT = @XGETTEXT@
1485  XGETTEXT_015 = @XGETTEXT_015@
1486  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1487 --- a/Makefile.in
1488 +++ b/Makefile.in
1489 @@ -277,6 +277,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
1490  INSTALL_SCRIPT = @INSTALL_SCRIPT@
1491  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1492  LDFLAGS = @LDFLAGS@
1493 +LD_AS_NEEDED = @LD_AS_NEEDED@
1494  LEX = @LEX@
1495  LEXLIB = @LEXLIB@
1496  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1497 @@ -308,6 +309,7 @@ SHELL = @SHELL@
1498  STRIP = @STRIP@
1499  USE_NLS = @USE_NLS@
1500  VERSION = @VERSION@
1501 +WEXTRA = @WEXTRA@
1502  XGETTEXT = @XGETTEXT@
1503  XGETTEXT_015 = @XGETTEXT_015@
1504  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1505 --- a/src/addr2line.c
1506 +++ b/src/addr2line.c
1507 @@ -622,10 +622,10 @@ handle_address (const char *string, Dwfl
1508        bool parsed = false;
1509        int i, j;
1510        char *name = NULL;
1511 -      if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
1512 +      if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
1513           && string[i] == '\0')
1514         parsed = adjust_to_section (name, &addr, dwfl);
1515 -      switch (sscanf (string, "%m[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
1516 +      switch (sscanf (string, "%a[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
1517         {
1518         default:
1519           break;
1520 --- a/src/ar.c
1521 +++ b/src/ar.c
1522 @@ -685,7 +685,14 @@ do_oper_extract (int oper, const char *a
1523                   tv[1].tv_sec = arhdr->ar_date;
1524                   tv[1].tv_nsec = 0;
1525  
1526 +#ifdef HAVE_FUTIMENS
1527                   if (unlikely (futimens (xfd, tv) != 0))
1528 +#else
1529 +                 struct timeval times[2];
1530 +                 TIMESPEC_TO_TIMEVAL (&times[0], &tv[0]);
1531 +                 TIMESPEC_TO_TIMEVAL (&times[1], &tv[1]);
1532 +                 if (unlikely (futimes (xfd, times) != 0))
1533 +#endif
1534                     {
1535                       error (0, errno,
1536                              gettext ("cannot change modification time of %s"),
1537 --- a/src/ChangeLog
1538 +++ b/src/ChangeLog
1539 @@ -1626,8 +1626,16 @@
1540         * readelf.c (attr_callback): Use print_block only when we don't use
1541         print_ops.
1542  
1543 +2009-08-17  Roland McGrath  <roland@redhat.com>
1544 +
1545 +       * ld.h: Disable extern inlines for GCC 4.2.
1546 +
1547  2009-08-14  Roland McGrath  <roland@redhat.com>
1548  
1549 +       * strings.c (read_block): Conditionalize posix_fadvise use
1550 +       on [POSIX_FADV_SEQUENTIAL].
1551 +       From Petr Salinger <Petr.Salinger@seznam.cz>.
1552 +
1553         * ar.c (do_oper_extract): Use pathconf instead of statfs.
1554  
1555  2009-08-01  Ulrich Drepper  <drepper@redhat.com>
1556 @@ -1791,6 +1799,8 @@
1557         * readelf.c (print_debug_frame_section): Use t instead of j formats
1558         for ptrdiff_t OFFSET.
1559  
1560 +       * addr2line.c (handle_address): Use %a instead of %m for compatibility.
1561 +
1562  2009-01-21  Ulrich Drepper  <drepper@redhat.com>
1563  
1564         * elflint.c (check_program_header): Fix typo in .eh_frame_hdr section
1565 @@ -1974,6 +1984,11 @@
1566         that matches its PT_LOAD's p_flags &~ PF_W.  On sparc, PF_X really
1567         is valid in RELRO.
1568  
1569 +2008-03-01  Roland McGrath  <roland@redhat.com>
1570 +
1571 +       * readelf.c (dump_archive_index): Tweak portability hack
1572 +       to match [__GNUC__ < 4] too.
1573 +
1574  2008-02-29  Roland McGrath  <roland@redhat.com>
1575  
1576         * readelf.c (print_attributes): Add a cast.
1577 @@ -2225,6 +2240,8 @@
1578  
1579         * readelf.c (hex_dump): Fix rounding error in whitespace calculation.
1580  
1581 +       * Makefile.am (readelf_no_Werror): New variable.
1582 +
1583  2007-10-15  Roland McGrath  <roland@redhat.com>
1584  
1585         * make-debug-archive.in: New file.
1586 @@ -2664,6 +2681,10 @@
1587         * elflint.c (valid_e_machine): Add EM_ALPHA.
1588         Reported by Christian Aichinger <Greek0@gmx.net>.
1589  
1590 +       * strings.c (map_file): Define POSIX_MADV_SEQUENTIAL to
1591 +       MADV_SEQUENTIAL if undefined.   Don't call posix_madvise
1592 +       if neither is defined.
1593 +
1594  2006-08-08  Ulrich Drepper  <drepper@redhat.com>
1595  
1596         * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
1597 @@ -2740,6 +2761,10 @@
1598         * Makefile.am: Add hacks to create dependency files for non-generic
1599         linker.
1600  
1601 +2006-04-05  Roland McGrath  <roland@redhat.com>
1602 +
1603 +       * strings.c (MAP_POPULATE): Define to 0 if undefined.
1604 +
1605  2006-06-12  Ulrich Drepper  <drepper@redhat.com>
1606  
1607         * ldgeneric.c (ld_generic_generate_sections): Don't create .interp
1608 @@ -3088,6 +3113,11 @@
1609         * readelf.c (print_debug_loc_section): Fix indentation for larger
1610         address size.
1611  
1612 +2005-05-31  Roland McGrath  <roland@redhat.com>
1613 +
1614 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
1615 +       (AM_CFLAGS): Use it in place of -Wextra.
1616 +
1617  2005-05-30  Roland McGrath  <roland@redhat.com>
1618  
1619         * readelf.c (print_debug_line_section): Print section offset of each
1620 --- a/src/findtextrel.c
1621 +++ b/src/findtextrel.c
1622 @@ -503,7 +503,11 @@ ptrcompare (const void *p1, const void *
1623  
1624  
1625  static void
1626 -check_rel (size_t nsegments, struct segments segments[nsegments],
1627 +check_rel (size_t nsegments, struct segments segments[
1628 +#if __GNUC__ >= 4
1629 +                                                     nsegments
1630 +#endif
1631 +          ],
1632            GElf_Addr addr, Elf *elf, Elf_Scn *symscn, Dwarf *dw,
1633            const char *fname, bool more_than_one, void **knownsrcs)
1634  {
1635 --- a/src/ld.h
1636 +++ b/src/ld.h
1637 @@ -1114,6 +1114,7 @@ extern bool dynamically_linked_p (void);
1638  
1639  /* Checked whether the symbol is undefined and referenced from a DSO.  */
1640  extern bool linked_from_dso_p (struct scninfo *scninfo, size_t symidx);
1641 +#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
1642  #ifdef __GNUC_STDC_INLINE__
1643  __attribute__ ((__gnu_inline__))
1644  #endif
1645 @@ -1131,5 +1132,6 @@ linked_from_dso_p (struct scninfo *scnin
1646  
1647    return sym->defined && sym->in_dso;
1648  }
1649 +#endif /* Optimizing and not GCC 4.2.  */
1650  
1651  #endif /* ld.h */
1652 --- a/src/Makefile.am
1653 +++ b/src/Makefile.am
1654 @@ -90,6 +90,11 @@ endif
1655  ldgeneric_no_Wunused = yes
1656  ldgeneric_no_Wstack_usage = yes
1657  
1658 +# Buggy old compilers or libc headers.
1659 +readelf_no_Werror = yes
1660 +strings_no_Werror = yes
1661 +addr2line_no_Wformat = yes
1662 +
1663  # Bad, bad stack usage...
1664  readelf_no_Wstack_usage = yes
1665  nm_no_Wstack_usage = yes
1666 --- a/src/Makefile.in
1667 +++ b/src/Makefile.in
1668 @@ -91,7 +91,8 @@ PRE_UNINSTALL = :
1669  POST_UNINSTALL = :
1670  build_triplet = @build@
1671  host_triplet = @host@
1672 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
1673 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
1674 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
1675  bin_PROGRAMS = readelf$(EXEEXT) nm$(EXEEXT) size$(EXEEXT) \
1676         strip$(EXEEXT) ld$(EXEEXT) elflint$(EXEEXT) \
1677         findtextrel$(EXEEXT) addr2line$(EXEEXT) elfcmp$(EXEEXT) \
1678 @@ -100,9 +101,9 @@ bin_PROGRAMS = readelf$(EXEEXT) nm$(EXEE
1679  @NATIVE_LD_FALSE@noinst_PROGRAMS = $(am__EXEEXT_1)
1680  # We never build this library but we need to get the dependency files
1681  # of all the linker backends that might be used in a non-generic linker.
1682 -@NEVER_TRUE@am__append_2 = libdummy.a
1683 +@NEVER_TRUE@am__append_3 = libdummy.a
1684  # -ldl is always needed for libebl.
1685 -@NATIVE_LD_TRUE@am__append_3 = libld_elf.a
1686 +@NATIVE_LD_TRUE@am__append_4 = libld_elf.a
1687  @NATIVE_LD_TRUE@am_libld_elf_i386_pic_a_OBJECTS =
1688  subdir = src
1689  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
1690 @@ -172,7 +173,7 @@ am_ld_OBJECTS = ld.$(OBJEXT) ldgeneric.$
1691         versionhash.$(OBJEXT)
1692  ld_OBJECTS = $(am_ld_OBJECTS)
1693  ld_DEPENDENCIES = $(libebl) $(libelf) $(libeu) $(am__DEPENDENCIES_1) \
1694 -       $(am__append_3)
1695 +       $(am__append_4)
1696  ld_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ld_LDFLAGS) $(LDFLAGS) -o \
1697         $@
1698  am_libld_elf_i386_so_OBJECTS =
1699 @@ -361,6 +362,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
1700  INSTALL_SCRIPT = @INSTALL_SCRIPT@
1701  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1702  LDFLAGS = @LDFLAGS@
1703 +LD_AS_NEEDED = @LD_AS_NEEDED@
1704  LEX = @LEX@
1705  LEXLIB = @LEXLIB@
1706  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1707 @@ -392,6 +394,7 @@ SHELL = @SHELL@
1708  STRIP = @STRIP@
1709  USE_NLS = @USE_NLS@
1710  VERSION = @VERSION@
1711 +WEXTRA = @WEXTRA@
1712  XGETTEXT = @XGETTEXT@
1713  XGETTEXT_015 = @XGETTEXT_015@
1714  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1715 @@ -460,14 +463,14 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_sr
1716  
1717  # Warn about stack usage of more than 256K = 262144 bytes.
1718  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
1719 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
1720 -           $(if $($(*F)_no_Werror),,-Werror) \
1721 -           $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
1722 -           $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
1723 -           $($(*F)_CFLAGS)
1724 -
1725 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1726 +       $($(*F)_no_Werror),,-Werror) $(if \
1727 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1728 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
1729 +       $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
1730 +       $($(*F)_CFLAGS) $(am__append_1)
1731  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
1732 -DEFS.os = -DPIC -DSHARED $(am__append_1)
1733 +DEFS.os = -DPIC -DSHARED $(am__append_2)
1734  CLEANFILES = *.gcno *.gcda make-debug-archive none_ld.os \
1735         $(ld_modules:.c=.os) *.gconv
1736  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
1737 @@ -480,8 +483,8 @@ AM_LFLAGS = -Pld -olex.yy.c
1738  native_ld = @native_ld@
1739  ld_dsos = libld_elf_i386_pic.a
1740  @NATIVE_LD_FALSE@noinst_LIBRARIES = libld_elf.a libar.a $(ld_dsos) \
1741 -@NATIVE_LD_FALSE@      $(am__append_2)
1742 -@NATIVE_LD_TRUE@noinst_LIBRARIES = libld_elf.a libar.a $(am__append_2)
1743 +@NATIVE_LD_FALSE@      $(am__append_3)
1744 +@NATIVE_LD_TRUE@noinst_LIBRARIES = libld_elf.a libar.a $(am__append_3)
1745  @NATIVE_LD_TRUE@native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu)
1746  @NEVER_TRUE@libdummy_a_SOURCES = i386_ld.c
1747  ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \
1748 @@ -509,6 +512,11 @@ libeu = ../lib/libeu.a
1749  ldgeneric_no_Wunused = yes
1750  ldgeneric_no_Wstack_usage = yes
1751  
1752 +# Buggy old compilers or libc headers.
1753 +readelf_no_Werror = yes
1754 +strings_no_Werror = yes
1755 +addr2line_no_Wformat = yes
1756 +
1757  # Bad, bad stack usage...
1758  readelf_no_Wstack_usage = yes
1759  nm_no_Wstack_usage = yes
1760 @@ -528,7 +536,7 @@ nm_LDADD = $(libdw) $(libebl) $(libelf)
1761  size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
1762  strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
1763  ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \
1764 -       $(am__append_3)
1765 +       $(am__append_4)
1766  ld_LDFLAGS = -rdynamic
1767  elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
1768  findtextrel_LDADD = $(libdw) $(libelf) $(argp_LDADD)
1769 --- a/src/readelf.c
1770 +++ b/src/readelf.c
1771 @@ -4366,10 +4366,12 @@ listptr_base (struct listptr *p)
1772    return base;
1773  }
1774  
1775 +static const char *listptr_name;
1776 +
1777  static int
1778 -compare_listptr (const void *a, const void *b, void *arg)
1779 +compare_listptr (const void *a, const void *b)
1780  {
1781 -  const char *name = arg;
1782 +  const char *const name = listptr_name;
1783    struct listptr *p1 = (void *) a;
1784    struct listptr *p2 = (void *) b;
1785  
1786 @@ -4465,8 +4467,11 @@ static void
1787  sort_listptr (struct listptr_table *table, const char *name)
1788  {
1789    if (table->n > 0)
1790 -    qsort_r (table->table, table->n, sizeof table->table[0],
1791 -            &compare_listptr, (void *) name);
1792 +    {
1793 +      listptr_name = name;
1794 +      qsort (table->table, table->n, sizeof table->table[0],
1795 +            &compare_listptr);
1796 +    }
1797  }
1798  
1799  static bool
1800 @@ -9563,7 +9568,7 @@ dump_archive_index (Elf *elf, const char
1801           if (unlikely (elf_rand (elf, as_off) == 0)
1802               || unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf))
1803                            == NULL))
1804 -#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7)
1805 +#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7) || __GNUC__ < 4
1806             while (1)
1807  #endif
1808               error (EXIT_FAILURE, 0,
1809 --- a/src/strings.c
1810 +++ b/src/strings.c
1811 @@ -43,6 +43,10 @@
1812  
1813  #include <system.h>
1814  
1815 +#ifndef MAP_POPULATE
1816 +# define MAP_POPULATE 0
1817 +#endif
1818 +
1819  
1820  /* Prototypes of local functions.  */
1821  static int read_fd (int fd, const char *fname, off64_t fdlen);
1822 @@ -489,8 +493,13 @@ map_file (int fd, off64_t start_off, off
1823                     fd, start_off);
1824        if (mem != MAP_FAILED)
1825         {
1826 +#if !defined POSIX_MADV_SEQUENTIAL && defined MADV_SEQUENTIAL
1827 +# define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
1828 +#endif
1829 +#ifdef POSIX_MADV_SEQUENTIAL
1830           /* We will go through the mapping sequentially.  */
1831           (void) posix_madvise (mem, map_size, POSIX_MADV_SEQUENTIAL);
1832 +#endif
1833           break;
1834         }
1835        if (errno != EINVAL && errno != ENOMEM)
1836 @@ -581,9 +590,11 @@ read_block (int fd, const char *fname, o
1837        elfmap_off = from & ~(ps - 1);
1838        elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size);
1839  
1840 +#ifdef POSIX_FADV_SEQUENTIAL
1841        if (unlikely (elfmap == MAP_FAILED))
1842         /* Let the kernel know we are going to read everything in sequence.  */
1843         (void) posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
1844 +#endif
1845      }
1846  
1847    if (unlikely (elfmap == MAP_FAILED))
1848 --- a/src/strip.c
1849 +++ b/src/strip.c
1850 @@ -2191,7 +2191,14 @@ while computing checksum for debug infor
1851    /* If requested, preserve the timestamp.  */
1852    if (tvp != NULL)
1853      {
1854 +#ifdef HAVE_FUTIMENS
1855        if (futimens (fd, tvp) != 0)
1856 +#else
1857 +      struct timeval times[2];
1858 +      TIMESPEC_TO_TIMEVAL (&times[0], &tvp[0]);
1859 +      TIMESPEC_TO_TIMEVAL (&times[1], &tvp[1]);
1860 +      if (futimes (fd, times) != 0)
1861 +#endif
1862         {
1863           error (0, errno, gettext ("\
1864  cannot set access and modification date of '%s'"),
1865 @@ -2263,7 +2270,14 @@ handle_ar (int fd, Elf *elf, const char
1866  
1867    if (tvp != NULL)
1868      {
1869 +#ifdef HAVE_FUTIMENS
1870        if (unlikely (futimens (fd, tvp) != 0))
1871 +#else
1872 +      struct timeval times[2];
1873 +      TIMESPEC_TO_TIMEVAL (&times[0], &tvp[0]);
1874 +      TIMESPEC_TO_TIMEVAL (&times[1], &tvp[1]);
1875 +      if (unlikely (futimes (fd, times) != 0))
1876 +#endif
1877         {
1878           error (0, errno, gettext ("\
1879  cannot set access and modification date of '%s'"), fname);
1880 --- a/tests/backtrace.c
1881 +++ b/tests/backtrace.c
1882 @@ -36,6 +36,7 @@
1883  #include <fcntl.h>
1884  #include <string.h>
1885  #include <argp.h>
1886 +#include <sys/syscall.h>
1887  #include ELFUTILS_HEADER(dwfl)
1888  
1889  #ifndef __linux__
1890 --- a/tests/ChangeLog
1891 +++ b/tests/ChangeLog
1892 @@ -614,6 +614,13 @@
1893  
1894  2013-12-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
1895  
1896 +       Handle T-stopped detach for old kernels.
1897 +       * backtrace.c: Include sys/syscall.h.
1898 +       (linux_proc_pid_is_stopped): New function.
1899 +       (ptrace_detach_stopped): Handle old kernels.
1900 +
1901 +2013-12-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
1902 +
1903         * Makefile.am (check_PROGRAMS): Add backtrace, backtrace-child,
1904         backtrace-data and backtrace-dwarf.
1905         (BUILT_SOURCES, clean-local, backtrace-child-biarch): New.
1906 @@ -1478,6 +1485,8 @@
1907  
1908  2008-01-21  Roland McGrath  <roland@redhat.com>
1909  
1910 +       * line2addr.c (main): Revert last change.
1911 +
1912         * testfile45.S.bz2: Add tests for cltq, cqto.
1913         * testfile45.expect.bz2: Adjust.
1914  
1915 @@ -2186,6 +2195,11 @@
1916         * Makefile.am (TESTS): Add run-elflint-test.sh.
1917         (EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2.
1918  
1919 +2005-05-31  Roland McGrath  <roland@redhat.com>
1920 +
1921 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
1922 +       (AM_CFLAGS): Use it in place of -Wextra.
1923 +
1924  2005-05-24  Ulrich Drepper  <drepper@redhat.com>
1925  
1926         * get-files.c (main): Use correct format specifier.
1927 --- a/tests/line2addr.c
1928 +++ b/tests/line2addr.c
1929 @@ -124,7 +124,7 @@ main (int argc, char *argv[])
1930      {
1931        struct args a = { .arg = argv[cnt] };
1932  
1933 -      switch (sscanf (a.arg, "%m[^:]:%d", &a.file, &a.line))
1934 +      switch (sscanf (a.arg, "%a[^:]:%d", &a.file, &a.line))
1935         {
1936         default:
1937         case 0:
1938 --- a/tests/Makefile.am
1939 +++ b/tests/Makefile.am
1940 @@ -382,6 +382,7 @@ get_lines_LDADD = $(libdw) $(libelf)
1941  get_files_LDADD = $(libdw) $(libelf)
1942  get_aranges_LDADD = $(libdw) $(libelf)
1943  allfcts_LDADD = $(libdw) $(libelf)
1944 +line2addr_no_Wformat = yes
1945  line2addr_LDADD = $(libdw) $(argp_LDADD)
1946  addrscopes_LDADD = $(libdw) $(argp_LDADD)
1947  funcscopes_LDADD = $(libdw) $(argp_LDADD)
1948 --- a/tests/Makefile.in
1949 +++ b/tests/Makefile.in
1950 @@ -87,14 +87,15 @@ PRE_UNINSTALL = :
1951  POST_UNINSTALL = :
1952  build_triplet = @build@
1953  host_triplet = @host@
1954 -@SYMBOL_VERSIONING_TRUE@am__append_1 = -DSYMBOL_VERSIONING
1955 -@STANDALONE_FALSE@am__append_2 = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \
1956 +@BUILD_WERROR_TRUE@am__append_1 = $(if $($(*F)_no_Werror),,-Werror)
1957 +@SYMBOL_VERSIONING_TRUE@am__append_2 = -DSYMBOL_VERSIONING
1958 +@STANDALONE_FALSE@am__append_3 = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdw \
1959  @STANDALONE_FALSE@         -I$(top_srcdir)/libdwfl -I$(top_srcdir)/libdwelf \
1960  @STANDALONE_FALSE@         -I$(top_srcdir)/libebl -I$(top_srcdir)/libelf \
1961  @STANDALONE_FALSE@         -I$(top_srcdir)/lib -I..
1962  
1963 -@STANDALONE_FALSE@am__append_3 = -Wl,-rpath-link,../libasm:../libdw:../libelf
1964 -@TESTS_RPATH_TRUE@am__append_4 = -Wl,-rpath,$(BUILD_RPATH)
1965 +@STANDALONE_FALSE@am__append_4 = -Wl,-rpath-link,../libasm:../libdw:../libelf
1966 +@TESTS_RPATH_TRUE@am__append_5 = -Wl,-rpath,$(BUILD_RPATH)
1967  check_PROGRAMS = arextract$(EXEEXT) arsymtest$(EXEEXT) \
1968         newfile$(EXEEXT) saridx$(EXEEXT) scnnames$(EXEEXT) \
1969         sectiondump$(EXEEXT) showptable$(EXEEXT) update1$(EXEEXT) \
1970 @@ -123,7 +124,7 @@ check_PROGRAMS = arextract$(EXEEXT) arsy
1971         aggregate_size$(EXEEXT) vdsosyms$(EXEEXT) getsrc_die$(EXEEXT) \
1972         strptr$(EXEEXT) newdata$(EXEEXT) elfstrtab$(EXEEXT) \
1973         $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_4)
1974 -@BIARCH_TRUE@am__append_5 = backtrace-child-biarch
1975 +@BIARCH_TRUE@am__append_6 = backtrace-child-biarch
1976  TESTS = run-arextract.sh run-arsymtest.sh newfile$(EXEEXT) \
1977         test-nlist$(EXEEXT) update1$(EXEEXT) update2$(EXEEXT) \
1978         update3$(EXEEXT) update4$(EXEEXT) run-show-die-info.sh \
1979 @@ -173,14 +174,14 @@ TESTS = run-arextract.sh run-arsymtest.s
1980         run-allfcts-multi.sh run-deleted.sh run-linkmap-cut.sh \
1981         run-aggregate-size.sh vdsosyms$(EXEEXT) run-readelf-A.sh \
1982         run-getsrc-die.sh run-strptr.sh newdata$(EXEEXT) \
1983 -       elfstrtab$(EXEEXT) $(am__EXEEXT_2) $(am__append_8) \
1984 -       $(am__append_9) $(am__EXEEXT_4)
1985 -@STANDALONE_FALSE@am__append_6 = msg_tst md5-sha1-test
1986 +       elfstrtab$(EXEEXT) $(am__EXEEXT_2) $(am__append_9) \
1987 +       $(am__append_10) $(am__EXEEXT_4)
1988  @STANDALONE_FALSE@am__append_7 = msg_tst md5-sha1-test
1989 -@LZMA_TRUE@am__append_8 = run-readelf-s.sh run-dwflsyms.sh
1990 -@ZLIB_TRUE@am__append_9 = run-readelf-zdebug.sh
1991 -@HAVE_LIBASM_TRUE@am__append_10 = $(asm_TESTS)
1992 +@STANDALONE_FALSE@am__append_8 = msg_tst md5-sha1-test
1993 +@LZMA_TRUE@am__append_9 = run-readelf-s.sh run-dwflsyms.sh
1994 +@ZLIB_TRUE@am__append_10 = run-readelf-zdebug.sh
1995  @HAVE_LIBASM_TRUE@am__append_11 = $(asm_TESTS)
1996 +@HAVE_LIBASM_TRUE@am__append_12 = $(asm_TESTS)
1997  subdir = tests
1998  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
1999  am__aclocal_m4_deps = $(top_srcdir)/m4/biarch.m4 \
2000 @@ -830,6 +831,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
2001  INSTALL_SCRIPT = @INSTALL_SCRIPT@
2002  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
2003  LDFLAGS = @LDFLAGS@
2004 +LD_AS_NEEDED = @LD_AS_NEEDED@
2005  LEX = @LEX@
2006  LEXLIB = @LEXLIB@
2007  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
2008 @@ -861,6 +863,7 @@ SHELL = @SHELL@
2009  STRIP = @STRIP@
2010  USE_NLS = @USE_NLS@
2011  VERSION = @VERSION@
2012 +WEXTRA = @WEXTRA@
2013  XGETTEXT = @XGETTEXT@
2014  XGETTEXT_015 = @XGETTEXT_015@
2015  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
2016 @@ -921,26 +924,26 @@ top_build_prefix = @top_build_prefix@
2017  top_builddir = @top_builddir@
2018  top_srcdir = @top_srcdir@
2019  zip_LIBS = @zip_LIBS@
2020 -AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. $(am__append_2)
2021 +AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. $(am__append_3)
2022  @ADD_STACK_USAGE_WARNING_FALSE@STACK_USAGE_WARNING = 
2023  
2024  # Warn about stack usage of more than 256K = 262144 bytes.
2025  @ADD_STACK_USAGE_WARNING_TRUE@STACK_USAGE_WARNING = -Wstack-usage=262144
2026 -AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
2027 -           $(if $($(*F)_no_Werror),,-Werror) \
2028 -           $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
2029 -           $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
2030 -           $($(*F)_CFLAGS)
2031 -
2032 +AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
2033 +       $($(*F)_no_Werror),,-Werror) $(if \
2034 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
2035 +       $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $(if \
2036 +       $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
2037 +       $($(*F)_CFLAGS) $(am__append_1)
2038  COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
2039 -DEFS.os = -DPIC -DSHARED $(am__append_1)
2040 +DEFS.os = -DPIC -DSHARED $(am__append_2)
2041  CLEANFILES = *.gcno *.gcda
2042  textrel_msg = echo "WARNING: TEXTREL found in '$@'"
2043  @FATAL_TEXTREL_FALSE@textrel_found = $(textrel_msg)
2044  @FATAL_TEXTREL_TRUE@textrel_found = $(textrel_msg); exit 1
2045  textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then $(textrel_found); fi
2046  BUILD_RPATH = \$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../backends:\$$ORIGIN/../libelf
2047 -AM_LDFLAGS = $(am__append_3) $(am__append_4)
2048 +AM_LDFLAGS = $(am__append_4) $(am__append_5)
2049  @TESTS_RPATH_FALSE@tests_rpath = no
2050  @TESTS_RPATH_TRUE@tests_rpath = yes
2051  asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
2052 @@ -1167,6 +1170,7 @@ get_lines_LDADD = $(libdw) $(libelf)
2053  get_files_LDADD = $(libdw) $(libelf)
2054  get_aranges_LDADD = $(libdw) $(libelf)
2055  allfcts_LDADD = $(libdw) $(libelf)
2056 +line2addr_no_Wformat = yes
2057  line2addr_LDADD = $(libdw) $(argp_LDADD)
2058  addrscopes_LDADD = $(libdw) $(argp_LDADD)
2059  funcscopes_LDADD = $(libdw) $(argp_LDADD)