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