summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/elfutils/elfutils-0.161/redhat-portability.diff
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/elfutils/elfutils-0.161/redhat-portability.diff')
-rw-r--r--meta/recipes-devtools/elfutils/elfutils-0.161/redhat-portability.diff1055
1 files changed, 1055 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils-0.161/redhat-portability.diff b/meta/recipes-devtools/elfutils/elfutils-0.161/redhat-portability.diff
new file mode 100644
index 0000000000..08f25a53eb
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.161/redhat-portability.diff
@@ -0,0 +1,1055 @@
1Rebase to 1.161
2
3Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
4---
5 ChangeLog | 30 +++++++++++++++++++++++
6 backends/ChangeLog | 12 +++++++++
7 backends/Makefile.am | 2 +-
8 config/ChangeLog | 4 +++
9 config/eu.am | 14 ++++++++---
10 configure.ac | 60 +++++++++++++++++++++++++++++++++++++++++++--
11 lib/ChangeLog | 8 ++++++
12 lib/eu-config.h | 11 +++++++++
13 libasm/ChangeLog | 5 ++++
14 libcpu/ChangeLog | 8 ++++++
15 libcpu/i386_disasm.c | 1 +
16 libdw/ChangeLog | 13 ++++++++++
17 libdw/dwarf_begin_elf.c | 8 ++++++
18 libdw/libdw.h | 2 +-
19 libdwfl/ChangeLog | 20 +++++++++++++++
20 libdwfl/linux-core-attach.c | 29 ++++++++++++++++++++++
21 libdwfl/linux-pid-attach.c | 14 +++++++++++
22 libebl/ChangeLog | 5 ++++
23 libelf/ChangeLog | 10 ++++++++
24 libelf/common.h | 4 +--
25 libelf/gnuhash_xlate.h | 6 +++--
26 src/ChangeLog | 30 +++++++++++++++++++++++
27 src/Makefile.am | 5 ++++
28 src/addr2line.c | 4 +--
29 src/findtextrel.c | 6 ++++-
30 src/ld.h | 2 ++
31 src/readelf.c | 15 ++++++++----
32 src/strings.c | 11 +++++++++
33 src/strip.c | 20 +++++++++++++--
34 tests/ChangeLog | 14 +++++++++++
35 tests/Makefile.am | 1 +
36 tests/backtrace.c | 1 +
37 tests/line2addr.c | 2 +-
38 33 files changed, 355 insertions(+), 22 deletions(-)
39
40diff --git a/ChangeLog b/ChangeLog
41index f81b302..3f9eaf1 100644
42--- a/ChangeLog
43+++ b/ChangeLog
44@@ -187,6 +187,8 @@
45
46 2012-01-24 Mark Wielaard <mjw@redhat.com>
47
48+ * configure.ac: Wrap AC_COMPILE_IFELSE sources in AC_LANG_SOURCE.
49+
50 * COPYING: Fix address. Updated version from gnulib.
51
52 2012-01-23 Mark Wielaard <mjw@redhat.com>
53@@ -205,6 +207,9 @@
54
55 2011-10-08 Mike Frysinger <vapier@gentoo.org>
56
57+ * configure.ac (--disable-werror): Handle it, controlling BUILD_WERROR
58+ automake option.
59+
60 * configure.ac: Fix use of AC_ARG_ENABLE to handle $enableval correctly.
61
62 2011-10-02 Ulrich Drepper <drepper@gmail.com>
63@@ -226,6 +231,10 @@
64
65 * configure.ac (LOCALEDIR, DATADIRNAME): Removed.
66
67+2009-11-22 Roland McGrath <roland@redhat.com>
68+
69+ * configure.ac: Use sed and expr instead of modern bash extensions.
70+
71 2009-09-21 Ulrich Drepper <drepper@redhat.com>
72
73 * configure.ac: Update for more modern autoconf.
74@@ -234,6 +243,10 @@
75
76 * configure.ac (zip_LIBS): Check for liblzma too.
77
78+2009-08-17 Roland McGrath <roland@redhat.com>
79+
80+ * configure.ac: Check for -fgnu89-inline; add it to WEXTRA if it works.
81+
82 2009-04-19 Roland McGrath <roland@redhat.com>
83
84 * configure.ac (eu_version): Round down here, not in version.h macros.
85@@ -245,6 +258,8 @@
86
87 2009-01-23 Roland McGrath <roland@redhat.com>
88
89+ * configure.ac: Check for __builtin_popcount.
90+
91 * configure.ac (zlib check): Check for gzdirect, need zlib >= 1.2.2.3.
92
93 * configure.ac (__thread check): Use AC_LINK_IFELSE, in case of
94@@ -325,6 +340,10 @@
95 * configure.ac: Add dummy automake conditional to get dependencies
96 for non-generic linker right. See src/Makefile.am.
97
98+2005-11-22 Roland McGrath <roland@redhat.com>
99+
100+ * configure.ac: Check for --as-needed linker option.
101+
102 2005-11-18 Roland McGrath <roland@redhat.com>
103
104 * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): New variable.
105@@ -372,6 +391,17 @@
106 * Makefile.am (all_SUBDIRS): Add libdwfl.
107 * configure.ac: Write libdwfl/Makefile.
108
109+2005-05-31 Roland McGrath <roland@redhat.com>
110+
111+ * configure.ac (WEXTRA): Check for -Wextra and set this substitution.
112+
113+ * configure.ac: Check for struct stat st_?tim members.
114+ * src/strip.c (process_file): Use st_?time if st_?tim are not there.
115+
116+ * configure.ac: Check for futimes function.
117+ * src/strip.c (handle_elf) [! HAVE_FUTIMES]: Use utimes instead.
118+ (handle_ar) [! HAVE_FUTIMES]: Likewise.
119+
120 2005-05-19 Roland McGrath <roland@redhat.com>
121
122 * configure.ac [AH_BOTTOM] (INTDECL, _INTDECL): New macros.
123diff --git a/backends/ChangeLog b/backends/ChangeLog
124index e800d16..6a86248 100644
125--- a/backends/ChangeLog
126+++ b/backends/ChangeLog
127@@ -433,6 +433,10 @@
128 * ppc_attrs.c (ppc_check_object_attribute): Handle tag
129 GNU_Power_ABI_Struct_Return.
130
131+2009-01-23 Roland McGrath <roland@redhat.com>
132+
133+ * Makefile.am (libebl_%.so): Use $(LD_AS_NEEDED).
134+
135 2008-10-04 Ulrich Drepper <drepper@redhat.com>
136
137 * i386_reloc.def: Fix entries for TLS_GOTDESC, TLS_DESC_CALL, and
138@@ -760,6 +764,11 @@
139 * sparc_init.c: Likewise.
140 * x86_64_init.c: Likewise.
141
142+2005-11-22 Roland McGrath <roland@redhat.com>
143+
144+ * Makefile.am (LD_AS_NEEDED): New variable, substituted by configure.
145+ (libebl_%.so rule): Use it in place of -Wl,--as-needed.
146+
147 2005-11-19 Roland McGrath <roland@redhat.com>
148
149 * ppc64_reloc.def: REL30 -> ADDR30.
150@@ -782,6 +791,9 @@
151 * Makefile.am (uninstall): Don't try to remove $(pkgincludedir).
152 (CLEANFILES): Add libebl_$(m).so.
153
154+ * Makefile.am (WEXTRA): New variable, substituted by configure.
155+ (AM_CFLAGS): Use it in place of -Wextra.
156+
157 * ppc_reloc.def: Update bits per Alan Modra <amodra@bigpond.net.au>.
158 * ppc64_reloc.def: Likewise.
159
160diff --git a/backends/Makefile.am b/backends/Makefile.am
161index 4d15a5d..507c9df 100644
162--- a/backends/Makefile.am
163+++ b/backends/Makefile.am
164@@ -131,7 +131,7 @@ libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw)
165 $(LINK) -shared -o $(@:.map=.so) \
166 -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
167 -Wl,--version-script,$(@:.so=.map) \
168- -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw)
169+ -Wl,-z,defs $(LD_AS_NEEDED) $(libelf) $(libdw)
170 @$(textrel_check)
171
172 libebl_i386.so: $(cpu_i386)
173diff --git a/config/ChangeLog b/config/ChangeLog
174index 1b4e896..058dd88 100644
175--- a/config/ChangeLog
176+++ b/config/ChangeLog
177@@ -71,6 +71,10 @@
178
179 * known-dwarf.awk: Use gawk.
180
181+2011-10-08 Mike Frysinger <vapier@gentoo.org>
182+
183+ * eu.am [BUILD_WERROR]: Conditionalize -Werror use on this.
184+
185 2010-07-02 Ulrich Drepper <drepper@redhat.com>
186
187 * elfutils.spec.in: Add more BuildRequires.
188diff --git a/config/eu.am b/config/eu.am
189index faf8add..6ca36a5 100644
190--- a/config/eu.am
191+++ b/config/eu.am
192@@ -1,6 +1,6 @@
193 ## Common automake fragments for elfutils subdirectory makefiles.
194 ##
195-## Copyright (C) 2010, 2014 Red Hat, Inc.
196+## Copyright (C) 2010-2011, 2014 Red Hat, Inc.
197 ##
198 ## This file is part of elfutils.
199 ##
200@@ -29,13 +29,21 @@
201 ## not, see <http://www.gnu.org/licenses/>.
202 ##
203
204+WEXTRA = @WEXTRA@
205+LD_AS_NEEDED = @LD_AS_NEEDED@
206+
207 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
208 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
209-AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
210+AM_CFLAGS = -std=gnu99 -Wall -Wshadow \
211 $(if $($(*F)_no_Werror),,-Werror) \
212- $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
213+ $(if $($(*F)_no_Wunused),,-Wunused $(WEXTRA)) \
214+ $(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2) \
215 $($(*F)_CFLAGS)
216
217+if BUILD_WERROR
218+AM_CFLAGS += $(if $($(*F)_no_Werror),,-Werror)
219+endif
220+
221 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
222
223 %.os: %.c %.o
224diff --git a/configure.ac b/configure.ac
225index 0e67a79..a1ad6db 100644
226--- a/configure.ac
227+++ b/configure.ac
228@@ -89,6 +89,54 @@ CFLAGS="$old_CFLAGS"])
229 AS_IF([test "x$ac_cv_c99" != xyes],
230 AC_MSG_ERROR([gcc with C99 support required]))
231
232+AC_CACHE_CHECK([for -Wextra option to $CC], ac_cv_cc_wextra, [dnl
233+old_CFLAGS="$CFLAGS"
234+CFLAGS="$CFLAGS -Wextra"
235+AC_COMPILE_IFELSE([AC_LANG_SOURCE([void foo (void) { }])],
236+ ac_cv_cc_wextra=yes, ac_cv_cc_wextra=no)
237+CFLAGS="$old_CFLAGS"])
238+AC_SUBST(WEXTRA)
239+AS_IF([test "x$ac_cv_cc_wextra" = xyes], [WEXTRA=-Wextra], [WEXTRA=-W])
240+
241+AC_CACHE_CHECK([for -fgnu89-inline option to $CC], ac_cv_cc_gnu89_inline, [dnl
242+old_CFLAGS="$CFLAGS"
243+CFLAGS="$CFLAGS -fgnu89-inline -Werror"
244+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
245+void foo (void)
246+{
247+ inline void bar (void) {}
248+ bar ();
249+}
250+extern inline void baz (void) {}
251+])], ac_cv_cc_gnu89_inline=yes, ac_cv_cc_gnu89_inline=no)
252+CFLAGS="$old_CFLAGS"])
253+AS_IF([test "x$ac_cv_cc_gnu89_inline" = xyes],
254+ [WEXTRA="${WEXTRA:+$WEXTRA }-fgnu89-inline"])
255+
256+AC_CACHE_CHECK([for --as-needed linker option],
257+ ac_cv_as_needed, [dnl
258+cat > conftest.c <<EOF
259+int main (void) { return 0; }
260+EOF
261+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
262+ -fPIC -shared -o conftest.so conftest.c
263+ -Wl,--as-needed 1>&AS_MESSAGE_LOG_FD])
264+then
265+ ac_cv_as_needed=yes
266+else
267+ ac_cv_as_needed=no
268+fi
269+rm -f conftest*])
270+AS_IF([test "x$ac_cv_as_needed" = xyes],
271+ [LD_AS_NEEDED=-Wl,--as-needed], [LD_AS_NEEDED=])
272+AC_SUBST(LD_AS_NEEDED)
273+
274+AC_CACHE_CHECK([for __builtin_popcount], ac_cv_popcount, [dnl
275+AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[exit (__builtin_popcount (127));]])],
276+ ac_cv_popcount=yes, ac_cv_popcount=no)])
277+AS_IF([test "x$ac_cv_popcount" = xyes],
278+ [AC_DEFINE([HAVE_BUILTIN_POPCOUNT], [1], [Have __builtin_popcount.])])
279+
280 AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
281 # Use the same flags that we use for our DSOs, so the test is representative.
282 # Some old compiler/linker/libc combinations fail some ways and not others.
283@@ -104,7 +152,10 @@ static __thread int a; int foo (int b) { return a + b; }]],
284 CFLAGS="$save_CFLAGS"
285 LDFLAGS="$save_LDFLAGS"])
286 AS_IF([test "x$ac_cv_tls" != xyes],
287- AC_MSG_ERROR([__thread support required]))
288+ [AS_IF([test "$use_locks" = yes],
289+ [AC_MSG_ERROR([--enable-thread-safety requires __thread support])],
290+ [AC_DEFINE([__thread], [/* empty: no multi-thread support */],
291+ [Stubbed out if missing compiler support.])])])
292
293 dnl This test must come as early as possible after the compiler configuration
294 dnl tests, because the choice of the file model can (in principle) affect
295@@ -183,6 +234,11 @@ AM_CONDITIONAL(USE_VALGRIND, test "$use_valgrind" = yes)
296 AM_CONDITIONAL(BUILD_STATIC, [dnl
297 test "$use_gprof" = yes -o "$use_gcov" = yes])
298
299+AC_ARG_ENABLE([werror],
300+AS_HELP_STRING([--disable-werror],[do not build with -Werror]),
301+ [enable_werror=$enableval], [enable_werror=yes])
302+AM_CONDITIONAL(BUILD_WERROR, test "$enable_werror" = yes)
303+
304 AC_ARG_ENABLE([tests-rpath],
305 AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
306 [tests_use_rpath=$enableval], [tests_use_rpath=no])
307@@ -302,7 +358,7 @@ case "$eu_version" in
308 esac
309
310 # Round up to the next release API (x.y) version.
311-eu_version=$(( (eu_version + 999) / 1000 ))
312+eu_version=`expr \( $eu_version + 999 \) / 1000`
313
314 AC_CHECK_SIZEOF(long)
315
316diff --git a/lib/ChangeLog b/lib/ChangeLog
317index 4415213..4911cc1 100644
318--- a/lib/ChangeLog
319+++ b/lib/ChangeLog
320@@ -65,6 +65,9 @@
321
322 2009-01-23 Roland McGrath <roland@redhat.com>
323
324+ * eu-config.h [! HAVE_BUILTIN_POPCOUNT]
325+ (__builtin_popcount): New inline function.
326+
327 * eu-config.h: Add multiple inclusion protection.
328
329 2009-01-17 Ulrich Drepper <drepper@redhat.com>
330@@ -121,6 +124,11 @@
331 * Makefile.am (libeu_a_SOURCES): Add it.
332 * system.h: Declare crc32_file.
333
334+2005-02-07 Roland McGrath <roland@redhat.com>
335+
336+ * Makefile.am (WEXTRA): New variable, substituted by configure.
337+ (AM_CFLAGS): Use it in place of -Wextra.
338+
339 2005-04-30 Ulrich Drepper <drepper@redhat.com>
340
341 * Makefile.am: Use -ffunction-sections for xmalloc.c.
342diff --git a/lib/eu-config.h b/lib/eu-config.h
343index 3afff26..d89f3a8 100644
344--- a/lib/eu-config.h
345+++ b/lib/eu-config.h
346@@ -162,6 +162,17 @@ asm (".section predict_data, \"aw\"; .previous\n"
347 /* This macro is used by the tests conditionalize for standalone building. */
348 #define ELFUTILS_HEADER(name) <lib##name.h>
349
350+#ifndef HAVE_BUILTIN_POPCOUNT
351+# define __builtin_popcount hakmem_popcount
352+static inline unsigned int __attribute__ ((unused))
353+hakmem_popcount (unsigned int x)
354+{
355+ /* HAKMEM 169 */
356+ unsigned int n = x - ((x >> 1) & 033333333333) - ((x >> 2) & 011111111111);
357+ return ((n + (n >> 3)) & 030707070707) % 63;
358+}
359+#endif /* HAVE_BUILTIN_POPCOUNT */
360+
361
362 #ifdef SHARED
363 # define OLD_VERSION(name, version) \
364diff --git a/libasm/ChangeLog b/libasm/ChangeLog
365index 9b25af9..32b9fd0 100644
366--- a/libasm/ChangeLog
367+++ b/libasm/ChangeLog
368@@ -87,6 +87,11 @@
369 * asm_error.c: Add new error ASM_E_IOERROR.
370 * libasmP.h: Add ASM_E_IOERROR definition.
371
372+2005-05-31 Roland McGrath <roland@redhat.com>
373+
374+ * Makefile.am (WEXTRA): New variable, substituted by configure.
375+ (AM_CFLAGS): Use it in place of -Wextra.
376+
377 2005-02-15 Ulrich Drepper <drepper@redhat.com>
378
379 * Makefile.am (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
380diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog
381index a20f440..5ea23b7 100644
382--- a/libcpu/ChangeLog
383+++ b/libcpu/ChangeLog
384@@ -51,6 +51,9 @@
385
386 2009-01-23 Roland McGrath <roland@redhat.com>
387
388+ * i386_disasm.c (i386_disasm): Add abort after assert-constant for old
389+ compilers that don't realize it's noreturn.
390+
391 * Makefile.am (i386_parse_CFLAGS): Use quotes around command
392 substitution that can produce leading whitespace.
393
394@@ -380,6 +383,11 @@
395 * defs/i386.doc: New file.
396 * defs/x86_64: New file.
397
398+2005-04-04 Roland McGrath <roland@redhat.com>
399+
400+ * Makefile.am (WEXTRA): New variable, substituted by configure.
401+ (AM_CFLAGS): Use it instead of -Wextra.
402+
403 2005-02-15 Ulrich Drepper <drepper@redhat.com>
404
405 * Makefile (AM_CFLAGS): Add -Wunused -Wextra -Wformat=2.
406diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
407index 832241f..c7a0df0 100644
408--- a/libcpu/i386_disasm.c
409+++ b/libcpu/i386_disasm.c
410@@ -822,6 +822,7 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr,
411
412 default:
413 assert (! "INVALID not handled");
414+ abort ();
415 }
416 }
417 else
418diff --git a/libdw/ChangeLog b/libdw/ChangeLog
419index abc2d71..a9ee0b0 100644
420--- a/libdw/ChangeLog
421+++ b/libdw/ChangeLog
422@@ -717,6 +717,10 @@
423
424 * Makefile.am (known-dwarf.h): Run gawk on config/known-dwarf.awk.
425
426+2011-07-20 Mark Wielaard <mjw@redhat.com>
427+
428+ * dwarf_begin_elf.c: Add fallback for be64toh if not defined.
429+
430 2011-07-14 Mark Wielaard <mjw@redhat.com>
431
432 * libdw.h (dwarf_offdie): Fix documentation to mention .debug_info.
433@@ -1076,6 +1080,10 @@
434
435 * dwarf_hasattr_integrate.c: Integrate DW_AT_specification too.
436
437+2009-08-17 Roland McGrath <roland@redhat.com>
438+
439+ * libdw.h: Disable extern inlines for GCC 4.2.
440+
441 2009-08-10 Roland McGrath <roland@redhat.com>
442
443 * dwarf_getscopevar.c: Use dwarf_diename.
444@@ -1844,6 +1852,11 @@
445
446 2005-05-31 Roland McGrath <roland@redhat.com>
447
448+ * Makefile.am (WEXTRA): New variable, substituted by configure.
449+ (AM_CFLAGS): Use it in place of -Wextra.
450+
451+2005-05-31 Roland McGrath <roland@redhat.com>
452+
453 * dwarf_formref_die.c (dwarf_formref_die): Add CU header offset to
454 formref offset.
455
456diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
457index 4c49ce2..7ea1430 100644
458--- a/libdw/dwarf_begin_elf.c
459+++ b/libdw/dwarf_begin_elf.c
460@@ -47,6 +47,14 @@
461 #if USE_ZLIB
462 # include <endian.h>
463 # define crc32 loser_crc32
464+# ifndef be64toh
465+# include <byteswap.h>
466+# if __BYTE_ORDER == __LITTLE_ENDIAN
467+# define be64toh(x) bswap_64 (x)
468+# else
469+# define be64toh(x) (x)
470+# endif
471+# endif
472 # include <zlib.h>
473 # undef crc32
474 #endif
475diff --git a/libdw/libdw.h b/libdw/libdw.h
476index b2b2282..722c589 100644
477--- a/libdw/libdw.h
478+++ b/libdw/libdw.h
479@@ -1003,7 +1003,7 @@ extern Dwarf_OOM dwarf_new_oom_handler (Dwarf *dbg, Dwarf_OOM handler);
480
481
482 /* Inline optimizations. */
483-#ifdef __OPTIMIZE__
484+#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
485 /* Return attribute code of given attribute. */
486 __libdw_extern_inline unsigned int
487 dwarf_whatattr (Dwarf_Attribute *attr)
488diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
489index 69e59a6..15c2987 100644
490--- a/libdwfl/ChangeLog
491+++ b/libdwfl/ChangeLog
492@@ -571,6 +571,21 @@
493 (dwfl_module_addrsym) (i_to_symfile): New function.
494 (dwfl_module_addrsym) (search_table): Use it.
495
496+2013-11-09 Jan Kratochvil <jan.kratochvil@redhat.com>
497+
498+ Older OS compatibility bits.
499+ * linux-core-attach.c (be64toh, le64toh, be32toh, le32toh): Provide
500+ fallbacks if not defined by system.
501+
502+2013-11-09 Jan Kratochvil <jan.kratochvil@redhat.com>
503+
504+ Handle T-stopped detach for old kernels.
505+ * linux-pid-attach.c (struct pid_arg): New field stopped.
506+ (ptrace_attach): New parameter stoppedp. Set it appropriately.
507+ (pid_set_initial_registers): Pass the new field.
508+ (pid_thread_detach): Handle the case of STOPPED for old kernels.
509+ (__libdwfl_attach_state_for_pid): Initialize STOPPED.
510+
511 2013-11-07 Jan Kratochvil <jan.kratochvil@redhat.com>
512 Mark Wielaard <mjw@redhat.com>
513
514@@ -2336,6 +2351,11 @@
515
516 2005-07-21 Roland McGrath <roland@redhat.com>
517
518+ * Makefile.am (WEXTRA): New variable, substituted by configure.
519+ (AM_CFLAGS): Use it in place of -Wextra.
520+
521+2005-07-21 Roland McGrath <roland@redhat.com>
522+
523 * Makefile.am (noinst_HEADERS): Add loc2c.c.
524
525 * test2.c (main): Check sscanf result to quiet warning.
526diff --git a/libdwfl/linux-core-attach.c b/libdwfl/linux-core-attach.c
527index 5a7b3b3..d05ac7e 100644
528--- a/libdwfl/linux-core-attach.c
529+++ b/libdwfl/linux-core-attach.c
530@@ -29,6 +29,35 @@
531 #include "libdwflP.h"
532 #include <fcntl.h>
533 #include "system.h"
534+#include <endian.h>
535+#include <byteswap.h>
536+#if __BYTE_ORDER == __LITTLE_ENDIAN
537+# ifndef be64toh
538+# define be64toh(x) bswap_64 (x)
539+# endif
540+# ifndef le64toh
541+# define le64toh(x) (x)
542+# endif
543+# ifndef be32toh
544+# define be32toh(x) bswap_32 (x)
545+# endif
546+# ifndef le32toh
547+# define le32toh(x) (x)
548+# endif
549+#else
550+# ifndef be64toh
551+# define be64toh(x) (x)
552+# endif
553+# ifndef le64toh
554+# define le64toh(x) bswap_64 (x)
555+# endif
556+# ifndef be32toh
557+# define be32toh(x) (x)
558+# endif
559+# ifndef le32toh
560+# define le32toh(x) bswap_32 (x)
561+# endif
562+#endif
563
564 #include "../libdw/memory-access.h"
565
566diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
567index efbcf03..ae5af38 100644
568--- a/libdwfl/linux-pid-attach.c
569+++ b/libdwfl/linux-pid-attach.c
570@@ -255,6 +255,11 @@ void
571 internal_function
572 __libdwfl_ptrace_detach (pid_t tid, bool tid_was_stopped)
573 {
574+ // Older kernels (tested kernel-2.6.18-348.12.1.el5.x86_64) need special
575+ // handling of the detachment to keep the process State: T (stopped).
576+ if (tid_was_stopped)
577+ syscall (__NR_tkill, tid, SIGSTOP);
578+
579 /* This handling is needed only on older Linux kernels such as
580 2.6.32-358.23.2.el6.ppc64. Later kernels such as
581 3.11.7-200.fc19.x86_64 remember the T (stopped) state
582@@ -262,6 +267,15 @@ __libdwfl_ptrace_detach (pid_t tid, bool tid_was_stopped)
583 PTRACE_DETACH. */
584 ptrace (PTRACE_DETACH, tid, NULL,
585 (void *) (intptr_t) (tid_was_stopped ? SIGSTOP : 0));
586+
587+ if (tid_was_stopped)
588+ {
589+ // Wait till the SIGSTOP settles down.
590+ int i;
591+ for (i = 0; i < 100000; i++)
592+ if (linux_proc_pid_is_stopped (tid))
593+ break;
594+ }
595 }
596
597 static void
598diff --git a/libebl/ChangeLog b/libebl/ChangeLog
599index 5e635f2..998544f 100644
600--- a/libebl/ChangeLog
601+++ b/libebl/ChangeLog
602@@ -765,6 +765,11 @@
603 * Makefile.am (libebl_*_so_SOURCES): Set to $(*_SRCS) so dependency
604 tracking works right.
605
606+2005-05-31 Roland McGrath <roland@redhat.com>
607+
608+ * Makefile.am (WEXTRA): New variable, substituted by configure.
609+ (AM_CFLAGS): Use it in place of -Wextra.
610+
611 2005-05-21 Ulrich Drepper <drepper@redhat.com>
612
613 * libebl_x86_64.map: Add x86_64_core_note.
614diff --git a/libelf/ChangeLog b/libelf/ChangeLog
615index 3b88d03..cb6cad5 100644
616--- a/libelf/ChangeLog
617+++ b/libelf/ChangeLog
618@@ -244,6 +244,11 @@
619
620 * elf-knowledge.h (SECTION_STRIP_P): Remove < SHT_NUM check.
621
622+2011-03-10 Roland McGrath <roland@redhat.com>
623+
624+ * gnuhash_xlate.h (elf_cvt_gnuhash): Avoid post-increment in bswap_32
625+ argument, since some implementations are buggy macros.
626+
627 2011-02-26 Mark Wielaard <mjw@redhat.com>
628
629 * elf_end.c (elf_end): Call rwlock_unlock before rwlock_fini.
630@@ -921,6 +926,11 @@
631
632 * elf.h: Update from glibc.
633
634+2005-05-31 Roland McGrath <roland@redhat.com>
635+
636+ * Makefile.am (WEXTRA): New variable, substituted by configure.
637+ (AM_CFLAGS): Use it in place of -Wextra.
638+
639 2005-05-08 Roland McGrath <roland@redhat.com>
640
641 * elf_begin.c (read_file) [_MUDFLAP]: Don't use mmap for now.
642diff --git a/libelf/common.h b/libelf/common.h
643index 744f1bb..185ea59 100644
644--- a/libelf/common.h
645+++ b/libelf/common.h
646@@ -139,7 +139,7 @@ libelf_release_all (Elf *elf)
647 (Var) = (sizeof (Var) == 1 \
648 ? (unsigned char) (Var) \
649 : (sizeof (Var) == 2 \
650- ? bswap_16 (Var) \
651+ ? (unsigned short int) bswap_16 (Var) \
652 : (sizeof (Var) == 4 \
653 ? bswap_32 (Var) \
654 : bswap_64 (Var))))
655@@ -148,7 +148,7 @@ libelf_release_all (Elf *elf)
656 (Dst) = (sizeof (Var) == 1 \
657 ? (unsigned char) (Var) \
658 : (sizeof (Var) == 2 \
659- ? bswap_16 (Var) \
660+ ? (unsigned short int) bswap_16 (Var) \
661 : (sizeof (Var) == 4 \
662 ? bswap_32 (Var) \
663 : bswap_64 (Var))))
664diff --git a/libelf/gnuhash_xlate.h b/libelf/gnuhash_xlate.h
665index 04d9ca1..3e25936 100644
666--- a/libelf/gnuhash_xlate.h
667+++ b/libelf/gnuhash_xlate.h
668@@ -1,5 +1,5 @@
669 /* Conversion functions for versioning information.
670- Copyright (C) 2006, 2007 Red Hat, Inc.
671+ Copyright (C) 2006-2011 Red Hat, Inc.
672 This file is part of elfutils.
673 Written by Ulrich Drepper <drepper@redhat.com>, 2006.
674
675@@ -69,7 +69,9 @@ elf_cvt_gnuhash (void *dest, const void *src, size_t len, int encode)
676 dest32 = (Elf32_Word *) &dest64[bitmask_words];
677 while (len >= 4)
678 {
679- *dest32++ = bswap_32 (*src32++);
680+ *dest32 = bswap_32 (*src32);
681+ ++dest32;
682+ ++src32;
683 len -= 4;
684 }
685 }
686diff --git a/src/ChangeLog b/src/ChangeLog
687index 0ae863e..1162f6e 100644
688--- a/src/ChangeLog
689+++ b/src/ChangeLog
690@@ -1371,8 +1371,16 @@
691 * readelf.c (attr_callback): Use print_block only when we don't use
692 print_ops.
693
694+2009-08-17 Roland McGrath <roland@redhat.com>
695+
696+ * ld.h: Disable extern inlines for GCC 4.2.
697+
698 2009-08-14 Roland McGrath <roland@redhat.com>
699
700+ * strings.c (read_block): Conditionalize posix_fadvise use
701+ on [POSIX_FADV_SEQUENTIAL].
702+ From Petr Salinger <Petr.Salinger@seznam.cz>.
703+
704 * ar.c (do_oper_extract): Use pathconf instead of statfs.
705
706 2009-08-01 Ulrich Drepper <drepper@redhat.com>
707@@ -1536,6 +1544,8 @@
708 * readelf.c (print_debug_frame_section): Use t instead of j formats
709 for ptrdiff_t OFFSET.
710
711+ * addr2line.c (handle_address): Use %a instead of %m for compatibility.
712+
713 2009-01-21 Ulrich Drepper <drepper@redhat.com>
714
715 * elflint.c (check_program_header): Fix typo in .eh_frame_hdr section
716@@ -1719,6 +1729,11 @@
717 that matches its PT_LOAD's p_flags &~ PF_W. On sparc, PF_X really
718 is valid in RELRO.
719
720+2008-03-01 Roland McGrath <roland@redhat.com>
721+
722+ * readelf.c (dump_archive_index): Tweak portability hack
723+ to match [__GNUC__ < 4] too.
724+
725 2008-02-29 Roland McGrath <roland@redhat.com>
726
727 * readelf.c (print_attributes): Add a cast.
728@@ -1970,6 +1985,8 @@
729
730 * readelf.c (hex_dump): Fix rounding error in whitespace calculation.
731
732+ * Makefile.am (readelf_no_Werror): New variable.
733+
734 2007-10-15 Roland McGrath <roland@redhat.com>
735
736 * make-debug-archive.in: New file.
737@@ -2409,6 +2426,10 @@
738 * elflint.c (valid_e_machine): Add EM_ALPHA.
739 Reported by Christian Aichinger <Greek0@gmx.net>.
740
741+ * strings.c (map_file): Define POSIX_MADV_SEQUENTIAL to
742+ MADV_SEQUENTIAL if undefined. Don't call posix_madvise
743+ if neither is defined.
744+
745 2006-08-08 Ulrich Drepper <drepper@redhat.com>
746
747 * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
748@@ -2485,6 +2506,10 @@
749 * Makefile.am: Add hacks to create dependency files for non-generic
750 linker.
751
752+2006-04-05 Roland McGrath <roland@redhat.com>
753+
754+ * strings.c (MAP_POPULATE): Define to 0 if undefined.
755+
756 2006-06-12 Ulrich Drepper <drepper@redhat.com>
757
758 * ldgeneric.c (ld_generic_generate_sections): Don't create .interp
759@@ -2833,6 +2858,11 @@
760 * readelf.c (print_debug_loc_section): Fix indentation for larger
761 address size.
762
763+2005-05-31 Roland McGrath <roland@redhat.com>
764+
765+ * Makefile.am (WEXTRA): New variable, substituted by configure.
766+ (AM_CFLAGS): Use it in place of -Wextra.
767+
768 2005-05-30 Roland McGrath <roland@redhat.com>
769
770 * readelf.c (print_debug_line_section): Print section offset of each
771diff --git a/src/Makefile.am b/src/Makefile.am
772index 4f198da..a612cf6 100644
773--- a/src/Makefile.am
774+++ b/src/Makefile.am
775@@ -89,6 +89,11 @@ endif
776 # XXX While the file is not finished, don't warn about this
777 ldgeneric_no_Wunused = yes
778
779+# Buggy old compilers or libc headers.
780+readelf_no_Werror = yes
781+strings_no_Werror = yes
782+addr2line_no_Wformat = yes
783+
784 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl
785 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl \
786 $(demanglelib)
787diff --git a/src/addr2line.c b/src/addr2line.c
788index de80294..e982982 100644
789--- a/src/addr2line.c
790+++ b/src/addr2line.c
791@@ -540,10 +540,10 @@ handle_address (const char *string, Dwfl *dwfl)
792 bool parsed = false;
793 int i, j;
794 char *name = NULL;
795- if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
796+ if (sscanf (string, "(%a[^)])%" PRIiMAX "%n", &name, &addr, &i) == 2
797 && string[i] == '\0')
798 parsed = adjust_to_section (name, &addr, dwfl);
799- switch (sscanf (string, "%m[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
800+ switch (sscanf (string, "%a[^-+]%n%" PRIiMAX "%n", &name, &i, &addr, &j))
801 {
802 default:
803 break;
804diff --git a/src/findtextrel.c b/src/findtextrel.c
805index 264a06b..d7de202 100644
806--- a/src/findtextrel.c
807+++ b/src/findtextrel.c
808@@ -502,7 +502,11 @@ ptrcompare (const void *p1, const void *p2)
809
810
811 static void
812-check_rel (size_t nsegments, struct segments segments[nsegments],
813+check_rel (size_t nsegments, struct segments segments[
814+#if __GNUC__ >= 4
815+ nsegments
816+#endif
817+ ],
818 GElf_Addr addr, Elf *elf, Elf_Scn *symscn, Dwarf *dw,
819 const char *fname, bool more_than_one, void **knownsrcs)
820 {
821diff --git a/src/ld.h b/src/ld.h
822index 29f4031..8695c31 100644
823--- a/src/ld.h
824+++ b/src/ld.h
825@@ -1114,6 +1114,7 @@ extern bool dynamically_linked_p (void);
826
827 /* Checked whether the symbol is undefined and referenced from a DSO. */
828 extern bool linked_from_dso_p (struct scninfo *scninfo, size_t symidx);
829+#if defined __OPTIMIZE__ && !(__GNUC__ == 4 && __GNUC_MINOR__ == 2)
830 #ifdef __GNUC_STDC_INLINE__
831 __attribute__ ((__gnu_inline__))
832 #endif
833@@ -1131,5 +1132,6 @@ linked_from_dso_p (struct scninfo *scninfo, size_t symidx)
834
835 return sym->defined && sym->in_dso;
836 }
837+#endif /* Optimizing and not GCC 4.2. */
838
839 #endif /* ld.h */
840diff --git a/src/readelf.c b/src/readelf.c
841index d49544f..15dbe62 100644
842--- a/src/readelf.c
843+++ b/src/readelf.c
844@@ -4368,10 +4368,12 @@ listptr_base (struct listptr *p)
845 return base;
846 }
847
848+static const char *listptr_name;
849+
850 static int
851-compare_listptr (const void *a, const void *b, void *arg)
852+compare_listptr (const void *a, const void *b)
853 {
854- const char *name = arg;
855+ const char *const name = listptr_name;
856 struct listptr *p1 = (void *) a;
857 struct listptr *p2 = (void *) b;
858
859@@ -4467,8 +4469,11 @@ static void
860 sort_listptr (struct listptr_table *table, const char *name)
861 {
862 if (table->n > 0)
863- qsort_r (table->table, table->n, sizeof table->table[0],
864- &compare_listptr, (void *) name);
865+ {
866+ listptr_name = name;
867+ qsort (table->table, table->n, sizeof table->table[0],
868+ &compare_listptr);
869+ }
870 }
871
872 static bool
873@@ -9540,7 +9545,7 @@ dump_archive_index (Elf *elf, const char *fname)
874 if (unlikely (elf_rand (elf, as_off) == 0)
875 || unlikely ((subelf = elf_begin (-1, ELF_C_READ_MMAP, elf))
876 == NULL))
877-#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7)
878+#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 7) || __GNUC__ < 4
879 while (1)
880 #endif
881 error (EXIT_FAILURE, 0,
882diff --git a/src/strings.c b/src/strings.c
883index f60e4b4..dae6ab2 100644
884--- a/src/strings.c
885+++ b/src/strings.c
886@@ -43,6 +43,10 @@
887
888 #include <system.h>
889
890+#ifndef MAP_POPULATE
891+# define MAP_POPULATE 0
892+#endif
893+
894
895 /* Prototypes of local functions. */
896 static int read_fd (int fd, const char *fname, off64_t fdlen);
897@@ -489,8 +493,13 @@ map_file (int fd, off64_t start_off, off64_t fdlen, size_t *map_sizep)
898 fd, start_off);
899 if (mem != MAP_FAILED)
900 {
901+#if !defined POSIX_MADV_SEQUENTIAL && defined MADV_SEQUENTIAL
902+# define POSIX_MADV_SEQUENTIAL MADV_SEQUENTIAL
903+#endif
904+#ifdef POSIX_MADV_SEQUENTIAL
905 /* We will go through the mapping sequentially. */
906 (void) posix_madvise (mem, map_size, POSIX_MADV_SEQUENTIAL);
907+#endif
908 break;
909 }
910 if (errno != EINVAL && errno != ENOMEM)
911@@ -581,9 +590,11 @@ read_block (int fd, const char *fname, off64_t fdlen, off64_t from, off64_t to)
912 elfmap_off = from & ~(ps - 1);
913 elfmap_base = elfmap = map_file (fd, elfmap_off, fdlen, &elfmap_size);
914
915+#ifdef POSIX_FADV_SEQUENTIAL
916 if (unlikely (elfmap == MAP_FAILED))
917 /* Let the kernel know we are going to read everything in sequence. */
918 (void) posix_fadvise (fd, 0, 0, POSIX_FADV_SEQUENTIAL);
919+#endif
920 }
921
922 if (unlikely (elfmap == MAP_FAILED))
923diff --git a/src/strip.c b/src/strip.c
924index 2b21799..1b34eee 100644
925--- a/src/strip.c
926+++ b/src/strip.c
927@@ -45,6 +45,12 @@
928 #include <libebl.h>
929 #include <system.h>
930
931+#ifdef HAVE_FUTIMES
932+# define FUTIMES(fd, fname, tvp) futimes (fd, tvp)
933+#else
934+# define FUTIMES(fd, fname, tvp) utimes (fname, tvp)
935+#endif
936+
937 typedef uint8_t GElf_Byte;
938
939 /* Name and version of program. */
940@@ -318,8 +324,18 @@ process_file (const char *fname)
941
942 /* If we have to preserve the timestamp, we need it in the
943 format utimes() understands. */
944+#ifdef HAVE_STRUCT_STAT_ST_ATIM
945 TIMESPEC_TO_TIMEVAL (&tv[0], &pre_st.st_atim);
946+#else
947+ tv[0].tv_sec = pre_st.st_atime;
948+ tv[0].tv_usec = 0;
949+#endif
950+#ifdef HAVE_STRUCT_STAT_ST_MTIM
951 TIMESPEC_TO_TIMEVAL (&tv[1], &pre_st.st_mtim);
952+#else
953+ tv[1].tv_sec = pre_st.st_atime;
954+ tv[1].tv_usec = 0;
955+#endif
956 }
957
958 /* Open the file. */
959@@ -2091,7 +2107,7 @@ while computing checksum for debug information"));
960 /* If requested, preserve the timestamp. */
961 if (tvp != NULL)
962 {
963- if (futimes (fd, tvp) != 0)
964+ if (FUTIMES (fd, output_fname, tvp) != 0)
965 {
966 error (0, errno, gettext ("\
967 cannot set access and modification date of '%s'"),
968@@ -2148,7 +2164,7 @@ handle_ar (int fd, Elf *elf, const char *prefix, const char *fname,
969
970 if (tvp != NULL)
971 {
972- if (unlikely (futimes (fd, tvp) != 0))
973+ if (unlikely (FUTIMES (fd, fname, tvp) != 0))
974 {
975 error (0, errno, gettext ("\
976 cannot set access and modification date of '%s'"), fname);
977diff --git a/tests/ChangeLog b/tests/ChangeLog
978index 59048f6..02eccfc 100644
979--- a/tests/ChangeLog
980+++ b/tests/ChangeLog
981@@ -421,6 +421,13 @@
982
983 2013-12-02 Jan Kratochvil <jan.kratochvil@redhat.com>
984
985+ Handle T-stopped detach for old kernels.
986+ * backtrace.c: Include sys/syscall.h.
987+ (linux_proc_pid_is_stopped): New function.
988+ (ptrace_detach_stopped): Handle old kernels.
989+
990+2013-12-02 Jan Kratochvil <jan.kratochvil@redhat.com>
991+
992 * Makefile.am (check_PROGRAMS): Add backtrace, backtrace-child,
993 backtrace-data and backtrace-dwarf.
994 (BUILT_SOURCES, clean-local, backtrace-child-biarch): New.
995@@ -1285,6 +1292,8 @@
996
997 2008-01-21 Roland McGrath <roland@redhat.com>
998
999+ * line2addr.c (main): Revert last change.
1000+
1001 * testfile45.S.bz2: Add tests for cltq, cqto.
1002 * testfile45.expect.bz2: Adjust.
1003
1004@@ -1993,6 +2002,11 @@
1005 * Makefile.am (TESTS): Add run-elflint-test.sh.
1006 (EXTRA_DIST): Add run-elflint-test.sh and testfile18.bz2.
1007
1008+2005-05-31 Roland McGrath <roland@redhat.com>
1009+
1010+ * Makefile.am (WEXTRA): New variable, substituted by configure.
1011+ (AM_CFLAGS): Use it in place of -Wextra.
1012+
1013 2005-05-24 Ulrich Drepper <drepper@redhat.com>
1014
1015 * get-files.c (main): Use correct format specifier.
1016diff --git a/tests/Makefile.am b/tests/Makefile.am
1017index f32e4d0..2652fb8 100644
1018--- a/tests/Makefile.am
1019+++ b/tests/Makefile.am
1020@@ -365,6 +365,7 @@ get_lines_LDADD = $(libdw) $(libelf)
1021 get_files_LDADD = $(libdw) $(libelf)
1022 get_aranges_LDADD = $(libdw) $(libelf)
1023 allfcts_LDADD = $(libdw) $(libelf)
1024+line2addr_no_Wformat = yes
1025 line2addr_LDADD = $(libdw)
1026 addrscopes_LDADD = $(libdw)
1027 funcscopes_LDADD = $(libdw)
1028diff --git a/tests/backtrace.c b/tests/backtrace.c
1029index 331ba0f..46af9b5 100644
1030--- a/tests/backtrace.c
1031+++ b/tests/backtrace.c
1032@@ -36,6 +36,7 @@
1033 #include <fcntl.h>
1034 #include <string.h>
1035 #include <argp.h>
1036+#include <sys/syscall.h>
1037 #include ELFUTILS_HEADER(dwfl)
1038
1039 #ifndef __linux__
1040diff --git a/tests/line2addr.c b/tests/line2addr.c
1041index e0d65d3..7c171b9 100644
1042--- a/tests/line2addr.c
1043+++ b/tests/line2addr.c
1044@@ -124,7 +124,7 @@ main (int argc, char *argv[])
1045 {
1046 struct args a = { .arg = argv[cnt] };
1047
1048- switch (sscanf (a.arg, "%m[^:]:%d", &a.file, &a.line))
1049+ switch (sscanf (a.arg, "%a[^:]:%d", &a.file, &a.line))
1050 {
1051 default:
1052 case 0:
1053--
10541.9.1
1055