[package] elfutils: package libelf and libdw, update to 0.152
[packages.git] / libs / elfutils / patches / 001-elfutils-portability.patch
1 --- a/backends/ChangeLog
2 +++ b/backends/ChangeLog
3 @@ -111,6 +111,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 @@ -438,6 +442,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 @@ -460,6 +469,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 @@ -103,7 +103,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) $(libmudflap)
43 +               -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap)
44         $(textrel_check)
45  
46  libebl_i386.so: $(cpu_i386)
47 --- a/backends/Makefile.in
48 +++ b/backends/Makefile.in
49 @@ -165,6 +165,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
50  INSTALL_SCRIPT = @INSTALL_SCRIPT@
51  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
52  LDFLAGS = @LDFLAGS@
53 +LD_AS_NEEDED = @LD_AS_NEEDED@
54  LEX = @LEX@
55  LEXLIB = @LEXLIB@
56  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
57 @@ -194,6 +195,7 @@ SHELL = @SHELL@
58  STRIP = @STRIP@
59  USE_NLS = @USE_NLS@
60  VERSION = @VERSION@
61 +WEXTRA = @WEXTRA@
62  XGETTEXT = @XGETTEXT@
63  XGETTEXT_015 = @XGETTEXT_015@
64  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
65 @@ -257,7 +259,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
66         -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
67  AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
68         $($(*F)_no_Werror),,-Werror) $(if \
69 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
70 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
71         $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
72         $(am__append_1)
73  @MUDFLAP_FALSE@libmudflap = 
74 @@ -698,7 +700,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a
75         $(LINK) -shared -o $(@:.map=.so) \
76                 -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
77                 -Wl,--version-script,$(@:.so=.map) \
78 -               -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
79 +               -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap)
80         $(textrel_check)
81  
82  libebl_i386.so: $(cpu_i386)
83 --- a/ChangeLog
84 +++ b/ChangeLog
85 @@ -13,6 +13,10 @@
86  
87         * configure.ac (LOCALEDIR, DATADIRNAME): Removed.
88  
89 +2009-11-22  Roland McGrath  <roland@redhat.com>
90 +
91 +       * configure.ac: Use sed and expr instead of modern bash extensions.
92 +
93  2009-09-21  Ulrich Drepper  <drepper@redhat.com>
94  
95         * configure.ac: Update for more modern autoconf.
96 @@ -21,6 +25,10 @@
97  
98         * configure.ac (zip_LIBS): Check for liblzma too.
99  
100 +2009-08-17  Roland McGrath  <roland@redhat.com>
101 +
102 +       * configure.ac: Check for -fgnu89-inline; add it to WEXTRA if it works.
103 +
104  2009-04-19  Roland McGrath  <roland@redhat.com>
105  
106         * configure.ac (eu_version): Round down here, not in version.h macros.
107 @@ -32,6 +40,8 @@
108  
109  2009-01-23  Roland McGrath  <roland@redhat.com>
110  
111 +       * configure.ac: Check for __builtin_popcount.
112 +
113         * configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3.
114  
115         * configure.ac (__thread check): Use AC_LINK_IFELSE, in case of
116 @@ -112,6 +122,10 @@
117         * configure.ac: Add dummy automake conditional to get dependencies
118         for non-generic linker right.  See src/Makefile.am.
119  
120 +2005-11-22  Roland McGrath  <roland@redhat.com>
121 +
122 +       * configure.ac: Check for --as-needed linker option.
123 +
124  2005-11-18  Roland McGrath  <roland@redhat.com>
125  
126         * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable.
127 @@ -159,6 +173,17 @@
128         * Makefile.am (all_SUBDIRS): Add libdwfl.
129         * configure.ac: Write libdwfl/Makefile.
130  
131 +2005-05-31  Roland McGrath  <roland@redhat.com>
132 +
133 +       * configure.ac (WEXTRA): Check for -Wextra and set this substitution.
134 +
135 +       * configure.ac: Check for struct stat st_?tim members.
136 +       * src/strip.c (process_file): Use st_?time if st_?tim are not there.
137 +
138 +       * configure.ac: Check for futimes function.
139 +       * src/strip.c (handle_elf) [! HAVE_FUTIMES]: Use utimes instead.
140 +       (handle_ar) [! HAVE_FUTIMES]: Likewise.
141 +
142  2005-05-19  Roland McGrath  <roland@redhat.com>
143  
144         * configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros.
145 --- a/config/eu.am
146 +++ b/config/eu.am
147 @@ -25,11 +25,14 @@
148  ## <http://www.openinventionnetwork.com>.
149  ##
150  
151 +WEXTRA = @WEXTRA@
152 +LD_AS_NEEDED = @LD_AS_NEEDED@
153 +
154  DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
155  INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
156  AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
157             $(if $($(*F)_no_Werror),,-Werror) \
158 -           $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
159 +           $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \
160             $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
161             $($(*F)_CFLAGS)
162  
163 --- a/config/Makefile.in
164 +++ b/config/Makefile.in
165 @@ -76,6 +76,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
166  INSTALL_SCRIPT = @INSTALL_SCRIPT@
167  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
168  LDFLAGS = @LDFLAGS@
169 +LD_AS_NEEDED = @LD_AS_NEEDED@
170  LEX = @LEX@
171  LEXLIB = @LEXLIB@
172  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
173 @@ -105,6 +106,7 @@ SHELL = @SHELL@
174  STRIP = @STRIP@
175  USE_NLS = @USE_NLS@
176  VERSION = @VERSION@
177 +WEXTRA = @WEXTRA@
178  XGETTEXT = @XGETTEXT@
179  XGETTEXT_015 = @XGETTEXT_015@
180  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
181 --- a/config.h.in
182 +++ b/config.h.in
183 @@ -1,5 +1,8 @@
184  /* config.h.in.  Generated from configure.ac by autoheader.  */
185  
186 +/* Have __builtin_popcount. */
187 +#undef HAVE_BUILTIN_POPCOUNT
188 +
189  /* $libdir subdirectory containing libebl modules. */
190  #undef LIBEBL_SUBDIR
191  
192 @@ -55,4 +58,7 @@
193  /* Define for large files, on AIX-style hosts. */
194  #undef _LARGE_FILES
195  
196 +/* Stubbed out if missing compiler support. */
197 +#undef __thread
198 +
199  #include <eu-config.h>
200 --- a/configure
201 +++ b/configure
202 @@ -602,6 +602,8 @@ NEVER_TRUE
203  base_cpu
204  NATIVE_LD_FALSE
205  NATIVE_LD_TRUE
206 +LD_AS_NEEDED
207 +WEXTRA
208  LEXLIB
209  LEX_OUTPUT_ROOT
210  LEX
211 @@ -3856,6 +3858,130 @@ if test "x$ac_cv_c99" != xyes; then :
212    as_fn_error $? "gcc with C99 support required" "$LINENO" 5
213  fi
214  
215 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra option to $CC" >&5
216 +$as_echo_n "checking for -Wextra option to $CC... " >&6; }
217 +if test "${ac_cv_cc_wextra+set}" = set; then :
218 +  $as_echo_n "(cached) " >&6
219 +else
220 +  old_CFLAGS="$CFLAGS"
221 +CFLAGS="$CFLAGS -Wextra"
222 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
223 +/* end confdefs.h.  */
224 +void foo (void) { }
225 +_ACEOF
226 +if ac_fn_c_try_compile "$LINENO"; then :
227 +  ac_cv_cc_wextra=yes
228 +else
229 +  ac_cv_cc_wextra=no
230 +fi
231 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
232 +CFLAGS="$old_CFLAGS"
233 +fi
234 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_wextra" >&5
235 +$as_echo "$ac_cv_cc_wextra" >&6; }
236 +
237 +if test "x$ac_cv_cc_wextra" = xyes; then :
238 +  WEXTRA=-Wextra
239 +else
240 +  WEXTRA=-W
241 +fi
242 +
243 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fgnu89-inline option to $CC" >&5
244 +$as_echo_n "checking for -fgnu89-inline option to $CC... " >&6; }
245 +if test "${ac_cv_cc_gnu89_inline+set}" = set; then :
246 +  $as_echo_n "(cached) " >&6
247 +else
248 +  old_CFLAGS="$CFLAGS"
249 +CFLAGS="$CFLAGS -fgnu89-inline -Werror"
250 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
251 +/* end confdefs.h.  */
252 +
253 +void foo (void)
254 +{
255 +  inline void bar (void) {}
256 +  bar ();
257 +}
258 +extern inline void baz (void) {}
259 +
260 +_ACEOF
261 +if ac_fn_c_try_compile "$LINENO"; then :
262 +  ac_cv_cc_gnu89_inline=yes
263 +else
264 +  ac_cv_cc_gnu89_inline=no
265 +fi
266 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
267 +CFLAGS="$old_CFLAGS"
268 +fi
269 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_gnu89_inline" >&5
270 +$as_echo "$ac_cv_cc_gnu89_inline" >&6; }
271 +if test "x$ac_cv_cc_gnu89_inline" = xyes; then :
272 +  WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"
273 +fi
274 +
275 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --as-needed linker option" >&5
276 +$as_echo_n "checking for --as-needed linker option... " >&6; }
277 +if test "${ac_cv_as_needed+set}" = set; then :
278 +  $as_echo_n "(cached) " >&6
279 +else
280 +  cat > conftest.c <<EOF
281 +int main (void) { return 0; }
282 +EOF
283 +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
284 +                           -fPIC -shared -o conftest.so conftest.c
285 +                           -Wl,--as-needed 1>&5'
286 +  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
287 +  (eval $ac_try) 2>&5
288 +  ac_status=$?
289 +  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
290 +  test $ac_status = 0; }; }
291 +then
292 +  ac_cv_as_needed=yes
293 +else
294 +  ac_cv_as_needed=no
295 +fi
296 +rm -f conftest*
297 +fi
298 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_as_needed" >&5
299 +$as_echo "$ac_cv_as_needed" >&6; }
300 +if test "x$ac_cv_as_needed" = xyes; then :
301 +  LD_AS_NEEDED=-Wl,--as-needed
302 +else
303 +  LD_AS_NEEDED=
304 +fi
305 +
306 +
307 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_popcount" >&5
308 +$as_echo_n "checking for __builtin_popcount... " >&6; }
309 +if test "${ac_cv_popcount+set}" = set; then :
310 +  $as_echo_n "(cached) " >&6
311 +else
312 +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
313 +/* end confdefs.h.  */
314 +
315 +int
316 +main ()
317 +{
318 +exit (__builtin_popcount (127));
319 +  ;
320 +  return 0;
321 +}
322 +_ACEOF
323 +if ac_fn_c_try_link "$LINENO"; then :
324 +  ac_cv_popcount=yes
325 +else
326 +  ac_cv_popcount=no
327 +fi
328 +rm -f core conftest.err conftest.$ac_objext \
329 +    conftest$ac_exeext conftest.$ac_ext
330 +fi
331 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_popcount" >&5
332 +$as_echo "$ac_cv_popcount" >&6; }
333 +if test "x$ac_cv_popcount" = xyes; then :
334 +
335 +$as_echo "#define HAVE_BUILTIN_POPCOUNT 1" >>confdefs.h
336 +
337 +fi
338 +
339  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __thread support" >&5
340  $as_echo_n "checking for __thread support... " >&6; }
341  if test "${ac_cv_tls+set}" = set; then :
342 @@ -3892,7 +4018,11 @@ fi
343  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5
344  $as_echo "$ac_cv_tls" >&6; }
345  if test "x$ac_cv_tls" != xyes; then :
346 -  as_fn_error $? "__thread support required" "$LINENO" 5
347 +  if test "$use_locks" = yes; then :
348 +    as_fn_error "--enable-thread-safety requires __thread support" "$LINENO" 5
349 +  else
350 +    as_echo "#define __thread /* empty: no multi-thread support */" >>confdefs.h
351 +  fi
352  fi
353  
354  # Check whether --enable-largefile was given.
355 @@ -4878,7 +5008,7 @@ ac_config_files="$ac_config_files versio
356  
357  # 1.234<whatever> -> 1234<whatever>
358  case "$PACKAGE_VERSION" in
359 -[0-9].*) eu_version="${PACKAGE_VERSION/./}" ;;
360 +[0-9].*) eu_version=`echo "$PACKAGE_VERSION" | sed 's@\.@@'` ;;
361  *)                as_fn_error $? "confused by version number '$PACKAGE_VERSION'" "$LINENO" 5 ;;
362  esac
363  case "$eu_version" in
364 @@ -4907,7 +5037,7 @@ case "$eu_version" in
365  esac
366  
367  # Round up to the next release API (x.y) version.
368 -eu_version=$[($eu_version + 999) / 1000]
369 +eu_version=`expr \( $eu_version + 999 \) / 1000`
370  
371  cat >confcache <<\_ACEOF
372  # This file is a shell script that caches the results of configure
373 --- a/configure.ac
374 +++ b/configure.ac
375 @@ -70,6 +70,54 @@ CFLAGS="$old_CFLAGS"])
376  AS_IF([test "x$ac_cv_c99" != xyes],
377        AC_MSG_ERROR([gcc with C99 support required]))
378  
379 +AC_CACHE_CHECK([for -Wextra option to $CC], ac_cv_cc_wextra, [dnl
380 +old_CFLAGS="$CFLAGS"
381 +CFLAGS="$CFLAGS -Wextra"
382 +AC_COMPILE_IFELSE([void foo (void) { }],
383 +                 ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no)
384 +CFLAGS="$old_CFLAGS"])
385 +AC_SUBST(WEXTRA)
386 +AS_IF([test "x$ac_cv_cc_wextra" = xyes], [WEXTRA=-Wextra], [WEXTRA=-W])
387 +
388 +AC_CACHE_CHECK([for -fgnu89-inline option to $CC], ac_cv_cc_gnu89_inline, [dnl
389 +old_CFLAGS="$CFLAGS"
390 +CFLAGS="$CFLAGS -fgnu89-inline -Werror"
391 +AC_COMPILE_IFELSE([
392 +void foo (void)
393 +{
394 +  inline void bar (void) {}
395 +  bar ();
396 +}
397 +extern inline void baz (void) {}
398 +], ac_cv_cc_gnu89_inline=yes, ac_cv_cc_gnu89_inline=no)
399 +CFLAGS="$old_CFLAGS"])
400 +AS_IF([test "x$ac_cv_cc_gnu89_inline" = xyes],
401 +      [WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"])
402 +
403 +AC_CACHE_CHECK([for --as-needed linker option],
404 +              ac_cv_as_needed, [dnl
405 +cat > conftest.c <<EOF
406 +int main (void) { return 0; }
407 +EOF
408 +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
409 +                           -fPIC -shared -o conftest.so conftest.c
410 +                           -Wl,--as-needed 1>&AS_MESSAGE_LOG_FD])
411 +then
412 +  ac_cv_as_needed=yes
413 +else
414 +  ac_cv_as_needed=no
415 +fi
416 +rm -f conftest*])
417 +AS_IF([test "x$ac_cv_as_needed" = xyes],
418 +      [LD_AS_NEEDED=-Wl,--as-needed], [LD_AS_NEEDED=])
419 +AC_SUBST(LD_AS_NEEDED)
420 +
421 +AC_CACHE_CHECK([for __builtin_popcount], ac_cv_popcount, [dnl
422 +AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[exit (__builtin_popcount (127));]])],
423 +              ac_cv_popcount=yes, ac_cv_popcount=no)])
424 +AS_IF([test "x$ac_cv_popcount" = xyes],
425 +      [AC_DEFINE([HAVE_BUILTIN_POPCOUNT], [1], [Have __builtin_popcount.])])
426 +
427  AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
428  # Use the same flags that we use for our DSOs, so the test is representative.
429  # Some old compiler/linker/libc combinations fail some ways and not others.
430 @@ -85,7 +133,10 @@ static __thread int a; int foo (int b) {
431  CFLAGS="$save_CFLAGS"
432  LDFLAGS="$save_LDFLAGS"])
433  AS_IF([test "x$ac_cv_tls" != xyes],
434 -      AC_MSG_ERROR([__thread support required]))
435 +      [AS_IF([test "$use_locks" = yes],
436 +            [AC_MSG_ERROR([--enable-thread-safety requires __thread support])],
437 +            [AC_DEFINE([__thread], [/* empty: no multi-thread support */],
438 +                       [Stubbed out if missing compiler support.])])])
439  
440  dnl This test must come as early as possible after the compiler configuration
441  dnl tests, because the choice of the file model can (in principle) affect
442 @@ -248,7 +299,7 @@ AC_SUBST([eu_version])
443  
444  # 1.234<whatever> -> 1234<whatever>
445  case "$PACKAGE_VERSION" in
446 -[[0-9]].*) eu_version="${PACKAGE_VERSION/./}" ;;
447 +[[0-9]].*) eu_version=`echo "$PACKAGE_VERSION" | sed 's@\.@@'` ;;
448  *)                AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
449  esac
450  case "$eu_version" in
451 @@ -277,6 +328,6 @@ case "$eu_version" in
452  esac
453  
454  # Round up to the next release API (x.y) version.
455 -[eu_version=$[($eu_version + 999) / 1000]]
456 +eu_version=`expr \( $eu_version + 999 \) / 1000`
457  
458  AC_OUTPUT
459 --- a/lib/ChangeLog
460 +++ b/lib/ChangeLog
461 @@ -14,6 +14,9 @@
462  
463  2009-01-23  Roland McGrath  <roland@redhat.com>
464  
465 +       * eu-config.h [! HAVE_BUILTIN_POPCOUNT]
466 +       (__builtin_popcount): New inline function.
467 +
468         * eu-config.h: Add multiple inclusion protection.
469  
470  2009-01-17  Ulrich Drepper  <drepper@redhat.com>
471 @@ -70,6 +73,11 @@
472         * Makefile.am (libeu_a_SOURCES): Add it.
473         * system.h: Declare crc32_file.
474  
475 +2005-02-07  Roland McGrath  <roland@redhat.com>
476 +
477 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
478 +       (AM_CFLAGS): Use it in place of -Wextra.
479 +
480  2005-04-30  Ulrich Drepper  <drepper@redhat.com>
481  
482         * Makefile.am: Use -ffunction-sections for xmalloc.c.
483 --- a/lib/eu-config.h
484 +++ b/lib/eu-config.h
485 @@ -182,6 +182,17 @@ asm (".section predict_data, \"aw\"; .pr
486  /* This macro is used by the tests conditionalize for standalone building.  */
487  #define ELFUTILS_HEADER(name) <lib##name.h>
488  
489 +#ifndef HAVE_BUILTIN_POPCOUNT
490 +# define __builtin_popcount hakmem_popcount
491 +static inline unsigned int __attribute__ ((unused))
492 +hakmem_popcount (unsigned int x)
493 +{
494 +  /* HAKMEM 169 */
495 +  unsigned int n = x - ((x >> 1) & 033333333333) - ((x >> 2) & 011111111111);
496 +  return ((n + (n >> 3)) & 030707070707) % 63;
497 +}
498 +#endif /* HAVE_BUILTIN_POPCOUNT */
499 +
500  
501  #ifdef SHARED
502  # define OLD_VERSION(name, version) \
503 --- a/lib/Makefile.in
504 +++ b/lib/Makefile.in
505 @@ -99,6 +99,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
506  INSTALL_SCRIPT = @INSTALL_SCRIPT@
507  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
508  LDFLAGS = @LDFLAGS@
509 +LD_AS_NEEDED = @LD_AS_NEEDED@
510  LEX = @LEX@
511  LEXLIB = @LEXLIB@
512  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
513 @@ -128,6 +129,7 @@ SHELL = @SHELL@
514  STRIP = @STRIP@
515  USE_NLS = @USE_NLS@
516  VERSION = @VERSION@
517 +WEXTRA = @WEXTRA@
518  XGETTEXT = @XGETTEXT@
519  XGETTEXT_015 = @XGETTEXT_015@
520  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
521 @@ -190,7 +192,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
522         -I$(srcdir)/../libelf
523  AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
524         $($(*F)_no_Werror),,-Werror) $(if \
525 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
526 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
527         $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
528         $(am__append_1) -fpic
529  @MUDFLAP_FALSE@libmudflap = 
530 --- a/libasm/ChangeLog
531 +++ b/libasm/ChangeLog
532 @@ -71,6 +71,11 @@
533         * asm_error.c: Add new error ASM_E_IOERROR.
534         * libasmP.h: Add ASM_E_IOERROR definition.
535  
536 +2005-05-31  Roland McGrath  <roland@redhat.com>
537 +
538 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
539 +       (AM_CFLAGS): Use it in place of -Wextra.
540 +
541  2005-02-15  Ulrich Drepper  <drepper@redhat.com>
542  
543         * Makefile.am (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
544 --- a/libasm/Makefile.in
545 +++ b/libasm/Makefile.in
546 @@ -147,6 +147,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
547  INSTALL_SCRIPT = @INSTALL_SCRIPT@
548  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
549  LDFLAGS = @LDFLAGS@
550 +LD_AS_NEEDED = @LD_AS_NEEDED@
551  LEX = @LEX@
552  LEXLIB = @LEXLIB@
553  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
554 @@ -176,6 +177,7 @@ SHELL = @SHELL@
555  STRIP = @STRIP@
556  USE_NLS = @USE_NLS@
557  VERSION = 1
558 +WEXTRA = @WEXTRA@
559  XGETTEXT = @XGETTEXT@
560  XGETTEXT_015 = @XGETTEXT_015@
561  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
562 @@ -239,7 +241,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
563         -I$(top_srcdir)/libdw
564  AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
565         $($(*F)_no_Werror),,-Werror) $(if \
566 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
567 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
568         $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
569         $(am__append_1)
570  @MUDFLAP_FALSE@libmudflap = 
571 --- a/libcpu/ChangeLog
572 +++ b/libcpu/ChangeLog
573 @@ -15,6 +15,9 @@
574  
575  2009-01-23  Roland McGrath  <roland@redhat.com>
576  
577 +       * i386_disasm.c (i386_disasm): Add abort after assert-constant for old
578 +       compilers that don't realize it's noreturn.
579 +
580         * Makefile.am (i386_parse_CFLAGS): Use quotes around command
581         substitution that can produce leading whitespace.
582  
583 @@ -344,6 +347,11 @@
584         * defs/i386.doc: New file.
585         * defs/x86_64: New file.
586  
587 +2005-04-04  Roland McGrath  <roland@redhat.com>
588 +
589 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
590 +       (AM_CFLAGS): Use it instead of -Wextra.
591 +
592  2005-02-15  Ulrich Drepper  <drepper@redhat.com>
593  
594         * Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
595 --- a/libcpu/i386_disasm.c
596 +++ b/libcpu/i386_disasm.c
597 @@ -791,6 +791,7 @@ i386_disasm (const uint8_t **startp, con
598  
599                         default:
600                           assert (! "INVALID not handled");
601 +                         abort ();
602                         }
603                     }
604                   else
605 --- a/libcpu/Makefile.in
606 +++ b/libcpu/Makefile.in
607 @@ -116,6 +116,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
608  INSTALL_SCRIPT = @INSTALL_SCRIPT@
609  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
610  LDFLAGS = @LDFLAGS@
611 +LD_AS_NEEDED = @LD_AS_NEEDED@
612  LEX = @LEX@
613  LEXLIB = @LEXLIB@
614  LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
615 @@ -145,6 +146,7 @@ SHELL = @SHELL@
616  STRIP = @STRIP@
617  USE_NLS = @USE_NLS@
618  VERSION = @VERSION@
619 +WEXTRA = @WEXTRA@
620  XGETTEXT = @XGETTEXT@
621  XGETTEXT_015 = @XGETTEXT_015@
622  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
623 @@ -208,7 +210,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
624         -I$(srcdir)/../libdw -I$(srcdir)/../libasm
625  AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
626         $($(*F)_no_Werror),,-Werror) $(if \
627 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
628 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
629         $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
630         $(am__append_1) -fpic -fdollars-in-identifiers
631  @MUDFLAP_FALSE@libmudflap = 
632 --- a/libdw/ChangeLog
633 +++ b/libdw/ChangeLog
634 @@ -308,6 +308,10 @@
635  
636         * dwarf_hasattr_integrate.c: Integrate DW_AT_specification too.
637  
638 +2009-08-17  Roland McGrath  <roland@redhat.com>
639 +
640 +       * libdw.h: Disable extern inlines for GCC 4.2.
641 +
642  2009-08-10  Roland McGrath  <roland@redhat.com>
643  
644         * dwarf_getscopevar.c: Use dwarf_diename.
645 @@ -1076,6 +1080,11 @@
646  
647  2005-05-31  Roland McGrath  <roland@redhat.com>
648  
649 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
650 +       (AM_CFLAGS): Use it in place of -Wextra.
651 +
652 +2005-05-31  Roland McGrath  <roland@redhat.com>
653 +
654         * dwarf_formref_die.c (dwarf_formref_die): Add CU header offset to
655         formref offset.
656  
657 --- a/libdw/libdw.h
658 +++ b/libdw/libdw.h
659 @@ -852,7 +852,7 @@ extern Dwarf_OOM dwarf_new_oom_handler (
660  
661  
662  /* Inline optimizations.  */
663 -#ifdef __OPTIMIZE__
664 +#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
665  /* Return attribute code of given attribute.  */
666  __libdw_extern_inline unsigned int
667  dwarf_whatattr (Dwarf_Attribute *attr)
668 --- a/libdw/Makefile.in
669 +++ b/libdw/Makefile.in
670 @@ -192,6 +192,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
671  INSTALL_SCRIPT = @INSTALL_SCRIPT@
672  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
673  LDFLAGS = @LDFLAGS@
674 +LD_AS_NEEDED = @LD_AS_NEEDED@
675  LEX = @LEX@
676  LEXLIB = @LEXLIB@
677  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
678 @@ -221,6 +222,7 @@ SHELL = @SHELL@
679  STRIP = @STRIP@
680  USE_NLS = @USE_NLS@
681  VERSION = 1
682 +WEXTRA = @WEXTRA@
683  XGETTEXT = @XGETTEXT@
684  XGETTEXT_015 = @XGETTEXT_015@
685  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
686 @@ -283,7 +285,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
687         -I$(srcdir)/../libelf
688  AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
689         $($(*F)_no_Werror),,-Werror) $(if \
690 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
691 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
692         $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
693         $(am__append_1) $(am__append_2)
694  @MUDFLAP_FALSE@libmudflap = 
695 --- a/libdwfl/ChangeLog
696 +++ b/libdwfl/ChangeLog
697 @@ -1366,6 +1366,11 @@
698  
699  2005-07-21  Roland McGrath  <roland@redhat.com>
700  
701 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
702 +       (AM_CFLAGS): Use it in place of -Wextra.
703 +
704 +2005-07-21  Roland McGrath  <roland@redhat.com>
705 +
706         * Makefile.am (noinst_HEADERS): Add loc2c.c.
707  
708         * test2.c (main): Check sscanf result to quiet warning.
709 --- a/libdwfl/Makefile.in
710 +++ b/libdwfl/Makefile.in
711 @@ -182,6 +182,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
712  INSTALL_SCRIPT = @INSTALL_SCRIPT@
713  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
714  LDFLAGS = @LDFLAGS@
715 +LD_AS_NEEDED = @LD_AS_NEEDED@
716  LEX = @LEX@
717  LEXLIB = @LEXLIB@
718  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
719 @@ -211,6 +212,7 @@ SHELL = @SHELL@
720  STRIP = @STRIP@
721  USE_NLS = @USE_NLS@
722  VERSION = 1
723 +WEXTRA = @WEXTRA@
724  XGETTEXT = @XGETTEXT@
725  XGETTEXT_015 = @XGETTEXT_015@
726  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
727 @@ -274,7 +276,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
728         -I$(srcdir)/../libdw
729  AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
730         $($(*F)_no_Werror),,-Werror) $(if \
731 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
732 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
733         $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
734         $(am__append_1)
735  @MUDFLAP_FALSE@libmudflap = 
736 --- a/libebl/ChangeLog
737 +++ b/libebl/ChangeLog
738 @@ -628,6 +628,11 @@
739         * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency
740         tracking works right.
741  
742 +2005-05-31  Roland McGrath  <roland@redhat.com>
743 +
744 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
745 +       (AM_CFLAGS): Use it in place of -Wextra.
746 +
747  2005-05-21  Ulrich Drepper  <drepper@redhat.com>
748  
749         * libebl_x86_64.map: Add x86_64_core_note.
750 --- a/libebl/Makefile.in
751 +++ b/libebl/Makefile.in
752 @@ -143,6 +143,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
753  INSTALL_SCRIPT = @INSTALL_SCRIPT@
754  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
755  LDFLAGS = @LDFLAGS@
756 +LD_AS_NEEDED = @LD_AS_NEEDED@
757  LEX = @LEX@
758  LEXLIB = @LEXLIB@
759  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
760 @@ -172,6 +173,7 @@ SHELL = @SHELL@
761  STRIP = @STRIP@
762  USE_NLS = @USE_NLS@
763  VERSION = 1
764 +WEXTRA = @WEXTRA@
765  XGETTEXT = @XGETTEXT@
766  XGETTEXT_015 = @XGETTEXT_015@
767  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
768 @@ -235,7 +237,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
769         -I$(srcdir)/../libasm
770  AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
771         $($(*F)_no_Werror),,-Werror) $(if \
772 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
773 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
774         $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
775         $(am__append_1) -fpic
776  @MUDFLAP_FALSE@libmudflap = 
777 --- a/libelf/ChangeLog
778 +++ b/libelf/ChangeLog
779 @@ -671,6 +671,11 @@
780  
781         * elf.h: Update from glibc.
782  
783 +2005-05-31  Roland McGrath  <roland@redhat.com>
784 +
785 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
786 +       (AM_CFLAGS): Use it in place of -Wextra.
787 +
788  2005-05-08  Roland McGrath  <roland@redhat.com>
789  
790         * elf_begin.c (read_file) [_MUDFLAP]: Don't use mmap for now.
791 --- a/libelf/common.h
792 +++ b/libelf/common.h
793 @@ -160,7 +160,7 @@ libelf_release_all (Elf *elf)
794    (Var) = (sizeof (Var) == 1                                                 \
795            ? (unsigned char) (Var)                                            \
796            : (sizeof (Var) == 2                                               \
797 -             ? bswap_16 (Var)                                                \
798 +             ? (unsigned short int) bswap_16 (Var)                           \
799               : (sizeof (Var) == 4                                            \
800                  ? bswap_32 (Var)                                             \
801                  : bswap_64 (Var))))
802 @@ -169,7 +169,7 @@ libelf_release_all (Elf *elf)
803    (Dst) = (sizeof (Var) == 1                                                 \
804            ? (unsigned char) (Var)                                            \
805            : (sizeof (Var) == 2                                               \
806 -             ? bswap_16 (Var)                                                \
807 +             ? (unsigned short int) bswap_16 (Var)                           \
808               : (sizeof (Var) == 4                                            \
809                  ? bswap_32 (Var)                                             \
810                  : bswap_64 (Var))))
811 --- a/libelf/Makefile.in
812 +++ b/libelf/Makefile.in
813 @@ -189,6 +189,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
814  INSTALL_SCRIPT = @INSTALL_SCRIPT@
815  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
816  LDFLAGS = @LDFLAGS@
817 +LD_AS_NEEDED = @LD_AS_NEEDED@
818  LEX = @LEX@
819  LEXLIB = @LEXLIB@
820  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
821 @@ -218,6 +219,7 @@ SHELL = @SHELL@
822  STRIP = @STRIP@
823  USE_NLS = @USE_NLS@
824  VERSION = 1
825 +WEXTRA = @WEXTRA@
826  XGETTEXT = @XGETTEXT@
827  XGETTEXT_015 = @XGETTEXT_015@
828  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
829 @@ -279,7 +281,7 @@ zip_LIBS = @zip_LIBS@
830  INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
831  AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
832         $($(*F)_no_Werror),,-Werror) $(if \
833 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
834 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
835         $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
836         $(am__append_1) $(am__append_2)
837  @MUDFLAP_FALSE@libmudflap = 
838 --- a/m4/Makefile.in
839 +++ b/m4/Makefile.in
840 @@ -75,6 +75,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
841  INSTALL_SCRIPT = @INSTALL_SCRIPT@
842  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
843  LDFLAGS = @LDFLAGS@
844 +LD_AS_NEEDED = @LD_AS_NEEDED@
845  LEX = @LEX@
846  LEXLIB = @LEXLIB@
847  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
848 @@ -104,6 +105,7 @@ SHELL = @SHELL@
849  STRIP = @STRIP@
850  USE_NLS = @USE_NLS@
851  VERSION = @VERSION@
852 +WEXTRA = @WEXTRA@
853  XGETTEXT = @XGETTEXT@
854  XGETTEXT_015 = @XGETTEXT_015@
855  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
856 --- a/Makefile.in
857 +++ b/Makefile.in
858 @@ -155,6 +155,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
859  INSTALL_SCRIPT = @INSTALL_SCRIPT@
860  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
861  LDFLAGS = @LDFLAGS@
862 +LD_AS_NEEDED = @LD_AS_NEEDED@
863  LEX = @LEX@
864  LEXLIB = @LEXLIB@
865  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
866 @@ -184,6 +185,7 @@ SHELL = @SHELL@
867  STRIP = @STRIP@
868  USE_NLS = @USE_NLS@
869  VERSION = @VERSION@
870 +WEXTRA = @WEXTRA@
871  XGETTEXT = @XGETTEXT@
872  XGETTEXT_015 = @XGETTEXT_015@
873  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
874 --- a/src/addr2line.c
875 +++ b/src/addr2line.c
876 @@ -455,10 +455,10 @@ handle_address (const char *string, Dwfl
877        bool parsed = false;
878        int i, j;
879        char *name = NULL;
880 -      if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
881 +      if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
882           && string[i] == '\0')
883         parsed = adjust_to_section (name, &addr, dwfl);
884 -      switch (sscanf (string, "%m[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
885 +      switch (sscanf (string, "%a[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
886         {
887         default:
888           break;
889 --- a/src/ChangeLog
890 +++ b/src/ChangeLog
891 @@ -260,8 +260,16 @@
892         * readelf.c (attr_callback): Use print_block only when we don't use
893         print_ops.
894  
895 +2009-08-17  Roland McGrath  <roland@redhat.com>
896 +
897 +       * ld.h: Disable extern inlines for GCC 4.2.
898 +
899  2009-08-14  Roland McGrath  <roland@redhat.com>
900  
901 +       * strings.c (read_block): Conditionalize posix_fadvise use
902 +       on [POSIX_FADV_SEQUENTIAL].
903 +       From Petr Salinger <Petr.Salinger@seznam.cz>.
904 +
905         * ar.c (do_oper_extract): Use pathconf instead of statfs.
906  
907  2009-08-01  Ulrich Drepper  <drepper@redhat.com>
908 @@ -425,6 +433,8 @@
909         * readelf.c (print_debug_frame_section): Use t instead of j formats
910         for ptrdiff_t OFFSET.
911  
912 +       * addr2line.c (handle_address): Use %a instead of %m for compatibility.
913 +
914  2009-01-21  Ulrich Drepper  <drepper@redhat.com>
915  
916         * elflint.c (check_program_header): Fix typo in .eh_frame_hdr section
917 @@ -608,6 +618,11 @@
918         that matches its PT_LOAD's p_flags &~ PF_W.  On sparc, PF_X really
919         is valid in RELRO.
920  
921 +2008-03-01  Roland McGrath  <roland@redhat.com>
922 +
923 +       * readelf.c (dump_archive_index): Tweak portability hack
924 +       to match [__GNUC__ < 4] too.
925 +
926  2008-02-29  Roland McGrath  <roland@redhat.com>
927  
928         * readelf.c (print_attributes): Add a cast.
929 @@ -859,6 +874,8 @@
930  
931         * readelf.c (hex_dump): Fix rounding error in whitespace calculation.
932  
933 +       * Makefile.am (readelf_no_Werror): New variable.
934 +
935  2007-10-15  Roland McGrath  <roland@redhat.com>
936  
937         * make-debug-archive.in: New file.
938 @@ -1298,6 +1315,10 @@
939         * elflint.c (valid_e_machine): Add EM_ALPHA.
940         Reported by Christian Aichinger <Greek0@gmx.net>.
941  
942 +       * strings.c (map_file): Define POSIX_MADV_SEQUENTIAL to
943 +       MADV_SEQUENTIAL if undefined.   Don't call posix_madvise
944 +       if neither is defined.
945 +
946  2006-08-08  Ulrich Drepper  <drepper@redhat.com>
947  
948         * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
949 @@ -1374,6 +1395,10 @@
950         * Makefile.am: Add hacks to create dependency files for non-generic
951         linker.
952  
953 +2006-04-05  Roland McGrath  <roland@redhat.com>
954 +
955 +       * strings.c (MAP_POPULATE): Define to 0 if undefined.
956 +
957  2006-06-12  Ulrich Drepper  <drepper@redhat.com>
958  
959         * ldgeneric.c (ld_generic_generate_sections): Don't create .interp
960 @@ -1722,6 +1747,11 @@
961         * readelf.c (print_debug_loc_section): Fix indentation for larger
962         address size.
963  
964 +2005-05-31  Roland McGrath  <roland@redhat.com>
965 +
966 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
967 +       (AM_CFLAGS): Use it in place of -Wextra.
968 +
969  2005-05-30  Roland McGrath  <roland@redhat.com>
970  
971         * readelf.c (print_debug_line_section): Print section offset of each
972 --- a/src/findtextrel.c
973 +++ b/src/findtextrel.c
974 @@ -504,7 +504,11 @@ ptrcompare (const void *p1, const void *
975  
976  
977  static void
978 -check_rel (size_t nsegments, struct segments segments[nsegments],
979 +check_rel (size_t nsegments, struct segments segments[
980 +#if __GNUC__ >= 4
981 +                                                     nsegments
982 +#endif
983 +          ],
984            GElf_Addr addr, Elf *elf, Elf_Scn *symscn, Dwarf *dw,
985            const char *fname, bool more_than_one, void **knownsrcs)
986  {
987 --- a/src/ld.h
988 +++ b/src/ld.h
989 @@ -1122,6 +1122,7 @@ extern bool dynamically_linked_p (void);
990  
991  /* Checked whether the symbol is undefined and referenced from a DSO.  */
992  extern bool linked_from_dso_p (struct scninfo *scninfo, size_t symidx);
993 +#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
994  #ifdef __GNUC_STDC_INLINE__
995  __attribute__ ((__gnu_inline__))
996  #endif
997 @@ -1139,5 +1140,6 @@ linked_from_dso_p (struct scninfo *scnin
998  
999    return sym->defined && sym->in_dso;
1000  }
1001 +#endif /* Optimizing and not GCC 4.2.  */
1002  
1003  #endif /* ld.h */
1004 --- a/src/Makefile.am
1005 +++ b/src/Makefile.am
1006 @@ -99,6 +99,9 @@ addr2line_no_Wformat = yes
1007  # XXX While the file is not finished, don't warn about this
1008  ldgeneric_no_Wunused = yes
1009  
1010 +# Buggy old compilers.
1011 +readelf_no_Werror = yes
1012 +
1013  readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
1014  nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
1015  size_LDADD = $(libelf) $(libeu) $(libmudflap)
1016 --- a/src/Makefile.in
1017 +++ b/src/Makefile.in
1018 @@ -228,6 +228,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
1019  INSTALL_SCRIPT = @INSTALL_SCRIPT@
1020  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1021  LDFLAGS = @LDFLAGS@
1022 +LD_AS_NEEDED = @LD_AS_NEEDED@
1023  LEX = @LEX@
1024  LEXLIB = @LEXLIB@
1025  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1026 @@ -257,6 +258,7 @@ SHELL = @SHELL@
1027  STRIP = @STRIP@
1028  USE_NLS = @USE_NLS@
1029  VERSION = @VERSION@
1030 +WEXTRA = @WEXTRA@
1031  XGETTEXT = @XGETTEXT@
1032  XGETTEXT_015 = @XGETTEXT_015@
1033  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1034 @@ -321,7 +323,7 @@ INCLUDES = -I. -I$(srcdir) -I$(top_srcdi
1035         -I$(srcdir)/../libasm
1036  AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1037         $($(*F)_no_Werror),,-Werror) $(if \
1038 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
1039 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1040         $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
1041         $(am__append_1)
1042  @MUDFLAP_FALSE@libmudflap = 
1043 @@ -368,6 +370,9 @@ strings_no_Wformat = yes
1044  addr2line_no_Wformat = yes
1045  # XXX While the file is not finished, don't warn about this
1046  ldgeneric_no_Wunused = yes
1047 +
1048 +# Buggy old compilers.
1049 +readelf_no_Werror = yes
1050  readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
1051  nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
1052  size_LDADD = $(libelf) $(libeu) $(libmudflap)
1053 --- a/src/readelf.c
1054 +++ b/src/readelf.c
1055 @@ -4274,10 +4274,11 @@ struct listptr
1056  #define listptr_offset_size(p) ((p)->dwarf64 ? 8 : 4)
1057  #define listptr_address_size(p)        ((p)->addr64 ? 8 : 4)
1058  
1059 +static const char *listptr_name;
1060  static int
1061 -compare_listptr (const void *a, const void *b, void *arg)
1062 +compare_listptr (const void *a, const void *b)
1063  {
1064 -  const char *name = arg;
1065 +  const char *const name = listptr_name;
1066    struct listptr *p1 = (void *) a;
1067    struct listptr *p2 = (void *) b;
1068  
1069 @@ -4357,8 +4358,11 @@ static void
1070  sort_listptr (struct listptr_table *table, const char *name)
1071  {
1072    if (table->n > 0)
1073 -    qsort_r (table->table, table->n, sizeof table->table[0],
1074 -            &compare_listptr, (void *) name);
1075 +    {
1076 +      listptr_name = name;
1077 +      qsort (table->table, table->n, sizeof table->table[0],
1078 +            &compare_listptr);
1079 +    }
1080  }
1081  
1082  static bool
1083 @@ -8098,7 +8102,7 @@ dump_archive_index (Elf *elf, const char
1084           if (unlikely (elf_rand (elf, as_off) == 0)
1085               || unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf))
1086                            == NULL))
1087 -#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7)
1088 +#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7) || __GNUC__ < 4
1089             while (1)
1090  #endif
1091               error (EXIT_FAILURE, 0,
1092 --- a/src/strings.c
1093 +++ b/src/strings.c
1094 @@ -51,6 +51,10 @@
1095  
1096  #include <system.h>
1097  
1098 +#ifndef MAP_POPULATE
1099 +# define MAP_POPULATE 0
1100 +#endif
1101 +
1102  
1103  /* Prototypes of local functions.  */
1104  static int read_fd (int fd, const char *fname, off64_t fdlen);
1105 @@ -491,8 +495,13 @@ map_file (int fd, off64_t start_off, off
1106                     fd, start_off);
1107        if (mem != MAP_FAILED)
1108         {
1109 +#if !defined POSIX_MADV_SEQUENTIAL && defined MADV_SEQUENTIAL
1110 +# define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
1111 +#endif
1112 +#ifdef POSIX_MADV_SEQUENTIAL
1113           /* We will go through the mapping sequentially.  */
1114           (void) posix_madvise (mem, map_size, POSIX_MADV_SEQUENTIAL);
1115 +#endif
1116           break;
1117         }
1118        if (errno != EINVAL && errno != ENOMEM)
1119 @@ -584,9 +593,11 @@ read_block (int fd, const char *fname, o
1120        elfmap_off = from & ~(ps - 1);
1121        elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size);
1122  
1123 +#ifdef POSIX_FADV_SEQUENTIAL
1124        if (unlikely (elfmap == MAP_FAILED))
1125         /* Let the kernel know we are going to read everything in sequence.  */
1126         (void) posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
1127 +#endif
1128      }
1129  
1130    if (unlikely (elfmap == MAP_FAILED))
1131 --- a/src/strip.c
1132 +++ b/src/strip.c
1133 @@ -53,6 +53,12 @@
1134  #include <libebl.h>
1135  #include <system.h>
1136  
1137 +#ifdef HAVE_FUTIMES
1138 +# define FUTIMES(fd, fname, tvp) futimes (fd, tvp)
1139 +#else
1140 +# define FUTIMES(fd, fname, tvp) utimes (fname, tvp)
1141 +#endif
1142 +
1143  
1144  /* Name and version of program.  */
1145  static void print_version (FILE *stream, struct argp_state *state);
1146 @@ -311,8 +317,18 @@ process_file (const char *fname)
1147  
1148        /* If we have to preserve the timestamp, we need it in the
1149          format utimes() understands.  */
1150 +#ifdef HAVE_STRUCT_STAT_ST_ATIM
1151        TIMESPEC_TO_TIMEVAL (&tv[0], &pre_st.st_atim);
1152 +#else
1153 +      tv[0].tv_sec = pre_st.st_atime;
1154 +      tv[0].tv_usec = 0;
1155 +#endif
1156 +#ifdef HAVE_STRUCT_STAT_ST_MTIM
1157        TIMESPEC_TO_TIMEVAL (&tv[1], &pre_st.st_mtim);
1158 +#else
1159 +      tv[1].tv_sec = pre_st.st_atime;
1160 +      tv[1].tv_usec = 0;
1161 +#endif
1162      }
1163  
1164    /* Open the file.  */
1165 @@ -1809,7 +1825,7 @@ while computing checksum for debug infor
1166    /* If requested, preserve the timestamp.  */
1167    if (tvp != NULL)
1168      {
1169 -      if (futimes (fd, tvp) != 0)
1170 +      if (FUTIMES (fd, output_fname, tvp) != 0)
1171         {
1172           error (0, errno, gettext ("\
1173  cannot set access and modification date of '%s'"),
1174 @@ -1866,7 +1882,7 @@ handle_ar (int fd, Elf *elf, const char
1175  
1176    if (tvp != NULL)
1177      {
1178 -      if (unlikely (futimes (fd, tvp) != 0))
1179 +      if (unlikely (FUTIMES (fd, fname, tvp) != 0))
1180         {
1181           error (0, errno, gettext ("\
1182  cannot set access and modification date of '%s'"), fname);
1183 --- a/tests/ChangeLog
1184 +++ b/tests/ChangeLog
1185 @@ -205,6 +205,8 @@
1186  
1187  2008-01-21  Roland McGrath  <roland@redhat.com>
1188  
1189 +       * line2addr.c (main): Revert last change.
1190 +
1191         * testfile45.S.bz2: Add tests for cltq, cqto.
1192         * testfile45.expect.bz2: Adjust.
1193  
1194 @@ -913,6 +915,11 @@
1195         * Makefile.am (TESTS): Add run-elflint-test.sh.
1196         (EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2.
1197  
1198 +2005-05-31  Roland McGrath  <roland@redhat.com>
1199 +
1200 +       * Makefile.am (WEXTRA): New variable, substituted by configure.
1201 +       (AM_CFLAGS): Use it in place of -Wextra.
1202 +
1203  2005-05-24  Ulrich Drepper  <drepper@redhat.com>
1204  
1205         * get-files.c (main): Use correct format specifier.
1206 --- a/tests/line2addr.c
1207 +++ b/tests/line2addr.c
1208 @@ -132,7 +132,7 @@ main (int argc, char *argv[])
1209      {
1210        struct args a = { .arg = argv[cnt] };
1211  
1212 -      switch (sscanf (a.arg, "%m[^:]:%d", &a.file, &a.line))
1213 +      switch (sscanf (a.arg, "%a[^:]:%d", &a.file, &a.line))
1214         {
1215         default:
1216         case 0:
1217 --- a/tests/Makefile.in
1218 +++ b/tests/Makefile.in
1219 @@ -372,6 +372,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
1220  INSTALL_SCRIPT = @INSTALL_SCRIPT@
1221  INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1222  LDFLAGS = @LDFLAGS@
1223 +LD_AS_NEEDED = @LD_AS_NEEDED@
1224  LEX = @LEX@
1225  LEXLIB = @LEXLIB@
1226  LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1227 @@ -401,6 +402,7 @@ SHELL = @SHELL@
1228  STRIP = @STRIP@
1229  USE_NLS = @USE_NLS@
1230  VERSION = @VERSION@
1231 +WEXTRA = @WEXTRA@
1232  XGETTEXT = @XGETTEXT@
1233  XGETTEXT_015 = @XGETTEXT_015@
1234  XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1235 @@ -462,7 +464,7 @@ zip_LIBS = @zip_LIBS@
1236  INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. $(am__append_2)
1237  AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1238         $($(*F)_no_Werror),,-Werror) $(if \
1239 -       $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
1240 +       $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1241         $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
1242         $(am__append_1)
1243  @MUDFLAP_FALSE@libmudflap =