factor out mmix config into a separate file
[rofl0r-mmix-cross.git] / patches / elfutils-0.152-musl.diff
blob507b6be235db0d6be5860961a2ef734815e0211b
1 diff --git a/ChangeLog b/ChangeLog
2 --- a/ChangeLog
3 +++ b/ChangeLog
4 @@ -13,6 +13,10 @@
6 * configure.ac (LOCALEDIR, DATADIRNAME): Removed.
8 +2009-11-22 Roland McGrath <roland@redhat.com>
10 + * configure.ac: Use sed and expr instead of modern bash extensions.
12 2009-09-21 Ulrich Drepper <drepper@redhat.com>
14 * configure.ac: Update for more modern autoconf.
15 @@ -21,6 +25,10 @@
17 * configure.ac (zip_LIBS): Check for liblzma too.
19 +2009-08-17 Roland McGrath <roland@redhat.com>
21 + * configure.ac: Check for -fgnu89-inline; add it to WEXTRA if it works.
23 2009-04-19 Roland McGrath <roland@redhat.com>
25 * configure.ac (eu_version): Round down here, not in version.h macros.
26 @@ -32,6 +40,8 @@
28 2009-01-23 Roland McGrath <roland@redhat.com>
30 + * configure.ac: Check for __builtin_popcount.
32 * configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3.
34 * configure.ac (__thread check): Use AC_LINK_IFELSE, in case of
35 @@ -112,6 +122,10 @@
36 * configure.ac: Add dummy automake conditional to get dependencies
37 for non-generic linker right. See src/Makefile.am.
39 +2005-11-22 Roland McGrath <roland@redhat.com>
41 + * configure.ac: Check for --as-needed linker option.
43 2005-11-18 Roland McGrath <roland@redhat.com>
45 * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable.
46 @@ -159,6 +173,17 @@
47 * Makefile.am (all_SUBDIRS): Add libdwfl.
48 * configure.ac: Write libdwfl/Makefile.
50 +2005-05-31 Roland McGrath <roland@redhat.com>
52 + * configure.ac (WEXTRA): Check for -Wextra and set this substitution.
54 + * configure.ac: Check for struct stat st_?tim members.
55 + * src/strip.c (process_file): Use st_?time if st_?tim are not there.
57 + * configure.ac: Check for futimes function.
58 + * src/strip.c (handle_elf) [! HAVE_FUTIMES]: Use utimes instead.
59 + (handle_ar) [! HAVE_FUTIMES]: Likewise.
61 2005-05-19 Roland McGrath <roland@redhat.com>
63 * configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros.
64 diff --git a/Makefile.am b/Makefile.am
65 --- a/Makefile.am
66 +++ b/Makefile.am
67 @@ -30,8 +30,9 @@
68 pkginclude_HEADERS = version.h
70 # Add doc back when we have some real content.
71 -SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
72 - src po tests
73 +#SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
74 +# src po tests
75 +SUBDIRS = libelf
77 EXTRA_DIST = elfutils.spec GPG-KEY NOTES EXCEPTION
79 diff --git a/Makefile.in b/Makefile.in
80 --- a/Makefile.in
81 +++ b/Makefile.in
82 @@ -155,6 +155,7 @@
83 INSTALL_SCRIPT = @INSTALL_SCRIPT@
84 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
85 LDFLAGS = @LDFLAGS@
86 +LD_AS_NEEDED = @LD_AS_NEEDED@
87 LEX = @LEX@
88 LEXLIB = @LEXLIB@
89 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
90 @@ -184,6 +185,7 @@
91 STRIP = @STRIP@
92 USE_NLS = @USE_NLS@
93 VERSION = @VERSION@
94 +WEXTRA = @WEXTRA@
95 XGETTEXT = @XGETTEXT@
96 XGETTEXT_015 = @XGETTEXT_015@
97 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
98 @@ -246,8 +248,9 @@
99 pkginclude_HEADERS = version.h
101 # Add doc back when we have some real content.
102 -SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
103 - src po tests
104 +#SUBDIRS = config m4 lib libelf libebl libdwfl libdw libcpu libasm backends \
105 +# src po tests
106 +SUBDIRS = libelf
108 EXTRA_DIST = elfutils.spec GPG-KEY NOTES EXCEPTION
110 diff --git a/backends/ChangeLog b/backends/ChangeLog
111 --- a/backends/ChangeLog
112 +++ b/backends/ChangeLog
113 @@ -111,6 +111,10 @@
114 * ppc_attrs.c (ppc_check_object_attribute): Handle tag
115 GNU_Power_ABI_Struct_Return.
117 +2009-01-23 Roland McGrath <roland@redhat.com>
119 + * Makefile.am (libebl_%.so): Use $(LD_AS_NEEDED).
121 2008-10-04 Ulrich Drepper <drepper@redhat.com>
123 * i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and
124 @@ -438,6 +442,11 @@
125 * sparc_init.c: Likewise.
126 * x86_64_init.c: Likewise.
128 +2005-11-22 Roland McGrath <roland@redhat.com>
130 + * Makefile.am (LD_AS_NEEDED): New variable, substituted by configure.
131 + (libebl_%.so rule): Use it in place of -Wl,--as-needed.
133 2005-11-19 Roland McGrath <roland@redhat.com>
135 * ppc64_reloc.def: REL30 -> ADDR30.
136 @@ -460,6 +469,9 @@
137 * Makefile.am (uninstall): Don't try to remove $(pkgincludedir).
138 (CLEANFILES): Add libebl_$(m).so.
140 + * Makefile.am (WEXTRA): New variable, substituted by configure.
141 + (AM_CFLAGS): Use it in place of -Wextra.
143 * ppc_reloc.def: Update bits per Alan Modra <amodra@bigpond.net.au>.
144 * ppc64_reloc.def: Likewise.
146 diff --git a/backends/Makefile.am b/backends/Makefile.am
147 --- a/backends/Makefile.am
148 +++ b/backends/Makefile.am
149 @@ -103,7 +103,7 @@
150 $(LINK) -shared -o $(@:.map=.so) \
151 -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
152 -Wl,--version-script,$(@:.so=.map) \
153 - -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
154 + -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap)
155 $(textrel_check)
157 libebl_i386.so: $(cpu_i386)
158 diff --git a/backends/Makefile.in b/backends/Makefile.in
159 --- a/backends/Makefile.in
160 +++ b/backends/Makefile.in
161 @@ -165,6 +165,7 @@
162 INSTALL_SCRIPT = @INSTALL_SCRIPT@
163 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
164 LDFLAGS = @LDFLAGS@
165 +LD_AS_NEEDED = @LD_AS_NEEDED@
166 LEX = @LEX@
167 LEXLIB = @LEXLIB@
168 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
169 @@ -194,6 +195,7 @@
170 STRIP = @STRIP@
171 USE_NLS = @USE_NLS@
172 VERSION = @VERSION@
173 +WEXTRA = @WEXTRA@
174 XGETTEXT = @XGETTEXT@
175 XGETTEXT_015 = @XGETTEXT_015@
176 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
177 @@ -256,8 +258,8 @@
178 -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
179 -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
180 AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
181 - $($(*F)_no_Werror),,-Werror) $(if \
182 - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
183 + $($(*F)_no_Werror),,) $(if \
184 + $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
185 $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
186 $(am__append_1)
187 @MUDFLAP_FALSE@libmudflap =
188 @@ -698,7 +700,7 @@
189 $(LINK) -shared -o $(@:.map=.so) \
190 -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
191 -Wl,--version-script,$(@:.so=.map) \
192 - -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
193 + -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw) $(libmudflap)
194 $(textrel_check)
196 libebl_i386.so: $(cpu_i386)
197 diff --git a/config.h.in b/config.h.in
198 --- a/config.h.in
199 +++ b/config.h.in
200 @@ -1,5 +1,8 @@
201 /* config.h.in. Generated from configure.ac by autoheader. */
203 +/* Have __builtin_popcount. */
204 +#undef HAVE_BUILTIN_POPCOUNT
206 /* $libdir subdirectory containing libebl modules. */
207 #undef LIBEBL_SUBDIR
209 @@ -55,4 +58,7 @@
210 /* Define for large files, on AIX-style hosts. */
211 #undef _LARGE_FILES
213 +/* Stubbed out if missing compiler support. */
214 +#undef __thread
216 #include <eu-config.h>
217 diff --git a/config/Makefile.in b/config/Makefile.in
218 --- a/config/Makefile.in
219 +++ b/config/Makefile.in
220 @@ -76,6 +76,7 @@
221 INSTALL_SCRIPT = @INSTALL_SCRIPT@
222 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
223 LDFLAGS = @LDFLAGS@
224 +LD_AS_NEEDED = @LD_AS_NEEDED@
225 LEX = @LEX@
226 LEXLIB = @LEXLIB@
227 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
228 @@ -105,6 +106,7 @@
229 STRIP = @STRIP@
230 USE_NLS = @USE_NLS@
231 VERSION = @VERSION@
232 +WEXTRA = @WEXTRA@
233 XGETTEXT = @XGETTEXT@
234 XGETTEXT_015 = @XGETTEXT_015@
235 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
236 diff --git a/config/eu.am b/config/eu.am
237 --- a/config/eu.am
238 +++ b/config/eu.am
239 @@ -25,11 +25,14 @@
240 ## <http://www.openinventionnetwork.com>.
243 +WEXTRA = @WEXTRA@
244 +LD_AS_NEEDED = @LD_AS_NEEDED@
246 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
247 INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
248 AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
249 $(if $($(*F)_no_Werror),,-Werror) \
250 - $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
251 + $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \
252 $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
253 $($(*F)_CFLAGS)
255 diff --git a/configure b/configure
256 --- a/configure
257 +++ b/configure
258 @@ -602,6 +602,8 @@
259 base_cpu
260 NATIVE_LD_FALSE
261 NATIVE_LD_TRUE
262 +LD_AS_NEEDED
263 +WEXTRA
264 LEXLIB
265 LEX_OUTPUT_ROOT
267 @@ -3856,6 +3858,130 @@
268 as_fn_error $? "gcc with C99 support required" "$LINENO" 5
271 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wextra option to $CC" >&5
272 +$as_echo_n "checking for -Wextra option to $CC... " >&6; }
273 +if test "${ac_cv_cc_wextra+set}" = set; then :
274 + $as_echo_n "(cached) " >&6
275 +else
276 + old_CFLAGS="$CFLAGS"
277 +CFLAGS="$CFLAGS -Wextra"
278 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
279 +/* end confdefs.h. */
280 +void foo (void) { }
281 +_ACEOF
282 +if ac_fn_c_try_compile "$LINENO"; then :
283 + ac_cv_cc_wextra=yes
284 +else
285 + ac_cv_cc_wextra=no
287 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
288 +CFLAGS="$old_CFLAGS"
290 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_wextra" >&5
291 +$as_echo "$ac_cv_cc_wextra" >&6; }
293 +if test "x$ac_cv_cc_wextra" = xyes; then :
294 + WEXTRA=-Wextra
295 +else
296 + WEXTRA=-W
299 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fgnu89-inline option to $CC" >&5
300 +$as_echo_n "checking for -fgnu89-inline option to $CC... " >&6; }
301 +if test "${ac_cv_cc_gnu89_inline+set}" = set; then :
302 + $as_echo_n "(cached) " >&6
303 +else
304 + old_CFLAGS="$CFLAGS"
305 +CFLAGS="$CFLAGS -fgnu89-inline -Werror"
306 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
307 +/* end confdefs.h. */
309 +void foo (void)
311 + inline void bar (void) {}
312 + bar ();
314 +extern inline void baz (void) {}
316 +_ACEOF
317 +if ac_fn_c_try_compile "$LINENO"; then :
318 + ac_cv_cc_gnu89_inline=yes
319 +else
320 + ac_cv_cc_gnu89_inline=no
322 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
323 +CFLAGS="$old_CFLAGS"
325 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cc_gnu89_inline" >&5
326 +$as_echo "$ac_cv_cc_gnu89_inline" >&6; }
327 +if test "x$ac_cv_cc_gnu89_inline" = xyes; then :
328 + WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"
331 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --as-needed linker option" >&5
332 +$as_echo_n "checking for --as-needed linker option... " >&6; }
333 +if test "${ac_cv_as_needed+set}" = set; then :
334 + $as_echo_n "(cached) " >&6
335 +else
336 + cat > conftest.c <<EOF
337 +int main (void) { return 0; }
338 +EOF
339 +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
340 + -fPIC -shared -o conftest.so conftest.c
341 + -Wl,--as-needed 1>&5'
342 + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
343 + (eval $ac_try) 2>&5
344 + ac_status=$?
345 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
346 + test $ac_status = 0; }; }
347 +then
348 + ac_cv_as_needed=yes
349 +else
350 + ac_cv_as_needed=no
352 +rm -f conftest*
354 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_as_needed" >&5
355 +$as_echo "$ac_cv_as_needed" >&6; }
356 +if test "x$ac_cv_as_needed" = xyes; then :
357 + LD_AS_NEEDED=-Wl,--as-needed
358 +else
359 + LD_AS_NEEDED=
363 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_popcount" >&5
364 +$as_echo_n "checking for __builtin_popcount... " >&6; }
365 +if test "${ac_cv_popcount+set}" = set; then :
366 + $as_echo_n "(cached) " >&6
367 +else
368 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
369 +/* end confdefs.h. */
371 +int
372 +main ()
374 +exit (__builtin_popcount (127));
376 + return 0;
378 +_ACEOF
379 +if ac_fn_c_try_link "$LINENO"; then :
380 + ac_cv_popcount=yes
381 +else
382 + ac_cv_popcount=no
384 +rm -f core conftest.err conftest.$ac_objext \
385 + conftest$ac_exeext conftest.$ac_ext
387 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_popcount" >&5
388 +$as_echo "$ac_cv_popcount" >&6; }
389 +if test "x$ac_cv_popcount" = xyes; then :
391 +$as_echo "#define HAVE_BUILTIN_POPCOUNT 1" >>confdefs.h
395 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __thread support" >&5
396 $as_echo_n "checking for __thread support... " >&6; }
397 if test "${ac_cv_tls+set}" = set; then :
398 @@ -3892,7 +4018,13 @@
399 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5
400 $as_echo "$ac_cv_tls" >&6; }
401 if test "x$ac_cv_tls" != xyes; then :
402 - as_fn_error $? "__thread support required" "$LINENO" 5
403 + if test "$use_locks" = yes; then :
404 + as_fn_error $? "--enable-thread-safety requires __thread support" "$LINENO" 5
405 +else
407 +$as_echo "#define __thread /* empty: no multi-thread support */" >>confdefs.h
412 # Check whether --enable-largefile was given.
413 @@ -4878,7 +5010,7 @@
415 # 1.234<whatever> -> 1234<whatever>
416 case "$PACKAGE_VERSION" in
417 -[0-9].*) eu_version="${PACKAGE_VERSION/./}" ;;
418 +[0-9].*) eu_version=`echo "$PACKAGE_VERSION" | sed 's@\.@@'` ;;
419 *) as_fn_error $? "confused by version number '$PACKAGE_VERSION'" "$LINENO" 5 ;;
420 esac
421 case "$eu_version" in
422 @@ -4907,7 +5039,7 @@
423 esac
425 # Round up to the next release API (x.y) version.
426 -eu_version=$[($eu_version + 999) / 1000]
427 +eu_version=`expr \( $eu_version + 999 \) / 1000`
429 cat >confcache <<\_ACEOF
430 # This file is a shell script that caches the results of configure
431 diff --git a/configure.ac b/configure.ac
432 --- a/configure.ac
433 +++ b/configure.ac
434 @@ -70,6 +70,54 @@
435 AS_IF([test "x$ac_cv_c99" != xyes],
436 AC_MSG_ERROR([gcc with C99 support required]))
438 +AC_CACHE_CHECK([for -Wextra option to $CC], ac_cv_cc_wextra, [dnl
439 +old_CFLAGS="$CFLAGS"
440 +CFLAGS="$CFLAGS -Wextra"
441 +AC_COMPILE_IFELSE([void foo (void) { }],
442 + ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no)
443 +CFLAGS="$old_CFLAGS"])
444 +AC_SUBST(WEXTRA)
445 +AS_IF([test "x$ac_cv_cc_wextra" = xyes], [WEXTRA=-Wextra], [WEXTRA=-W])
447 +AC_CACHE_CHECK([for -fgnu89-inline option to $CC], ac_cv_cc_gnu89_inline, [dnl
448 +old_CFLAGS="$CFLAGS"
449 +CFLAGS="$CFLAGS -fgnu89-inline -Werror"
450 +AC_COMPILE_IFELSE([
451 +void foo (void)
453 + inline void bar (void) {}
454 + bar ();
456 +extern inline void baz (void) {}
457 +], ac_cv_cc_gnu89_inline=yes, ac_cv_cc_gnu89_inline=no)
458 +CFLAGS="$old_CFLAGS"])
459 +AS_IF([test "x$ac_cv_cc_gnu89_inline" = xyes],
460 + [WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"])
462 +AC_CACHE_CHECK([for --as-needed linker option],
463 + ac_cv_as_needed, [dnl
464 +cat > conftest.c <<EOF
465 +int main (void) { return 0; }
466 +EOF
467 +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
468 + -fPIC -shared -o conftest.so conftest.c
469 + -Wl,--as-needed 1>&AS_MESSAGE_LOG_FD])
470 +then
471 + ac_cv_as_needed=yes
472 +else
473 + ac_cv_as_needed=no
475 +rm -f conftest*])
476 +AS_IF([test "x$ac_cv_as_needed" = xyes],
477 + [LD_AS_NEEDED=-Wl,--as-needed], [LD_AS_NEEDED=])
478 +AC_SUBST(LD_AS_NEEDED)
480 +AC_CACHE_CHECK([for __builtin_popcount], ac_cv_popcount, [dnl
481 +AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[exit (__builtin_popcount (127));]])],
482 + ac_cv_popcount=yes, ac_cv_popcount=no)])
483 +AS_IF([test "x$ac_cv_popcount" = xyes],
484 + [AC_DEFINE([HAVE_BUILTIN_POPCOUNT], [1], [Have __builtin_popcount.])])
486 AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
487 # Use the same flags that we use for our DSOs, so the test is representative.
488 # Some old compiler/linker/libc combinations fail some ways and not others.
489 @@ -85,7 +133,10 @@
490 CFLAGS="$save_CFLAGS"
491 LDFLAGS="$save_LDFLAGS"])
492 AS_IF([test "x$ac_cv_tls" != xyes],
493 - AC_MSG_ERROR([__thread support required]))
494 + [AS_IF([test "$use_locks" = yes],
495 + [AC_MSG_ERROR([--enable-thread-safety requires __thread support])],
496 + [AC_DEFINE([__thread], [/* empty: no multi-thread support */],
497 + [Stubbed out if missing compiler support.])])])
499 dnl This test must come as early as possible after the compiler configuration
500 dnl tests, because the choice of the file model can (in principle) affect
501 @@ -248,7 +299,7 @@
503 # 1.234<whatever> -> 1234<whatever>
504 case "$PACKAGE_VERSION" in
505 -[[0-9]].*) eu_version="${PACKAGE_VERSION/./}" ;;
506 +[[0-9]].*) eu_version=`echo "$PACKAGE_VERSION" | sed 's@\.@@'` ;;
507 *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
508 esac
509 case "$eu_version" in
510 @@ -277,6 +328,6 @@
511 esac
513 # Round up to the next release API (x.y) version.
514 -[eu_version=$[($eu_version + 999) / 1000]]
515 +eu_version=`expr \( $eu_version + 999 \) / 1000`
517 AC_OUTPUT
518 diff --git a/lib/ChangeLog b/lib/ChangeLog
519 --- a/lib/ChangeLog
520 +++ b/lib/ChangeLog
521 @@ -14,6 +14,9 @@
523 2009-01-23 Roland McGrath <roland@redhat.com>
525 + * eu-config.h [! HAVE_BUILTIN_POPCOUNT]
526 + (__builtin_popcount): New inline function.
528 * eu-config.h: Add multiple inclusion protection.
530 2009-01-17 Ulrich Drepper <drepper@redhat.com>
531 @@ -70,6 +73,11 @@
532 * Makefile.am (libeu_a_SOURCES): Add it.
533 * system.h: Declare crc32_file.
535 +2005-02-07 Roland McGrath <roland@redhat.com>
537 + * Makefile.am (WEXTRA): New variable, substituted by configure.
538 + (AM_CFLAGS): Use it in place of -Wextra.
540 2005-04-30 Ulrich Drepper <drepper@redhat.com>
542 * Makefile.am: Use -ffunction-sections for xmalloc.c.
543 diff --git a/lib/Makefile.in b/lib/Makefile.in
544 --- a/lib/Makefile.in
545 +++ b/lib/Makefile.in
546 @@ -99,6 +99,7 @@
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 @@ -128,6 +129,7 @@
555 STRIP = @STRIP@
556 USE_NLS = @USE_NLS@
557 VERSION = @VERSION@
558 +WEXTRA = @WEXTRA@
559 XGETTEXT = @XGETTEXT@
560 XGETTEXT_015 = @XGETTEXT_015@
561 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
562 @@ -189,8 +191,8 @@
563 INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
564 -I$(srcdir)/../libelf
565 AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
566 - $($(*F)_no_Werror),,-Werror) $(if \
567 - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
568 + $($(*F)_no_Werror),,) $(if \
569 + $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
570 $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
571 $(am__append_1) -fpic
572 @MUDFLAP_FALSE@libmudflap =
573 diff --git a/lib/eu-config.h b/lib/eu-config.h
574 --- a/lib/eu-config.h
575 +++ b/lib/eu-config.h
576 @@ -182,6 +182,17 @@
577 /* This macro is used by the tests conditionalize for standalone building. */
578 #define ELFUTILS_HEADER(name) <lib##name.h>
580 +#ifndef HAVE_BUILTIN_POPCOUNT
581 +# define __builtin_popcount hakmem_popcount
582 +static inline unsigned int __attribute__ ((unused))
583 +hakmem_popcount (unsigned int x)
585 + /* HAKMEM 169 */
586 + unsigned int n = x - ((x >> 1) & 033333333333) - ((x >> 2) & 011111111111);
587 + return ((n + (n >> 3)) & 030707070707) % 63;
589 +#endif /* HAVE_BUILTIN_POPCOUNT */
592 #ifdef SHARED
593 # define OLD_VERSION(name, version) \
594 diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
595 --- a/lib/fixedsizehash.h
596 +++ b/lib/fixedsizehash.h
597 @@ -51,12 +51,12 @@
598 #include <errno.h>
599 #include <stdlib.h>
600 #include <string.h>
601 -#include <sys/cdefs.h>
602 #include <sys/param.h>
604 #include <system.h>
606 -#define CONCAT(t1,t2) __CONCAT (t1,t2)
607 +#define CONCAT1(x,y) x##y
608 +#define CONCAT(x,y) CONCAT1(x,y)
610 /* Before including this file the following macros must be defined:
612 diff --git a/lib/system.h b/lib/system.h
613 --- a/lib/system.h
614 +++ b/lib/system.h
615 @@ -46,6 +46,11 @@
616 Network licensing program, please visit www.openinventionnetwork.com
617 <http://www.openinventionnetwork.com>. */
619 +#ifndef TEMP_FAILURE_RETRY
620 +#define TEMP_FAILURE_RETRY(x) x
621 +#define rawmemchr(s,c) memchr((s),(size_t)-1,(c))
622 +#endif
624 #ifndef LIB_SYSTEM_H
625 #define LIB_SYSTEM_H 1
627 diff --git a/lib/xmalloc.c b/lib/xmalloc.c
628 --- a/lib/xmalloc.c
629 +++ b/lib/xmalloc.c
630 @@ -27,7 +27,7 @@
631 # include <config.h>
632 #endif
634 -#include <error.h>
635 +#include <err.h>
636 #include <libintl.h>
637 #include <stddef.h>
638 #include <stdlib.h>
639 @@ -48,7 +48,7 @@
641 p = malloc (n);
642 if (p == NULL)
643 - error (EXIT_FAILURE, 0, _("memory exhausted"));
644 + err (EXIT_FAILURE, _("memory exhausted"));
645 return p;
648 @@ -62,7 +62,7 @@
650 p = calloc (n, s);
651 if (p == NULL)
652 - error (EXIT_FAILURE, 0, _("memory exhausted"));
653 + err (EXIT_FAILURE, _("memory exhausted"));
654 return p;
657 @@ -76,6 +76,6 @@
659 p = realloc (p, n);
660 if (p == NULL)
661 - error (EXIT_FAILURE, 0, _("memory exhausted"));
662 + err (EXIT_FAILURE, _("memory exhausted"));
663 return p;
665 diff --git a/libasm/ChangeLog b/libasm/ChangeLog
666 --- a/libasm/ChangeLog
667 +++ b/libasm/ChangeLog
668 @@ -71,6 +71,11 @@
669 * asm_error.c: Add new error ASM_E_IOERROR.
670 * libasmP.h: Add ASM_E_IOERROR definition.
672 +2005-05-31 Roland McGrath <roland@redhat.com>
674 + * Makefile.am (WEXTRA): New variable, substituted by configure.
675 + (AM_CFLAGS): Use it in place of -Wextra.
677 2005-02-15 Ulrich Drepper <drepper@redhat.com>
679 * Makefile.am (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
680 diff --git a/libasm/Makefile.in b/libasm/Makefile.in
681 --- a/libasm/Makefile.in
682 +++ b/libasm/Makefile.in
683 @@ -147,6 +147,7 @@
684 INSTALL_SCRIPT = @INSTALL_SCRIPT@
685 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
686 LDFLAGS = @LDFLAGS@
687 +LD_AS_NEEDED = @LD_AS_NEEDED@
688 LEX = @LEX@
689 LEXLIB = @LEXLIB@
690 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
691 @@ -176,6 +177,7 @@
692 STRIP = @STRIP@
693 USE_NLS = @USE_NLS@
694 VERSION = 1
695 +WEXTRA = @WEXTRA@
696 XGETTEXT = @XGETTEXT@
697 XGETTEXT_015 = @XGETTEXT_015@
698 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
699 @@ -238,8 +240,8 @@
700 -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \
701 -I$(top_srcdir)/libdw
702 AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
703 - $($(*F)_no_Werror),,-Werror) $(if \
704 - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
705 + $($(*F)_no_Werror),,) $(if \
706 + $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
707 $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
708 $(am__append_1)
709 @MUDFLAP_FALSE@libmudflap =
710 diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog
711 --- a/libcpu/ChangeLog
712 +++ b/libcpu/ChangeLog
713 @@ -15,6 +15,9 @@
715 2009-01-23 Roland McGrath <roland@redhat.com>
717 + * i386_disasm.c (i386_disasm): Add abort after assert-constant for old
718 + compilers that don't realize it's noreturn.
720 * Makefile.am (i386_parse_CFLAGS): Use quotes around command
721 substitution that can produce leading whitespace.
723 @@ -344,6 +347,11 @@
724 * defs/i386.doc: New file.
725 * defs/x86_64: New file.
727 +2005-04-04 Roland McGrath <roland@redhat.com>
729 + * Makefile.am (WEXTRA): New variable, substituted by configure.
730 + (AM_CFLAGS): Use it instead of -Wextra.
732 2005-02-15 Ulrich Drepper <drepper@redhat.com>
734 * Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
735 diff --git a/libcpu/Makefile.in b/libcpu/Makefile.in
736 --- a/libcpu/Makefile.in
737 +++ b/libcpu/Makefile.in
738 @@ -116,6 +116,7 @@
739 INSTALL_SCRIPT = @INSTALL_SCRIPT@
740 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
741 LDFLAGS = @LDFLAGS@
742 +LD_AS_NEEDED = @LD_AS_NEEDED@
743 LEX = @LEX@
744 LEXLIB = @LEXLIB@
745 LEX_OUTPUT_ROOT = lex.$(<F:lex.l=)
746 @@ -145,6 +146,7 @@
747 STRIP = @STRIP@
748 USE_NLS = @USE_NLS@
749 VERSION = @VERSION@
750 +WEXTRA = @WEXTRA@
751 XGETTEXT = @XGETTEXT@
752 XGETTEXT_015 = @XGETTEXT_015@
753 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
754 @@ -207,8 +209,8 @@
755 -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
756 -I$(srcdir)/../libdw -I$(srcdir)/../libasm
757 AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
758 - $($(*F)_no_Werror),,-Werror) $(if \
759 - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
760 + $($(*F)_no_Werror),,) $(if \
761 + $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
762 $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
763 $(am__append_1) -fpic -fdollars-in-identifiers
764 @MUDFLAP_FALSE@libmudflap =
765 diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
766 --- a/libcpu/i386_disasm.c
767 +++ b/libcpu/i386_disasm.c
768 @@ -791,6 +791,7 @@
770 default:
771 assert (! "INVALID not handled");
772 + abort ();
775 else
776 diff --git a/libcpu/i386_gendis.c b/libcpu/i386_gendis.c
777 --- a/libcpu/i386_gendis.c
778 +++ b/libcpu/i386_gendis.c
779 @@ -28,7 +28,7 @@
780 # include <config.h>
781 #endif
783 -#include <error.h>
784 +#include <err.h>
785 #include <errno.h>
786 #include <stdio.h>
787 #include <stdlib.h>
788 @@ -48,9 +48,12 @@
789 main (int argc, char *argv[argc])
791 outfile = stdout;
792 + int count = 0;
794 - if (argc == 1)
795 - error (EXIT_FAILURE, 0, "usage: %s <MNEDEFFILE>", argv[0]);
796 + if (argc == 1) {
797 + err (EXIT_FAILURE, "usage: %s <MNEDEFFILE>", argv[0]);
798 + count++;
801 //i386_debug = 1;
802 infname = argv[1];
803 @@ -59,11 +62,13 @@
804 else
806 i386_in = fopen (infname, "r");
807 - if (i386_in == NULL)
808 - error (EXIT_FAILURE, errno, "cannot open %s", argv[1]);
809 + if (i386_in == NULL) {
810 + err (EXIT_FAILURE, "cannot open %s", argv[1]);
811 + count++;
815 i386_parse ();
817 - return error_message_count != 0;
818 + return count != 0;
820 diff --git a/libcpu/i386_lex.c b/libcpu/i386_lex.c
821 --- a/libcpu/i386_lex.c
822 +++ b/libcpu/i386_lex.c
823 @@ -567,7 +567,7 @@
824 #endif
826 #include <ctype.h>
827 -#include <error.h>
828 +#include <err.h>
829 #include <libintl.h>
831 #include <system.h>
832 @@ -1999,7 +1999,7 @@
833 static void
834 invalid_char (int ch)
836 - error (0, 0, (isascii (ch)
837 + err (0, (isascii (ch)
838 ? gettext ("invalid character '%c' at line %d; ignored")
839 : gettext ("invalid character '\\%o' at line %d; ignored")),
840 ch, i386_lineno);
841 diff --git a/libcpu/i386_lex.l b/libcpu/i386_lex.l
842 --- a/libcpu/i386_lex.l
843 +++ b/libcpu/i386_lex.l
844 @@ -28,7 +28,7 @@
845 #endif
847 #include <ctype.h>
848 -#include <error.h>
849 +#include <err.h>
850 #include <libintl.h>
852 #include <system.h>
853 @@ -115,7 +115,7 @@
854 static void
855 invalid_char (int ch)
857 - error (0, 0, (isascii (ch)
858 + err (0, (isascii (ch)
859 ? gettext ("invalid character '%c' at line %d; ignored")
860 : gettext ("invalid character '\\%o' at line %d; ignored")),
861 ch, yylineno);
862 diff --git a/libcpu/i386_parse.c b/libcpu/i386_parse.c
863 --- a/libcpu/i386_parse.c
864 +++ b/libcpu/i386_parse.c
865 @@ -109,7 +109,7 @@
866 #include <assert.h>
867 #include <ctype.h>
868 #include <errno.h>
869 -#include <error.h>
870 +#include <err.h>
871 #include <inttypes.h>
872 #include <libintl.h>
873 #include <math.h>
874 @@ -1607,9 +1607,6 @@
875 /* Line 1464 of yacc.c */
876 #line 245 "i386_parse.y"
878 - if (error_message_count != 0)
879 - error (EXIT_FAILURE, 0,
880 - "terminated due to previous error");
882 instrtable_out ();
884 @@ -1645,11 +1642,11 @@
885 newp->from = (yyvsp[(2) - (3)].str);
886 newp->to = (yyvsp[(3) - (3)].str);
887 if (tfind (newp, &synonyms, compare_syn) != NULL)
888 - error (0, 0,
889 + err (0,
890 "%d: duplicate definition for synonym '%s'",
891 i386_lineno, (yyvsp[(2) - (3)].str));
892 else if (tsearch ( newp, &synonyms, compare_syn) == NULL)
893 - error (EXIT_FAILURE, 0, "tsearch");
894 + err (EXIT_FAILURE, "tsearch");
896 break;
898 @@ -1661,7 +1658,7 @@
899 if ((yyvsp[(3) - (6)].field) != NULL && strcmp ((yyvsp[(3) - (6)].field)->name, "RE") != 0
900 && strcmp ((yyvsp[(3) - (6)].field)->name, "R") != 0)
902 - error (0, 0, "%d: only 'R' and 'RE' prefix allowed",
903 + err (0, "%d: only 'R' and 'RE' prefix allowed",
904 i386_lineno - 1);
906 if (check_duplicates ((yyvsp[(1) - (6)].bit)) == 0
907 @@ -1686,7 +1683,7 @@
909 if (tsearch ((yyvsp[(4) - (6)].str), &mnemonics,
910 (comparison_fn_t) strcmp) == NULL)
911 - error (EXIT_FAILURE, errno, "tsearch");
912 + err (EXIT_FAILURE, "tsearch");
913 ++nmnemonics;
916 @@ -1707,7 +1704,7 @@
917 else if (strcmp ((yyvsp[(5) - (6)].field)->name, "D") == 0)
918 newp->suffix = suffix_D;
919 else
920 - error (EXIT_FAILURE, 0,
921 + err (EXIT_FAILURE,
922 "%s: %d: unknown suffix '%s'",
923 infname, i386_lineno - 1, (yyvsp[(5) - (6)].field)->name);
925 @@ -1720,7 +1717,7 @@
926 ns->idx = ++nsuffixes;
927 if (tsearch (ns, &suffixes, compare_suf)
928 == NULL)
929 - error (EXIT_FAILURE, errno, "tsearch");
930 + err (EXIT_FAILURE, "tsearch");
934 @@ -1752,7 +1749,7 @@
935 res = tfind (&search, &bitfields, bitfield_compare);
936 if (res == NULL)
938 - error (0, 0, "%d: unknown bitfield '%s'",
939 + err (0, "%d: unknown bitfield '%s'",
940 i386_lineno, search.name);
941 (yyval.field) = NULL;
943 @@ -1849,7 +1846,7 @@
944 res = tfind (&search, &bitfields, bitfield_compare);
945 if (res == NULL)
947 - error (0, 0, "%d: unknown bitfield '%s'",
948 + err (0, "%d: unknown bitfield '%s'",
949 i386_lineno, search.name);
950 (yyval.bit)->type = failure;
952 @@ -1949,7 +1946,7 @@
953 (yyval.name)->field = &bx_reg;
954 else
956 - error (0, 0, "%d: unknown bitfield '%s'",
957 + err (0, "%d: unknown bitfield '%s'",
958 i386_lineno, search.name);
959 (yyval.name)->field = NULL;
961 @@ -2220,7 +2217,7 @@
962 static void
963 yyerror (const char *s)
965 - error (0, 0, gettext ("while reading i386 CPU description: %s at line %d"),
966 + err (0, gettext ("while reading i386 CPU description: %s at line %d"),
967 gettext (s), i386_lineno);
970 @@ -2245,14 +2242,14 @@
972 if (tfind (newp, &bitfields, bitfield_compare) != NULL)
974 - error (0, 0, "%d: duplicated definition of bitfield '%s'",
975 + err (0, "%d: duplicated definition of bitfield '%s'",
976 i386_lineno, name);
977 free (name);
978 return;
981 if (tsearch (newp, &bitfields, bitfield_compare) == NULL)
982 - error (EXIT_FAILURE, errno, "%d: cannot insert new bitfield '%s'",
983 + err (EXIT_FAILURE, "%d: cannot insert new bitfield '%s'",
984 i386_lineno, name);
987 @@ -2292,7 +2289,7 @@
989 obstack_1grow (&os, '\0');
991 - error (0, 0, "%d: field '%s' not a multiple of 8 bits in size",
992 + err (0, "%d: field '%s' not a multiple of 8 bits in size",
993 i386_lineno, (char *) obstack_finish (&os));
995 obstack_free (&os, NULL);
996 @@ -2313,7 +2310,7 @@
998 if (val->field->tmp == testcnt)
1000 - error (0, 0, "%d: bitfield '%s' used more than once",
1001 + err (0, "%d: bitfield '%s' used more than once",
1002 i386_lineno - 1, val->field->name);
1003 result = 1;
1005 @@ -2350,7 +2347,7 @@
1007 if (runp == NULL)
1009 - error (0, 0, "%d: unknown bitfield '%s' used in output format",
1010 + err (0, "%d: unknown bitfield '%s' used in output format",
1011 i386_lineno - 1, name->field->name);
1012 result = 1;
1014 @@ -2394,7 +2391,7 @@
1015 #if 0
1016 if (runp == NULL)
1018 - error (0, 0, "%d: bitfield '%s' not used",
1019 + err (0, "%d: bitfield '%s' not used",
1020 i386_lineno - 1, bitval->field->name);
1021 result = 1;
1023 @@ -2457,7 +2454,7 @@
1024 if (runp->type == string)
1026 if (instr->operands[n].str != NULL)
1027 - error (EXIT_FAILURE, 0,
1028 + err (EXIT_FAILURE,
1029 "%d: cannot have more than one string parameter",
1030 i386_lineno - 1);
1032 @@ -2511,7 +2508,7 @@
1033 else if (instr->operands[n].off3 == 0)
1034 instr->operands[n].off3 = bitoff;
1035 else
1036 - error (EXIT_FAILURE, 0,
1037 + err (EXIT_FAILURE,
1038 "%d: cannot have more than three fields in parameter",
1039 i386_lineno - 1);
1041 @@ -2587,7 +2584,7 @@
1042 newp->str = runp->operands[i].fct;
1043 newp->idx = 0;
1044 if (tsearch (newp, &fct_names[i], compare_argstring) == NULL)
1045 - error (EXIT_FAILURE, errno, "tsearch");
1046 + err (EXIT_FAILURE, "tsearch");
1047 ++nfct_names[i];
1050 @@ -2600,7 +2597,7 @@
1051 newp->str = runp->operands[i].str;
1052 newp->idx = 0;
1053 if (tsearch (newp, &strs[i], compare_argstring) == NULL)
1054 - error (EXIT_FAILURE, errno, "tsearch");
1055 + err (EXIT_FAILURE, "tsearch");
1056 ++nstrs[i];
1059 diff --git a/libcpu/i386_parse.y b/libcpu/i386_parse.y
1060 --- a/libcpu/i386_parse.y
1061 +++ b/libcpu/i386_parse.y
1062 @@ -31,7 +31,7 @@
1063 #include <assert.h>
1064 #include <ctype.h>
1065 #include <errno.h>
1066 -#include <error.h>
1067 +#include <err.h>
1068 #include <inttypes.h>
1069 #include <libintl.h>
1070 #include <math.h>
1071 @@ -243,10 +243,6 @@
1073 spec: masks kPERCPERC '\n' instrs
1075 - if (error_message_count != 0)
1076 - error (EXIT_FAILURE, 0,
1077 - "terminated due to previous error");
1079 instrtable_out ();
1082 @@ -267,11 +263,11 @@
1083 newp->from = $2;
1084 newp->to = $3;
1085 if (tfind (newp, &synonyms, compare_syn) != NULL)
1086 - error (0, 0,
1087 + err (0, 0,
1088 "%d: duplicate definition for synonym '%s'",
1089 i386_lineno, $2);
1090 else if (tsearch ( newp, &synonyms, compare_syn) == NULL)
1091 - error (EXIT_FAILURE, 0, "tsearch");
1092 + err (EXIT_FAILURE, "tsearch");
1096 @@ -285,7 +281,7 @@
1097 if ($3 != NULL && strcmp ($3->name, "RE") != 0
1098 && strcmp ($3->name, "R") != 0)
1100 - error (0, 0, "%d: only 'R' and 'RE' prefix allowed",
1101 + err (0, "%d: only 'R' and 'RE' prefix allowed",
1102 i386_lineno - 1);
1104 if (check_duplicates ($1) == 0
1105 @@ -310,7 +306,7 @@
1107 if (tsearch ($4, &mnemonics,
1108 (comparison_fn_t) strcmp) == NULL)
1109 - error (EXIT_FAILURE, errno, "tsearch");
1110 + err (EXIT_FAILURE, "tsearch");
1111 ++nmnemonics;
1114 @@ -331,7 +327,7 @@
1115 else if (strcmp ($5->name, "D") == 0)
1116 newp->suffix = suffix_D;
1117 else
1118 - error (EXIT_FAILURE, 0,
1119 + err (EXIT_FAILURE,
1120 "%s: %d: unknown suffix '%s'",
1121 infname, i386_lineno - 1, $5->name);
1123 @@ -344,7 +340,7 @@
1124 ns->idx = ++nsuffixes;
1125 if (tsearch (ns, &suffixes, compare_suf)
1126 == NULL)
1127 - error (EXIT_FAILURE, errno, "tsearch");
1128 + err (EXIT_FAILURE, "tsearch");
1132 @@ -374,7 +370,7 @@
1133 res = tfind (&search, &bitfields, bitfield_compare);
1134 if (res == NULL)
1136 - error (0, 0, "%d: unknown bitfield '%s'",
1137 + err (0, "%d: unknown bitfield '%s'",
1138 i386_lineno, search.name);
1139 $$ = NULL;
1141 @@ -437,7 +433,7 @@
1142 res = tfind (&search, &bitfields, bitfield_compare);
1143 if (res == NULL)
1145 - error (0, 0, "%d: unknown bitfield '%s'",
1146 + err (0, "%d: unknown bitfield '%s'",
1147 i386_lineno, search.name);
1148 $$->type = failure;
1150 @@ -509,7 +505,7 @@
1151 $$->field = &bx_reg;
1152 else
1154 - error (0, 0, "%d: unknown bitfield '%s'",
1155 + err (0, "%d: unknown bitfield '%s'",
1156 i386_lineno, search.name);
1157 $$->field = NULL;
1159 @@ -549,7 +545,7 @@
1160 static void
1161 yyerror (const char *s)
1163 - error (0, 0, gettext ("while reading i386 CPU description: %s at line %d"),
1164 + err (0, gettext ("while reading i386 CPU description: %s at line %d"),
1165 gettext (s), i386_lineno);
1168 @@ -574,14 +570,14 @@
1170 if (tfind (newp, &bitfields, bitfield_compare) != NULL)
1172 - error (0, 0, "%d: duplicated definition of bitfield '%s'",
1173 + err (0, "%d: duplicated definition of bitfield '%s'",
1174 i386_lineno, name);
1175 free (name);
1176 return;
1179 if (tsearch (newp, &bitfields, bitfield_compare) == NULL)
1180 - error (EXIT_FAILURE, errno, "%d: cannot insert new bitfield '%s'",
1181 + err (EXIT_FAILURE, "%d: cannot insert new bitfield '%s'",
1182 i386_lineno, name);
1185 @@ -621,7 +617,7 @@
1187 obstack_1grow (&os, '\0');
1189 - error (0, 0, "%d: field '%s' not a multiple of 8 bits in size",
1190 + err (0, "%d: field '%s' not a multiple of 8 bits in size",
1191 i386_lineno, (char *) obstack_finish (&os));
1193 obstack_free (&os, NULL);
1194 @@ -642,7 +638,7 @@
1196 if (val->field->tmp == testcnt)
1198 - error (0, 0, "%d: bitfield '%s' used more than once",
1199 + err (0, "%d: bitfield '%s' used more than once",
1200 i386_lineno - 1, val->field->name);
1201 result = 1;
1203 @@ -679,7 +675,7 @@
1205 if (runp == NULL)
1207 - error (0, 0, "%d: unknown bitfield '%s' used in output format",
1208 + err (0, "%d: unknown bitfield '%s' used in output format",
1209 i386_lineno - 1, name->field->name);
1210 result = 1;
1212 @@ -723,7 +719,7 @@
1213 #if 0
1214 if (runp == NULL)
1216 - error (0, 0, "%d: bitfield '%s' not used",
1217 + err (0, "%d: bitfield '%s' not used",
1218 i386_lineno - 1, bitval->field->name);
1219 result = 1;
1221 @@ -786,7 +782,7 @@
1222 if (runp->type == string)
1224 if (instr->operands[n].str != NULL)
1225 - error (EXIT_FAILURE, 0,
1226 + err (EXIT_FAILURE,
1227 "%d: cannot have more than one string parameter",
1228 i386_lineno - 1);
1230 @@ -840,7 +836,7 @@
1231 else if (instr->operands[n].off3 == 0)
1232 instr->operands[n].off3 = bitoff;
1233 else
1234 - error (EXIT_FAILURE, 0,
1235 + err (EXIT_FAILURE,
1236 "%d: cannot have more than three fields in parameter",
1237 i386_lineno - 1);
1239 @@ -916,7 +912,7 @@
1240 newp->str = runp->operands[i].fct;
1241 newp->idx = 0;
1242 if (tsearch (newp, &fct_names[i], compare_argstring) == NULL)
1243 - error (EXIT_FAILURE, errno, "tsearch");
1244 + err (EXIT_FAILURE, "tsearch");
1245 ++nfct_names[i];
1248 @@ -929,7 +925,7 @@
1249 newp->str = runp->operands[i].str;
1250 newp->idx = 0;
1251 if (tsearch (newp, &strs[i], compare_argstring) == NULL)
1252 - error (EXIT_FAILURE, errno, "tsearch");
1253 + err (EXIT_FAILURE, "tsearch");
1254 ++nstrs[i];
1257 diff --git a/libdw/ChangeLog b/libdw/ChangeLog
1258 --- a/libdw/ChangeLog
1259 +++ b/libdw/ChangeLog
1260 @@ -308,6 +308,10 @@
1262 * dwarf_hasattr_integrate.c: Integrate DW_AT_specification too.
1264 +2009-08-17 Roland McGrath <roland@redhat.com>
1266 + * libdw.h: Disable extern inlines for GCC 4.2.
1268 2009-08-10 Roland McGrath <roland@redhat.com>
1270 * dwarf_getscopevar.c: Use dwarf_diename.
1271 @@ -1076,6 +1080,11 @@
1273 2005-05-31 Roland McGrath <roland@redhat.com>
1275 + * Makefile.am (WEXTRA): New variable, substituted by configure.
1276 + (AM_CFLAGS): Use it in place of -Wextra.
1278 +2005-05-31 Roland McGrath <roland@redhat.com>
1280 * dwarf_formref_die.c (dwarf_formref_die): Add CU header offset to
1281 formref offset.
1283 diff --git a/libdw/Makefile.in b/libdw/Makefile.in
1284 --- a/libdw/Makefile.in
1285 +++ b/libdw/Makefile.in
1286 @@ -192,6 +192,7 @@
1287 INSTALL_SCRIPT = @INSTALL_SCRIPT@
1288 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1289 LDFLAGS = @LDFLAGS@
1290 +LD_AS_NEEDED = @LD_AS_NEEDED@
1291 LEX = @LEX@
1292 LEXLIB = @LEXLIB@
1293 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1294 @@ -221,6 +222,7 @@
1295 STRIP = @STRIP@
1296 USE_NLS = @USE_NLS@
1297 VERSION = 1
1298 +WEXTRA = @WEXTRA@
1299 XGETTEXT = @XGETTEXT@
1300 XGETTEXT_015 = @XGETTEXT_015@
1301 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1302 @@ -282,8 +284,8 @@
1303 INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. \
1304 -I$(srcdir)/../libelf
1305 AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1306 - $($(*F)_no_Werror),,-Werror) $(if \
1307 - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
1308 + $($(*F)_no_Werror),,) $(if \
1309 + $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1310 $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
1311 $(am__append_1) $(am__append_2)
1312 @MUDFLAP_FALSE@libmudflap =
1313 diff --git a/libdw/dwarf_getpubnames.c b/libdw/dwarf_getpubnames.c
1314 --- a/libdw/dwarf_getpubnames.c
1315 +++ b/libdw/dwarf_getpubnames.c
1316 @@ -58,6 +58,7 @@
1317 #include <sys/param.h>
1319 #include <libdwP.h>
1320 +#include <system.h>
1321 #include <dwarf.h>
1324 diff --git a/libdw/libdw.h b/libdw/libdw.h
1325 --- a/libdw/libdw.h
1326 +++ b/libdw/libdw.h
1327 @@ -852,7 +852,7 @@
1330 /* Inline optimizations. */
1331 -#ifdef __OPTIMIZE__
1332 +#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
1333 /* Return attribute code of given attribute. */
1334 __libdw_extern_inline unsigned int
1335 dwarf_whatattr (Dwarf_Attribute *attr)
1336 diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
1337 --- a/libdw/libdw_alloc.c
1338 +++ b/libdw/libdw_alloc.c
1339 @@ -52,7 +52,7 @@
1340 # include <config.h>
1341 #endif
1343 -#include <error.h>
1344 +#include <err.h>
1345 #include <errno.h>
1346 #include <stdlib.h>
1347 #include <sys/param.h>
1348 @@ -95,5 +95,5 @@
1349 __libdw_oom (void)
1351 while (1)
1352 - error (EXIT_FAILURE, ENOMEM, "libdw");
1353 + err (EXIT_FAILURE, "libdw");
1355 diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
1356 --- a/libdwfl/ChangeLog
1357 +++ b/libdwfl/ChangeLog
1358 @@ -1366,6 +1366,11 @@
1360 2005-07-21 Roland McGrath <roland@redhat.com>
1362 + * Makefile.am (WEXTRA): New variable, substituted by configure.
1363 + (AM_CFLAGS): Use it in place of -Wextra.
1365 +2005-07-21 Roland McGrath <roland@redhat.com>
1367 * Makefile.am (noinst_HEADERS): Add loc2c.c.
1369 * test2.c (main): Check sscanf result to quiet warning.
1370 diff --git a/libdwfl/Makefile.in b/libdwfl/Makefile.in
1371 --- a/libdwfl/Makefile.in
1372 +++ b/libdwfl/Makefile.in
1373 @@ -67,7 +67,7 @@
1374 dwfl_getmodules.c dwfl_getdwarf.c dwfl_module_getdwarf.c \
1375 dwfl_module_getelf.c dwfl_validate_address.c argp-std.c \
1376 find-debuginfo.c dwfl_build_id_find_elf.c \
1377 - dwfl_build_id_find_debuginfo.c linux-kernel-modules.c \
1378 + dwfl_build_id_find_debuginfo.c \
1379 linux-proc-maps.c dwfl_addrmodule.c dwfl_addrdwarf.c cu.c \
1380 dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \
1381 dwfl_module_addrdie.c dwfl_addrdie.c lines.c dwfl_lineinfo.c \
1382 @@ -95,7 +95,7 @@
1383 dwfl_validate_address.$(OBJEXT) argp-std.$(OBJEXT) \
1384 find-debuginfo.$(OBJEXT) dwfl_build_id_find_elf.$(OBJEXT) \
1385 dwfl_build_id_find_debuginfo.$(OBJEXT) \
1386 - linux-kernel-modules.$(OBJEXT) linux-proc-maps.$(OBJEXT) \
1387 + linux-proc-maps.$(OBJEXT) \
1388 dwfl_addrmodule.$(OBJEXT) dwfl_addrdwarf.$(OBJEXT) \
1389 cu.$(OBJEXT) dwfl_module_nextcu.$(OBJEXT) \
1390 dwfl_nextcu.$(OBJEXT) dwfl_cumodule.$(OBJEXT) \
1391 @@ -182,6 +182,7 @@
1392 INSTALL_SCRIPT = @INSTALL_SCRIPT@
1393 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1394 LDFLAGS = @LDFLAGS@
1395 +LD_AS_NEEDED = @LD_AS_NEEDED@
1396 LEX = @LEX@
1397 LEXLIB = @LEXLIB@
1398 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1399 @@ -211,6 +212,7 @@
1400 STRIP = @STRIP@
1401 USE_NLS = @USE_NLS@
1402 VERSION = 1
1403 +WEXTRA = @WEXTRA@
1404 XGETTEXT = @XGETTEXT@
1405 XGETTEXT_015 = @XGETTEXT_015@
1406 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1407 @@ -273,8 +275,8 @@
1408 -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
1409 -I$(srcdir)/../libdw
1410 AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1411 - $($(*F)_no_Werror),,-Werror) $(if \
1412 - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
1413 + $($(*F)_no_Werror),,) $(if \
1414 + $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1415 $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
1416 $(am__append_1)
1417 @MUDFLAP_FALSE@libmudflap =
1418 @@ -293,7 +295,7 @@
1419 dwfl_getmodules.c dwfl_getdwarf.c dwfl_module_getdwarf.c \
1420 dwfl_module_getelf.c dwfl_validate_address.c argp-std.c \
1421 find-debuginfo.c dwfl_build_id_find_elf.c \
1422 - dwfl_build_id_find_debuginfo.c linux-kernel-modules.c \
1423 + dwfl_build_id_find_debuginfo.c \
1424 linux-proc-maps.c dwfl_addrmodule.c dwfl_addrdwarf.c cu.c \
1425 dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \
1426 dwfl_module_addrdie.c dwfl_addrdie.c lines.c dwfl_lineinfo.c \
1427 @@ -424,7 +426,6 @@
1428 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdwfl_crc32_file.Po@am__quote@
1429 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lines.Po@am__quote@
1430 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/link_map.Po@am__quote@
1431 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-kernel-modules.Po@am__quote@
1432 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-proc-maps.Po@am__quote@
1433 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lzma.Po@am__quote@
1434 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/offline.Po@am__quote@
1435 diff --git a/libdwfl/argp-std.c b/libdwfl/argp-std.c
1436 --- a/libdwfl/argp-std.c
1437 +++ b/libdwfl/argp-std.c
1438 @@ -73,9 +73,6 @@
1439 { "linux-process-map", 'M', "FILE", 0,
1440 N_("Find addresses in files mapped as read from FILE"
1441 " in Linux /proc/PID/maps format"), 0 },
1442 - { "kernel", 'k', NULL, 0, N_("Find addresses in the running kernel"), 0 },
1443 - { "offline-kernel", 'K', "RELEASE", OPTION_ARG_OPTIONAL,
1444 - N_("Kernel with all modules"), 0 },
1445 { "debuginfo-path", OPT_DEBUGINFO, "PATH", 0,
1446 N_("Search path for separate debuginfo files"), 0 },
1447 { NULL, 0, NULL, 0, NULL, 0 }
1448 @@ -102,15 +99,6 @@
1449 .find_elf = INTUSE(dwfl_linux_proc_find_elf),
1452 -static const Dwfl_Callbacks kernel_callbacks =
1454 - .find_debuginfo = INTUSE(dwfl_standard_find_debuginfo),
1455 - .debuginfo_path = &debuginfo_path,
1457 - .find_elf = INTUSE(dwfl_linux_kernel_find_elf),
1458 - .section_address = INTUSE(dwfl_linux_kernel_module_section_address),
1459 - };
1461 static error_t
1462 parse_opt (int key, char *arg, struct argp_state *state)
1464 @@ -244,37 +232,6 @@
1466 break;
1468 - case 'k':
1469 - if (state->hook == NULL)
1471 - Dwfl *dwfl = INTUSE(dwfl_begin) (&kernel_callbacks);
1472 - int result = INTUSE(dwfl_linux_kernel_report_kernel) (dwfl);
1473 - if (result != 0)
1474 - return fail (dwfl, result, _("cannot load kernel symbols"));
1475 - result = INTUSE(dwfl_linux_kernel_report_modules) (dwfl);
1476 - if (result != 0)
1477 - /* Non-fatal to have no modules since we do have the kernel. */
1478 - failure (dwfl, result, _("cannot find kernel modules"));
1479 - state->hook = dwfl;
1481 - else
1482 - goto toomany;
1483 - break;
1485 - case 'K':
1486 - if (state->hook == NULL)
1488 - Dwfl *dwfl = INTUSE(dwfl_begin) (&offline_callbacks);
1489 - int result = INTUSE(dwfl_linux_kernel_report_offline) (dwfl, arg,
1490 - NULL);
1491 - if (result != 0)
1492 - return fail (dwfl, result, _("cannot find kernel or modules"));
1493 - state->hook = dwfl;
1495 - else
1496 - goto toomany;
1497 - break;
1499 case ARGP_KEY_SUCCESS:
1501 Dwfl *dwfl = state->hook;
1502 diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c
1503 --- a/libdwfl/core-file.c
1504 +++ b/libdwfl/core-file.c
1505 @@ -64,7 +64,7 @@
1506 This implementation is pessimal for non-mmap cases and should
1507 be replaced by more diddling inside libelf internals. */
1508 static Elf *
1509 -elf_begin_rand (Elf *parent, loff_t offset, loff_t size, loff_t *next)
1510 +elf_begin_rand (Elf *parent, off_t offset, off_t size, off_t *next)
1512 if (parent == NULL)
1513 return NULL;
1514 @@ -79,14 +79,14 @@
1515 return NULL;
1518 - loff_t min = (parent->kind == ELF_K_ELF ?
1519 + off_t min = (parent->kind == ELF_K_ELF ?
1520 (parent->class == ELFCLASS32
1521 ? sizeof (Elf32_Ehdr) : sizeof (Elf64_Ehdr))
1522 : parent->kind == ELF_K_AR ? SARMAG
1523 : 0);
1525 if (unlikely (offset < min)
1526 - || unlikely (offset >= (loff_t) parent->maximum_size))
1527 + || unlikely (offset >= (off_t) parent->maximum_size))
1528 return fail (ELF_E_RANGE);
1530 /* For an archive, fetch just the size field
1531 @@ -113,11 +113,11 @@
1532 char *endp;
1533 size = strtoll (h.ar_size, &endp, 10);
1534 if (unlikely (endp == h.ar_size)
1535 - || unlikely ((loff_t) parent->maximum_size - offset < size))
1536 + || unlikely ((off_t) parent->maximum_size - offset < size))
1537 return fail (ELF_E_INVALID_ARCHIVE);
1540 - if (unlikely ((loff_t) parent->maximum_size - offset < size))
1541 + if (unlikely ((off_t) parent->maximum_size - offset < size))
1542 return fail (ELF_E_RANGE);
1544 /* Even if we fail at this point, update *NEXT to point past the file. */
1545 @@ -125,7 +125,7 @@
1546 *next = offset + size;
1548 if (unlikely (offset == 0)
1549 - && unlikely (size == (loff_t) parent->maximum_size))
1550 + && unlikely (size == (off_t) parent->maximum_size))
1551 return elf_clone (parent, parent->cmd);
1553 /* Note the image is guaranteed live only as long as PARENT
1554 @@ -135,7 +135,7 @@
1555 Elf_Data *data = elf_getdata_rawchunk (parent, offset, size, ELF_T_BYTE);
1556 if (data == NULL)
1557 return NULL;
1558 - assert ((loff_t) data->d_size == size);
1559 + assert ((off_t) data->d_size == size);
1560 return elf_memory (data->d_buf, size);
1563 diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
1564 --- a/libdwfl/dwfl_build_id_find_elf.c
1565 +++ b/libdwfl/dwfl_build_id_find_elf.c
1566 @@ -48,6 +48,7 @@
1567 <http://www.openinventionnetwork.com>. */
1569 #include "libdwflP.h"
1570 +#include <system.h>
1571 #include <inttypes.h>
1572 #include <fcntl.h>
1573 #include <unistd.h>
1574 @@ -109,7 +110,7 @@
1576 if (*file_name != NULL)
1577 free (*file_name);
1578 - *file_name = canonicalize_file_name (name);
1579 + *file_name = realpath (name, NULL);
1580 if (*file_name == NULL)
1582 *file_name = name;
1583 diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c
1584 --- a/libdwfl/dwfl_module_getdwarf.c
1585 +++ b/libdwfl/dwfl_module_getdwarf.c
1586 @@ -48,6 +48,7 @@
1587 <http://www.openinventionnetwork.com>. */
1589 #include "libdwflP.h"
1590 +#include <system.h>
1591 #include <fcntl.h>
1592 #include <string.h>
1593 #include <unistd.h>
1594 diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
1595 --- a/libdwfl/find-debuginfo.c
1596 +++ b/libdwfl/find-debuginfo.c
1597 @@ -185,7 +185,7 @@
1600 char *file_dirname = (file_basename == file_name ? NULL
1601 - : strndupa (file_name, file_basename - 1 - file_name));
1602 + : strndup (file_name, file_basename - 1 - file_name));
1603 char *p;
1604 while ((p = strsep (&path, ":")) != NULL)
1606 @@ -279,7 +279,7 @@
1607 /* If FILE_NAME is a symlink, the debug file might be associated
1608 with the symlink target name instead. */
1610 - char *canon = canonicalize_file_name (file_name);
1611 + char *canon = realpath (file_name, NULL);
1612 if (canon != NULL && strcmp (file_name, canon))
1613 fd = find_debuginfo_in_path (mod, canon,
1614 debuglink_file, debuglink_crc,
1615 diff --git a/libebl/ChangeLog b/libebl/ChangeLog
1616 --- a/libebl/ChangeLog
1617 +++ b/libebl/ChangeLog
1618 @@ -628,6 +628,11 @@
1619 * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency
1620 tracking works right.
1622 +2005-05-31 Roland McGrath <roland@redhat.com>
1624 + * Makefile.am (WEXTRA): New variable, substituted by configure.
1625 + (AM_CFLAGS): Use it in place of -Wextra.
1627 2005-05-21 Ulrich Drepper <drepper@redhat.com>
1629 * libebl_x86_64.map: Add x86_64_core_note.
1630 diff --git a/libebl/Makefile.in b/libebl/Makefile.in
1631 --- a/libebl/Makefile.in
1632 +++ b/libebl/Makefile.in
1633 @@ -143,6 +143,7 @@
1634 INSTALL_SCRIPT = @INSTALL_SCRIPT@
1635 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1636 LDFLAGS = @LDFLAGS@
1637 +LD_AS_NEEDED = @LD_AS_NEEDED@
1638 LEX = @LEX@
1639 LEXLIB = @LEXLIB@
1640 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1641 @@ -172,6 +173,7 @@
1642 STRIP = @STRIP@
1643 USE_NLS = @USE_NLS@
1644 VERSION = 1
1645 +WEXTRA = @WEXTRA@
1646 XGETTEXT = @XGETTEXT@
1647 XGETTEXT_015 = @XGETTEXT_015@
1648 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1649 @@ -234,8 +236,8 @@
1650 -I$(srcdir)/../libelf -I$(srcdir)/../libdw \
1651 -I$(srcdir)/../libasm
1652 AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1653 - $($(*F)_no_Werror),,-Werror) $(if \
1654 - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
1655 + $($(*F)_no_Werror),,) $(if \
1656 + $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1657 $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
1658 $(am__append_1) -fpic
1659 @MUDFLAP_FALSE@libmudflap =
1660 diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
1661 --- a/libebl/eblopenbackend.c
1662 +++ b/libebl/eblopenbackend.c
1663 @@ -53,7 +53,6 @@
1665 #include <assert.h>
1666 #include <dlfcn.h>
1667 -#include <error.h>
1668 #include <libelfP.h>
1669 #include <dwarf.h>
1670 #include <stdlib.h>
1671 diff --git a/libelf/ChangeLog b/libelf/ChangeLog
1672 --- a/libelf/ChangeLog
1673 +++ b/libelf/ChangeLog
1674 @@ -671,6 +671,11 @@
1676 * elf.h: Update from glibc.
1678 +2005-05-31 Roland McGrath <roland@redhat.com>
1680 + * Makefile.am (WEXTRA): New variable, substituted by configure.
1681 + (AM_CFLAGS): Use it in place of -Wextra.
1683 2005-05-08 Roland McGrath <roland@redhat.com>
1685 * elf_begin.c (read_file) [_MUDFLAP]: Don't use mmap for now.
1686 diff --git a/libelf/Makefile.in b/libelf/Makefile.in
1687 --- a/libelf/Makefile.in
1688 +++ b/libelf/Makefile.in
1689 @@ -189,6 +189,7 @@
1690 INSTALL_SCRIPT = @INSTALL_SCRIPT@
1691 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1692 LDFLAGS = @LDFLAGS@
1693 +LD_AS_NEEDED = @LD_AS_NEEDED@
1694 LEX = @LEX@
1695 LEXLIB = @LEXLIB@
1696 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1697 @@ -218,6 +219,7 @@
1698 STRIP = @STRIP@
1699 USE_NLS = @USE_NLS@
1700 VERSION = 1
1701 +WEXTRA = @WEXTRA@
1702 XGETTEXT = @XGETTEXT@
1703 XGETTEXT_015 = @XGETTEXT_015@
1704 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1705 @@ -278,8 +280,8 @@
1706 zip_LIBS = @zip_LIBS@
1707 INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
1708 AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
1709 - $($(*F)_no_Werror),,-Werror) $(if \
1710 - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
1711 + $($(*F)_no_Werror),,) $(if \
1712 + $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
1713 $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
1714 $(am__append_1) $(am__append_2)
1715 @MUDFLAP_FALSE@libmudflap =
1716 diff --git a/libelf/ar.h b/libelf/ar.h
1717 new file mode 100644
1718 --- /dev/null
1719 +++ b/libelf/ar.h
1720 @@ -0,0 +1,55 @@
1721 +/* archive file definition for GNU software
1723 + Copyright 2001, 2008, 2010 Free Software Foundation, Inc.
1725 + This program is free software; you can redistribute it and/or modify
1726 + it under the terms of the GNU General Public License as published by
1727 + the Free Software Foundation; either version 3 of the License, or
1728 + (at your option) any later version.
1730 + This program is distributed in the hope that it will be useful,
1731 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1732 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1733 + GNU General Public License for more details.
1735 + You should have received a copy of the GNU General Public License
1736 + along with this program; if not, write to the Free Software
1737 + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
1738 + MA 02110-1301, USA. */
1740 +/* So far this is correct for BSDish archives. Don't forget that
1741 + files must begin on an even byte boundary. */
1743 +#ifndef __GNU_AR_H__
1744 +#define __GNU_AR_H__
1746 +/* Note that the usual '\n' in magic strings may translate to different
1747 + characters, as allowed by ANSI. '\012' has a fixed value, and remains
1748 + compatible with existing BSDish archives. */
1750 +#define ARMAG "!<arch>\012" /* For COFF and a.out archives. */
1751 +#define ARMAGB "!<bout>\012" /* For b.out archives. */
1752 +#define ARMAGT "!<thin>\012" /* For thin archives. */
1753 +#define SARMAG 8
1754 +#define ARFMAG "`\012"
1756 +/* The ar_date field of the armap (__.SYMDEF) member of an archive
1757 + must be greater than the modified date of the entire file, or
1758 + BSD-derived linkers complain. We originally write the ar_date with
1759 + this offset from the real file's mod-time. After finishing the
1760 + file, we rewrite ar_date if it's not still greater than the mod date. */
1762 +#define ARMAP_TIME_OFFSET 60
1764 +struct ar_hdr
1766 + char ar_name[16]; /* Name of this member. */
1767 + char ar_date[12]; /* File mtime. */
1768 + char ar_uid[6]; /* Owner uid; printed as decimal. */
1769 + char ar_gid[6]; /* Owner gid; printed as decimal. */
1770 + char ar_mode[8]; /* File mode, printed as octal. */
1771 + char ar_size[10]; /* File size, printed as decimal. */
1772 + char ar_fmag[2]; /* Should contain ARFMAG. */
1775 +#endif /* __GNU_AR_H__ */
1776 diff --git a/libelf/common.h b/libelf/common.h
1777 --- a/libelf/common.h
1778 +++ b/libelf/common.h
1779 @@ -51,7 +51,7 @@
1780 #ifndef _COMMON_H
1781 #define _COMMON_H 1
1783 -#include <ar.h>
1784 +#include "ar.h"
1785 #include <byteswap.h>
1786 #include <endian.h>
1787 #include <stdlib.h>
1788 @@ -160,7 +160,7 @@
1789 (Var) = (sizeof (Var) == 1 \
1790 ? (unsigned char) (Var) \
1791 : (sizeof (Var) == 2 \
1792 - ? bswap_16 (Var) \
1793 + ? (unsigned short int) bswap_16 (Var) \
1794 : (sizeof (Var) == 4 \
1795 ? bswap_32 (Var) \
1796 : bswap_64 (Var))))
1797 @@ -169,7 +169,7 @@
1798 (Dst) = (sizeof (Var) == 1 \
1799 ? (unsigned char) (Var) \
1800 : (sizeof (Var) == 2 \
1801 - ? bswap_16 (Var) \
1802 + ? (unsigned short int) bswap_16 (Var) \
1803 : (sizeof (Var) == 4 \
1804 ? bswap_32 (Var) \
1805 : bswap_64 (Var))))
1806 diff --git a/libelf/elf.h b/libelf/elf.h
1807 --- a/libelf/elf.h
1808 +++ b/libelf/elf.h
1809 @@ -21,9 +21,10 @@
1810 #ifndef _ELF_H
1811 #define _ELF_H 1
1813 -#include <features.h>
1815 -__BEGIN_DECLS
1816 +#ifdef __cplusplus
1817 +extern "C" {
1818 +#endif
1820 /* Standard ELF types. */
1822 @@ -2794,6 +2795,8 @@
1823 #define R_M32R_NUM 256 /* Keep this the last entry. */
1826 -__END_DECLS
1827 +#ifdef __cplusplus
1829 +#endif
1831 #endif /* elf.h */
1832 diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
1833 --- a/libelf/elf_begin.c
1834 +++ b/libelf/elf_begin.c
1835 @@ -796,7 +796,7 @@
1838 /* Copy the raw name over to a NUL terminated buffer. */
1839 - *((char *) __mempcpy (elf->state.ar.raw_name, ar_hdr->ar_name, 16)) = '\0';
1840 + *((char *) mempcpy (elf->state.ar.raw_name, ar_hdr->ar_name, 16)) = '\0';
1842 elf_ar_hdr = &elf->state.ar.elf_ar_hdr;
1844 @@ -888,7 +888,7 @@
1845 const char *string = ar_hdr->FIELD; \
1846 if (ar_hdr->FIELD[sizeof (ar_hdr->FIELD) - 1] != ' ') \
1848 - *((char *) __mempcpy (buf, ar_hdr->FIELD, sizeof (ar_hdr->FIELD))) \
1849 + *((char *) mempcpy (buf, ar_hdr->FIELD, sizeof (ar_hdr->FIELD))) \
1850 = '\0'; \
1851 string = buf; \
1853 diff --git a/libelf/libelf.h b/libelf/libelf.h
1854 --- a/libelf/libelf.h
1855 +++ b/libelf/libelf.h
1856 @@ -95,7 +95,7 @@
1857 Elf_Type d_type; /* Type of this piece of data. */
1858 unsigned int d_version; /* ELF version. */
1859 size_t d_size; /* Size in bytes. */
1860 - loff_t d_off; /* Offset into section. */
1861 + off_t d_off; /* Offset into section. */
1862 size_t d_align; /* Alignment in section. */
1863 } Elf_Data;
1865 @@ -157,7 +157,7 @@
1866 uid_t ar_uid; /* User ID. */
1867 gid_t ar_gid; /* Group ID. */
1868 mode_t ar_mode; /* File mode. */
1869 - loff_t ar_size; /* File size. */
1870 + off_t ar_size; /* File size. */
1871 char *ar_rawname; /* Original name of archive member. */
1872 } Elf_Arhdr;
1874 @@ -198,13 +198,13 @@
1875 extern int elf_end (Elf *__elf);
1877 /* Update ELF descriptor and write file to disk. */
1878 -extern loff_t elf_update (Elf *__elf, Elf_Cmd __cmd);
1879 +extern off_t elf_update (Elf *__elf, Elf_Cmd __cmd);
1881 /* Determine what kind of file is associated with ELF. */
1882 extern Elf_Kind elf_kind (Elf *__elf) __attribute__ ((__pure__));
1884 /* Get the base offset for an object file. */
1885 -extern loff_t elf_getbase (Elf *__elf);
1886 +extern off_t elf_getbase (Elf *__elf);
1889 /* Retrieve file identification data. */
1890 @@ -322,7 +322,7 @@
1891 would be for TYPE. The resulting Elf_Data pointer is valid until
1892 elf_end (ELF) is called. */
1893 extern Elf_Data *elf_getdata_rawchunk (Elf *__elf,
1894 - loff_t __offset, size_t __size,
1895 + off_t __offset, size_t __size,
1896 Elf_Type __type);
1899 @@ -334,7 +334,7 @@
1900 extern Elf_Arhdr *elf_getarhdr (Elf *__elf);
1902 /* Return offset in archive for current file ELF. */
1903 -extern loff_t elf_getaroff (Elf *__elf);
1904 +extern off_t elf_getaroff (Elf *__elf);
1906 /* Select archive element at OFFSET. */
1907 extern size_t elf_rand (Elf *__elf, size_t __offset);
1908 diff --git a/libelf/libelfP.h b/libelf/libelfP.h
1909 --- a/libelf/libelfP.h
1910 +++ b/libelf/libelfP.h
1911 @@ -55,7 +55,7 @@
1912 # include <config.h>
1913 #endif
1915 -#include <ar.h>
1916 +#include "ar.h"
1917 #include <gelf.h>
1919 #include <errno.h>
1920 diff --git a/m4/Makefile.in b/m4/Makefile.in
1921 --- a/m4/Makefile.in
1922 +++ b/m4/Makefile.in
1923 @@ -75,6 +75,7 @@
1924 INSTALL_SCRIPT = @INSTALL_SCRIPT@
1925 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1926 LDFLAGS = @LDFLAGS@
1927 +LD_AS_NEEDED = @LD_AS_NEEDED@
1928 LEX = @LEX@
1929 LEXLIB = @LEXLIB@
1930 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
1931 @@ -104,6 +105,7 @@
1932 STRIP = @STRIP@
1933 USE_NLS = @USE_NLS@
1934 VERSION = @VERSION@
1935 +WEXTRA = @WEXTRA@
1936 XGETTEXT = @XGETTEXT@
1937 XGETTEXT_015 = @XGETTEXT_015@
1938 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
1939 diff --git a/src/ChangeLog b/src/ChangeLog
1940 --- a/src/ChangeLog
1941 +++ b/src/ChangeLog
1942 @@ -260,8 +260,16 @@
1943 * readelf.c (attr_callback): Use print_block only when we don't use
1944 print_ops.
1946 +2009-08-17 Roland McGrath <roland@redhat.com>
1948 + * ld.h: Disable extern inlines for GCC 4.2.
1950 2009-08-14 Roland McGrath <roland@redhat.com>
1952 + * strings.c (read_block): Conditionalize posix_fadvise use
1953 + on [POSIX_FADV_SEQUENTIAL].
1954 + From Petr Salinger <Petr.Salinger@seznam.cz>.
1956 * ar.c (do_oper_extract): Use pathconf instead of statfs.
1958 2009-08-01 Ulrich Drepper <drepper@redhat.com>
1959 @@ -425,6 +433,8 @@
1960 * readelf.c (print_debug_frame_section): Use t instead of j formats
1961 for ptrdiff_t OFFSET.
1963 + * addr2line.c (handle_address): Use %a instead of %m for compatibility.
1965 2009-01-21 Ulrich Drepper <drepper@redhat.com>
1967 * elflint.c (check_program_header): Fix typo in .eh_frame_hdr section
1968 @@ -608,6 +618,11 @@
1969 that matches its PT_LOAD's p_flags &~ PF_W. On sparc, PF_X really
1970 is valid in RELRO.
1972 +2008-03-01 Roland McGrath <roland@redhat.com>
1974 + * readelf.c (dump_archive_index): Tweak portability hack
1975 + to match [__GNUC__ < 4] too.
1977 2008-02-29 Roland McGrath <roland@redhat.com>
1979 * readelf.c (print_attributes): Add a cast.
1980 @@ -859,6 +874,8 @@
1982 * readelf.c (hex_dump): Fix rounding error in whitespace calculation.
1984 + * Makefile.am (readelf_no_Werror): New variable.
1986 2007-10-15 Roland McGrath <roland@redhat.com>
1988 * make-debug-archive.in: New file.
1989 @@ -1298,6 +1315,10 @@
1990 * elflint.c (valid_e_machine): Add EM_ALPHA.
1991 Reported by Christian Aichinger <Greek0@gmx.net>.
1993 + * strings.c (map_file): Define POSIX_MADV_SEQUENTIAL to
1994 + MADV_SEQUENTIAL if undefined. Don't call posix_madvise
1995 + if neither is defined.
1997 2006-08-08 Ulrich Drepper <drepper@redhat.com>
1999 * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
2000 @@ -1374,6 +1395,10 @@
2001 * Makefile.am: Add hacks to create dependency files for non-generic
2002 linker.
2004 +2006-04-05 Roland McGrath <roland@redhat.com>
2006 + * strings.c (MAP_POPULATE): Define to 0 if undefined.
2008 2006-06-12 Ulrich Drepper <drepper@redhat.com>
2010 * ldgeneric.c (ld_generic_generate_sections): Don't create .interp
2011 @@ -1722,6 +1747,11 @@
2012 * readelf.c (print_debug_loc_section): Fix indentation for larger
2013 address size.
2015 +2005-05-31 Roland McGrath <roland@redhat.com>
2017 + * Makefile.am (WEXTRA): New variable, substituted by configure.
2018 + (AM_CFLAGS): Use it in place of -Wextra.
2020 2005-05-30 Roland McGrath <roland@redhat.com>
2022 * readelf.c (print_debug_line_section): Print section offset of each
2023 diff --git a/src/Makefile.am b/src/Makefile.am
2024 --- a/src/Makefile.am
2025 +++ b/src/Makefile.am
2026 @@ -99,6 +99,9 @@
2027 # XXX While the file is not finished, don't warn about this
2028 ldgeneric_no_Wunused = yes
2030 +# Buggy old compilers.
2031 +readelf_no_Werror = yes
2033 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
2034 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
2035 size_LDADD = $(libelf) $(libeu) $(libmudflap)
2036 diff --git a/src/Makefile.in b/src/Makefile.in
2037 --- a/src/Makefile.in
2038 +++ b/src/Makefile.in
2039 @@ -228,6 +228,7 @@
2040 INSTALL_SCRIPT = @INSTALL_SCRIPT@
2041 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
2042 LDFLAGS = @LDFLAGS@
2043 +LD_AS_NEEDED = @LD_AS_NEEDED@
2044 LEX = @LEX@
2045 LEXLIB = @LEXLIB@
2046 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
2047 @@ -257,6 +258,7 @@
2048 STRIP = @STRIP@
2049 USE_NLS = @USE_NLS@
2050 VERSION = @VERSION@
2051 +WEXTRA = @WEXTRA@
2052 XGETTEXT = @XGETTEXT@
2053 XGETTEXT_015 = @XGETTEXT_015@
2054 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
2055 @@ -320,8 +322,8 @@
2056 -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \
2057 -I$(srcdir)/../libasm
2058 AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
2059 - $($(*F)_no_Werror),,-Werror) $(if \
2060 - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
2061 + $($(*F)_no_Werror),,) $(if \
2062 + $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
2063 $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
2064 $(am__append_1)
2065 @MUDFLAP_FALSE@libmudflap =
2066 @@ -368,6 +370,9 @@
2067 addr2line_no_Wformat = yes
2068 # XXX While the file is not finished, don't warn about this
2069 ldgeneric_no_Wunused = yes
2071 +# Buggy old compilers.
2072 +readelf_no_Werror = yes
2073 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
2074 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
2075 size_LDADD = $(libelf) $(libeu) $(libmudflap)
2076 diff --git a/src/addr2line.c b/src/addr2line.c
2077 --- a/src/addr2line.c
2078 +++ b/src/addr2line.c
2079 @@ -455,10 +455,10 @@
2080 bool parsed = false;
2081 int i, j;
2082 char *name = NULL;
2083 - if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
2084 + if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
2085 && string[i] == '\0')
2086 parsed = adjust_to_section (name, &addr, dwfl);
2087 - switch (sscanf (string, "%m[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
2088 + switch (sscanf (string, "%a[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
2090 default:
2091 break;
2092 diff --git a/src/findtextrel.c b/src/findtextrel.c
2093 --- a/src/findtextrel.c
2094 +++ b/src/findtextrel.c
2095 @@ -31,7 +31,7 @@
2096 #include <argp.h>
2097 #include <assert.h>
2098 #include <errno.h>
2099 -#include <error.h>
2100 +#include <err.h>
2101 #include <fcntl.h>
2102 #include <gelf.h>
2103 #include <libdw.h>
2104 @@ -226,14 +226,14 @@
2105 int fd = open64 (real_fname, O_RDONLY);
2106 if (fd == -1)
2108 - error (0, errno, gettext ("cannot open '%s'"), fname);
2109 + err (0, gettext ("cannot open '%s'"), fname);
2110 return 1;
2113 Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
2114 if (elf == NULL)
2116 - error (0, 0, gettext ("cannot create ELF descriptor for '%s': %s"),
2117 + err (0, gettext ("cannot create ELF descriptor for '%s': %s"),
2118 fname, elf_errmsg (-1));
2119 goto err_close;
2121 @@ -243,7 +243,7 @@
2122 GElf_Ehdr *ehdr = gelf_getehdr (elf, &ehdr_mem);
2123 if (ehdr == NULL)
2125 - error (0, 0, gettext ("cannot get ELF header '%s': %s"),
2126 + err (0, gettext ("cannot get ELF header '%s': %s"),
2127 fname, elf_errmsg (-1));
2128 err_elf_close:
2129 elf_end (elf);
2130 @@ -254,7 +254,7 @@
2132 if (ehdr->e_type != ET_DYN)
2134 - error (0, 0, gettext ("'%s' is not a DSO or PIE"), fname);
2135 + err (0, gettext ("'%s' is not a DSO or PIE"), fname);
2136 goto err_elf_close;
2139 @@ -273,7 +273,7 @@
2141 if (shdr == NULL)
2143 - error (0, 0,
2144 + err (0,
2145 gettext ("getting get section header of section %zu: %s"),
2146 elf_ndxscn (scn), elf_errmsg (-1));
2147 goto err_elf_close;
2148 @@ -297,7 +297,7 @@
2149 dyn = gelf_getdyn (data, cnt, &dynmem);
2150 if (dyn == NULL)
2152 - error (0, 0, gettext ("cannot read dynamic section: %s"),
2153 + err (0, gettext ("cannot read dynamic section: %s"),
2154 elf_errmsg (-1));
2155 goto err_elf_close;
2157 @@ -318,7 +318,7 @@
2159 if (!have_textrel)
2161 - error (0, 0, gettext ("no text relocations reported in '%s'"), fname);
2162 + err (0, gettext ("no text relocations reported in '%s'"), fname);
2163 return 1;
2166 @@ -330,7 +330,7 @@
2167 struct segments *segments
2168 = (struct segments *) malloc (nsegments_max * sizeof (segments[0]));
2169 if (segments == NULL)
2170 - error (1, errno, gettext ("while reading ELF file"));
2171 + err (1, gettext ("while reading ELF file"));
2173 for (int i = 0; i < ehdr->e_phnum; ++i)
2175 @@ -338,7 +338,7 @@
2176 GElf_Phdr *phdr = gelf_getphdr (elf, i, &phdr_mem);
2177 if (phdr == NULL)
2179 - error (0, 0,
2180 + err (0,
2181 gettext ("cannot get program header index at offset %d: %s"),
2182 i, elf_errmsg (-1));
2183 result = 1;
2184 @@ -356,7 +356,7 @@
2185 * sizeof (segments[0]));
2186 if (segments == NULL)
2188 - error (0, 0, gettext ("\
2189 + err (0, gettext ("\
2190 cannot get program header index at offset %d: %s"),
2191 i, elf_errmsg (-1));
2192 result = 1;
2193 @@ -407,7 +407,7 @@
2195 if (shdr == NULL)
2197 - error (0, 0,
2198 + err (0,
2199 gettext ("cannot get section header of section %Zu: %s"),
2200 elf_ndxscn (scn), elf_errmsg (-1));
2201 result = 1;
2202 @@ -420,7 +420,7 @@
2203 symscn = elf_getscn (elf, shdr->sh_link);
2204 if (symscn == NULL)
2206 - error (0, 0, gettext ("\
2207 + err (0, gettext ("\
2208 cannot get symbol table section %zu in '%s': %s"),
2209 (size_t) shdr->sh_link, fname, elf_errmsg (-1));
2210 result = 1;
2211 @@ -440,7 +440,7 @@
2212 GElf_Rel *rel = gelf_getrel (data, cnt, &rel_mem);
2213 if (rel == NULL)
2215 - error (0, 0, gettext ("\
2216 + err (0, gettext ("\
2217 cannot get relocation at index %d in section %zu in '%s': %s"),
2218 cnt, elf_ndxscn (scn), fname, elf_errmsg (-1));
2219 result = 1;
2220 @@ -463,7 +463,7 @@
2221 GElf_Rela *rela = gelf_getrela (data, cnt, &rela_mem);
2222 if (rela == NULL)
2224 - error (0, 0, gettext ("\
2225 + err (0, gettext ("\
2226 cannot get relocation at index %d in section %zu in '%s': %s"),
2227 cnt, elf_ndxscn (scn), fname, elf_errmsg (-1));
2228 result = 1;
2229 @@ -504,7 +504,11 @@
2232 static void
2233 -check_rel (size_t nsegments, struct segments segments[nsegments],
2234 +check_rel (size_t nsegments, struct segments segments[
2235 +#if __GNUC__ >= 4
2236 + nsegments
2237 +#endif
2238 + ],
2239 GElf_Addr addr, Elf *elf, Elf_Scn *symscn, Dwarf *dw,
2240 const char *fname, bool more_than_one, void **knownsrcs)
2242 diff --git a/src/ld.h b/src/ld.h
2243 --- a/src/ld.h
2244 +++ b/src/ld.h
2245 @@ -1122,6 +1122,7 @@
2247 /* Checked whether the symbol is undefined and referenced from a DSO. */
2248 extern bool linked_from_dso_p (struct scninfo *scninfo, size_t symidx);
2249 +#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
2250 #ifdef __GNUC_STDC_INLINE__
2251 __attribute__ ((__gnu_inline__))
2252 #endif
2253 @@ -1139,5 +1140,6 @@
2255 return sym->defined && sym->in_dso;
2257 +#endif /* Optimizing and not GCC 4.2. */
2259 #endif /* ld.h */
2260 diff --git a/src/readelf.c b/src/readelf.c
2261 --- a/src/readelf.c
2262 +++ b/src/readelf.c
2263 @@ -4274,10 +4274,11 @@
2264 #define listptr_offset_size(p) ((p)->dwarf64 ? 8 : 4)
2265 #define listptr_address_size(p) ((p)->addr64 ? 8 : 4)
2267 +static const char *listptr_name;
2268 static int
2269 -compare_listptr (const void *a, const void *b, void *arg)
2270 +compare_listptr (const void *a, const void *b)
2272 - const char *name = arg;
2273 + const char *const name = listptr_name;
2274 struct listptr *p1 = (void *) a;
2275 struct listptr *p2 = (void *) b;
2277 @@ -4357,8 +4358,11 @@
2278 sort_listptr (struct listptr_table *table, const char *name)
2280 if (table->n > 0)
2281 - qsort_r (table->table, table->n, sizeof table->table[0],
2282 - &compare_listptr, (void *) name);
2284 + listptr_name = name;
2285 + qsort (table->table, table->n, sizeof table->table[0],
2286 + &compare_listptr);
2290 static bool
2291 @@ -8098,7 +8102,7 @@
2292 if (unlikely (elf_rand (elf, as_off) == 0)
2293 || unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf))
2294 == NULL))
2295 -#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7)
2296 +#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7) || __GNUC__ < 4
2297 while (1)
2298 #endif
2299 error (EXIT_FAILURE, 0,
2300 diff --git a/src/strings.c b/src/strings.c
2301 --- a/src/strings.c
2302 +++ b/src/strings.c
2303 @@ -51,6 +51,10 @@
2305 #include <system.h>
2307 +#ifndef MAP_POPULATE
2308 +# define MAP_POPULATE 0
2309 +#endif
2312 /* Prototypes of local functions. */
2313 static int read_fd (int fd, const char *fname, off64_t fdlen);
2314 @@ -491,8 +495,13 @@
2315 fd, start_off);
2316 if (mem != MAP_FAILED)
2318 +#if !defined POSIX_MADV_SEQUENTIAL && defined MADV_SEQUENTIAL
2319 +# define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
2320 +#endif
2321 +#ifdef POSIX_MADV_SEQUENTIAL
2322 /* We will go through the mapping sequentially. */
2323 (void) posix_madvise (mem, map_size, POSIX_MADV_SEQUENTIAL);
2324 +#endif
2325 break;
2327 if (errno != EINVAL && errno != ENOMEM)
2328 @@ -584,9 +593,11 @@
2329 elfmap_off = from & ~(ps - 1);
2330 elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size);
2332 +#ifdef POSIX_FADV_SEQUENTIAL
2333 if (unlikely (elfmap == MAP_FAILED))
2334 /* Let the kernel know we are going to read everything in sequence. */
2335 (void) posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
2336 +#endif
2339 if (unlikely (elfmap == MAP_FAILED))
2340 diff --git a/src/strip.c b/src/strip.c
2341 --- a/src/strip.c
2342 +++ b/src/strip.c
2343 @@ -53,6 +53,12 @@
2344 #include <libebl.h>
2345 #include <system.h>
2347 +#ifdef HAVE_FUTIMES
2348 +# define FUTIMES(fd, fname, tvp) futimes (fd, tvp)
2349 +#else
2350 +# define FUTIMES(fd, fname, tvp) utimes (fname, tvp)
2351 +#endif
2354 /* Name and version of program. */
2355 static void print_version (FILE *stream, struct argp_state *state);
2356 @@ -311,8 +317,18 @@
2358 /* If we have to preserve the timestamp, we need it in the
2359 format utimes() understands. */
2360 +#ifdef HAVE_STRUCT_STAT_ST_ATIM
2361 TIMESPEC_TO_TIMEVAL (&tv[0], &pre_st.st_atim);
2362 +#else
2363 + tv[0].tv_sec = pre_st.st_atime;
2364 + tv[0].tv_usec = 0;
2365 +#endif
2366 +#ifdef HAVE_STRUCT_STAT_ST_MTIM
2367 TIMESPEC_TO_TIMEVAL (&tv[1], &pre_st.st_mtim);
2368 +#else
2369 + tv[1].tv_sec = pre_st.st_atime;
2370 + tv[1].tv_usec = 0;
2371 +#endif
2374 /* Open the file. */
2375 @@ -1809,7 +1825,7 @@
2376 /* If requested, preserve the timestamp. */
2377 if (tvp != NULL)
2379 - if (futimes (fd, tvp) != 0)
2380 + if (FUTIMES (fd, output_fname, tvp) != 0)
2382 error (0, errno, gettext ("\
2383 cannot set access and modification date of '%s'"),
2384 @@ -1866,7 +1882,7 @@
2386 if (tvp != NULL)
2388 - if (unlikely (futimes (fd, tvp) != 0))
2389 + if (unlikely (FUTIMES (fd, fname, tvp) != 0))
2391 error (0, errno, gettext ("\
2392 cannot set access and modification date of '%s'"), fname);
2393 diff --git a/tests/ChangeLog b/tests/ChangeLog
2394 --- a/tests/ChangeLog
2395 +++ b/tests/ChangeLog
2396 @@ -205,6 +205,8 @@
2398 2008-01-21 Roland McGrath <roland@redhat.com>
2400 + * line2addr.c (main): Revert last change.
2402 * testfile45.S.bz2: Add tests for cltq, cqto.
2403 * testfile45.expect.bz2: Adjust.
2405 @@ -913,6 +915,11 @@
2406 * Makefile.am (TESTS): Add run-elflint-test.sh.
2407 (EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2.
2409 +2005-05-31 Roland McGrath <roland@redhat.com>
2411 + * Makefile.am (WEXTRA): New variable, substituted by configure.
2412 + (AM_CFLAGS): Use it in place of -Wextra.
2414 2005-05-24 Ulrich Drepper <drepper@redhat.com>
2416 * get-files.c (main): Use correct format specifier.
2417 diff --git a/tests/Makefile.in b/tests/Makefile.in
2418 --- a/tests/Makefile.in
2419 +++ b/tests/Makefile.in
2420 @@ -372,6 +372,7 @@
2421 INSTALL_SCRIPT = @INSTALL_SCRIPT@
2422 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
2423 LDFLAGS = @LDFLAGS@
2424 +LD_AS_NEEDED = @LD_AS_NEEDED@
2425 LEX = @LEX@
2426 LEXLIB = @LEXLIB@
2427 LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
2428 @@ -401,6 +402,7 @@
2429 STRIP = @STRIP@
2430 USE_NLS = @USE_NLS@
2431 VERSION = @VERSION@
2432 +WEXTRA = @WEXTRA@
2433 XGETTEXT = @XGETTEXT@
2434 XGETTEXT_015 = @XGETTEXT_015@
2435 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
2436 @@ -461,8 +463,8 @@
2437 zip_LIBS = @zip_LIBS@
2438 INCLUDES = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. $(am__append_2)
2439 AM_CFLAGS = -std=gnu99 -Wall -Wshadow $(if \
2440 - $($(*F)_no_Werror),,-Werror) $(if \
2441 - $($(*F)_no_Wunused),,-Wunused -Wextra) $(if \
2442 + $($(*F)_no_Werror),,) $(if \
2443 + $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) $(if \
2444 $($(*F)_no_Wformat),-Wno-format,-Wformat=2) $($(*F)_CFLAGS) \
2445 $(am__append_1)
2446 @MUDFLAP_FALSE@libmudflap =
2447 diff --git a/tests/line2addr.c b/tests/line2addr.c
2448 --- a/tests/line2addr.c
2449 +++ b/tests/line2addr.c
2450 @@ -132,7 +132,7 @@
2452 struct args a = { .arg = argv[cnt] };
2454 - switch (sscanf (a.arg, "%m[^:]:%d", &a.file, &a.line))
2455 + switch (sscanf (a.arg, "%a[^:]:%d", &a.file, &a.line))
2457 default:
2458 case 0: