This is a patch file that modifies "elfutils" 0.173 for use with "musl" 1.1.19. Stand-alone copies of "libargp" and "libobstack" (in- cluding both header files and library files) are required. This patch should work with "musl" "gcc" 6.4.0 or 7.2.0 or above and "binutils" 2.27 or 2.28. You should have received a README file with this patch file that ex- plains the "build" procedure to use. If you didn't, try doing a web search for: oldcoder musl elfutils This patch is based on pieces taken from numerous sources, including, but not limited to, Alpine and Gentoo. A few parts are new. The patch author is Robert Kiraly (OldCoder) Twitter as of 2018: @BoldCoder Email as of 2018: oldcoder@yahoo.com LinkedIn as of 2018: http://linkedin.oldcoder.org/ --- elfutils-0.173.old/config/eu.am +++ elfutils-0.173/config/eu.am @@ -73,7 +73,6 @@ -Wold-style-definition -Wstrict-prototypes \ $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \ $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \ - $(if $($(*F)_no_Werror),,-Werror) \ $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \ $(if $($(*F)_no_Wpacked_not_aligned),-Wno-packed-not-aligned,) \ --- elfutils-0.173.old/configure.ac +++ elfutils-0.173/configure.ac @@ -130,7 +130,7 @@ AC_CACHE_CHECK([whether gcc supports __attribute__((visibility()))], ac_cv_visibility, [dnl save_CFLAGS="$CFLAGS" -CFLAGS="$save_CFLAGS -Werror" +CFLAGS="$save_CFLAGS" AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl int __attribute__((visibility("hidden"))) foo (int a) @@ -146,7 +146,7 @@ AC_CACHE_CHECK([whether gcc supports __attribute__((gcc_struct))], ac_cv_gcc_struct, [dnl save_CFLAGS="$CFLAGS" -CFLAGS="$save_CFLAGS -Werror" +CFLAGS="$save_CFLAGS" AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl struct test { int x; } __attribute__((gcc_struct)); ])], ac_cv_gcc_struct=yes, ac_cv_gcc_struct=no) @@ -158,7 +158,7 @@ AC_CACHE_CHECK([whether gcc supports -fPIC], ac_cv_fpic, [dnl save_CFLAGS="$CFLAGS" -CFLAGS="$save_CFLAGS -fPIC -Werror" +CFLAGS="$save_CFLAGS -fPIC" AC_COMPILE_IFELSE([AC_LANG_SOURCE()], ac_cv_fpic=yes, ac_cv_fpic=no) CFLAGS="$save_CFLAGS" ]) @@ -171,7 +171,7 @@ AC_CACHE_CHECK([whether gcc supports -fPIE], ac_cv_fpie, [dnl save_CFLAGS="$CFLAGS" -CFLAGS="$save_CFLAGS -fPIE -Werror" +CFLAGS="$save_CFLAGS -fPIE" AC_COMPILE_IFELSE([AC_LANG_SOURCE()], ac_cv_fpie=yes, ac_cv_fpie=no) CFLAGS="$save_CFLAGS" ]) @@ -231,15 +231,6 @@ dnl whether functions and headers are available, whether they work, etc. AC_SYS_LARGEFILE -dnl Older glibc had a broken fts that didn't work with Large File Systems. -dnl We want the version that can handler LFS, but include workaround if we -dnl get a bad one. Add define to CFLAGS (not AC_DEFINE it) since we need to -dnl check it before including config.h (which might define _FILE_OFFSET_BITS). -AC_CACHE_CHECK([whether fts.h is bad when included (with LFS)], ac_cv_bad_fts, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include ]])], - ac_cv_bad_fts=no, ac_cv_bad_fts=yes)]) -AS_IF([test "x$ac_cv_bad_fts" = "xyes"], [CFLAGS="$CFLAGS -DBAD_FTS=1"]) - # See if we can add -D_FORTIFY_SOURCE=2. Don't do it if it is already # (differently) defined or if it generates warnings/errors because we # don't use the right optimisation level (string.h will warn about that). @@ -250,7 +241,7 @@ ;; *) save_CFLAGS="$CFLAGS" - CFLAGS="-D_FORTIFY_SOURCE=2 -Werror $CFLAGS" + CFLAGS="-D_FORTIFY_SOURCE=2 $CFLAGS" AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ #include int main() { return 0; } @@ -410,7 +401,7 @@ AC_CACHE_CHECK([whether gcc accepts -Wstack-usage], ac_cv_stack_usage, [dnl old_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wstack-usage=262144 -Werror" +CFLAGS="$CFLAGS -Wstack-usage=262144" AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], ac_cv_stack_usage=yes, ac_cv_stack_usage=no) CFLAGS="$old_CFLAGS"]) @@ -419,7 +410,7 @@ # -Wlogical-op was too fragile in the past, make sure we get a sane one. AC_CACHE_CHECK([whether gcc has a sane -Wlogical-op], ac_cv_logical_op, [dnl old_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wlogical-op -Werror" +CFLAGS="$CFLAGS -Wlogical-op" AC_COMPILE_IFELSE([AC_LANG_SOURCE( [#define FLAG 1 int f (int r, int f) { return (r && (FLAG || (FLAG & f))); }])], @@ -431,7 +422,7 @@ # -Wduplicated-cond was added by GCC6 AC_CACHE_CHECK([whether gcc accepts -Wduplicated-cond], ac_cv_duplicated_cond, [dnl old_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wduplicated-cond -Werror" +CFLAGS="$CFLAGS -Wduplicated-cond" AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], ac_cv_duplicated_cond=yes, ac_cv_duplicated_cond=no) CFLAGS="$old_CFLAGS"]) @@ -441,7 +432,7 @@ # -Wnull-dereference was added by GCC6 AC_CACHE_CHECK([whether gcc accepts -Wnull-dereference], ac_cv_null_dereference, [dnl old_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wnull-dereference -Werror" +CFLAGS="$CFLAGS -Wnull-dereference" AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], ac_cv_null_dereference=yes, ac_cv_null_dereference=no) CFLAGS="$old_CFLAGS"]) @@ -451,7 +442,7 @@ # -Wimplicit-fallthrough was added by GCC7 AC_CACHE_CHECK([whether gcc accepts -Wimplicit-fallthrough], ac_cv_implicit_fallthrough, [dnl old_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wimplicit-fallthrough -Werror" +CFLAGS="$CFLAGS -Wimplicit-fallthrough" AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], ac_cv_implicit_fallthrough=yes, ac_cv_implicit_fallthrough=no) CFLAGS="$old_CFLAGS"]) @@ -464,31 +455,12 @@ [Defined if __attribute__((fallthrough)) is supported]) fi -dnl Check if we have argp available from our libc -AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include ], - [int argc=1; char *argv[]={"test"}; argp_parse(0,argc,&argv,0,0,0); return 0;] - )], - [libc_has_argp="true"], - [libc_has_argp="false"] -) - -dnl If our libc doesn't provide argp, then test for libargp -if test "$libc_has_argp" = "false" ; then - AC_MSG_WARN("libc does not have argp") - AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"]) - - if test "$have_argp" = "false"; then - AC_MSG_ERROR("no libargp found") - else - argp_LDADD="-largp" - fi -else - argp_LDADD="" -fi +argp_LDADD="-L/usr/local/lib -Wl,-R/usr/local/lib -largp" AC_SUBST([argp_LDADD]) +obstack_LDADD="-L/usr/local/lib -Wl,-R/usr/local/lib -lobstack" +AC_SUBST([obstack_LDADD]) + dnl The directories with content. dnl Documentation. --- elfutils-0.173.old/lib/error.h +++ elfutils-0.173/lib/error.h @@ -0,0 +1,27 @@ +#ifndef _ERROR_H_ +#define _ERROR_H_ + +#include +#include +#include +#include +#include + +static unsigned int error_message_count = 0; + +static inline void error(int status, int errnum, const char* format, ...) +{ + va_list ap; + fprintf(stderr, "%s: ", program_invocation_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + if (errnum) + fprintf(stderr, ": %s", strerror(errnum)); + fprintf(stderr, "\n"); + error_message_count++; + if (status) + exit(status); +} + +#endif /* _ERROR_H_ */ --- elfutils-0.173.old/lib/fixedsizehash.h +++ elfutils-0.173/lib/fixedsizehash.h @@ -30,7 +30,6 @@ #include #include #include -#include #include --- elfutils-0.173.old/libdw/Makefile.am +++ elfutils-0.173/libdw/Makefile.am @@ -108,7 +108,7 @@ libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \ ../libdwfl/libdwfl_pic.a ../libebl/libebl.a libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so -libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) +libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LDADD) $(zip_LIBS) libdw_so_SOURCES = libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS) # The rpath is necessary for libebl because its $ORIGIN use will --- elfutils-0.173.old/libdw/Makefile.in +++ elfutils-0.173/libdw/Makefile.in @@ -513,7 +513,7 @@ ../libdwfl/libdwfl_pic.a ../libebl/libebl.a libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so -libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(zip_LIBS) +libdw_so_LDLIBS = $(libdw_so_DEPS) -ldl -lz $(argp_LDADD) $(fts_LDADD) $(zip_LIBS) libdw_so_SOURCES = libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a) libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects)) \ --- elfutils-0.173.old/libdwfl/Makefile.am +++ elfutils-0.173/libdwfl/Makefile.am @@ -49,7 +49,7 @@ argp-std.c find-debuginfo.c \ dwfl_build_id_find_elf.c \ dwfl_build_id_find_debuginfo.c \ - linux-kernel-modules.c linux-proc-maps.c \ + linux-proc-maps.c \ dwfl_addrmodule.c dwfl_addrdwarf.c \ cu.c dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ dwfl_module_addrdie.c dwfl_addrdie.c \ --- elfutils-0.173.old/libdwfl/Makefile.in +++ elfutils-0.173/libdwfl/Makefile.in @@ -120,7 +120,7 @@ dwfl_getmodules.c dwfl_getdwarf.c dwfl_module_getdwarf.c \ dwfl_module_getelf.c dwfl_validate_address.c argp-std.c \ find-debuginfo.c dwfl_build_id_find_elf.c \ - dwfl_build_id_find_debuginfo.c linux-kernel-modules.c \ + dwfl_build_id_find_debuginfo.c \ linux-proc-maps.c dwfl_addrmodule.c dwfl_addrdwarf.c cu.c \ dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ dwfl_module_addrdie.c dwfl_addrdie.c lines.c dwfl_lineinfo.c \ @@ -148,7 +148,7 @@ dwfl_validate_address.$(OBJEXT) argp-std.$(OBJEXT) \ find-debuginfo.$(OBJEXT) dwfl_build_id_find_elf.$(OBJEXT) \ dwfl_build_id_find_debuginfo.$(OBJEXT) \ - linux-kernel-modules.$(OBJEXT) linux-proc-maps.$(OBJEXT) \ + linux-proc-maps.$(OBJEXT) \ dwfl_addrmodule.$(OBJEXT) dwfl_addrdwarf.$(OBJEXT) \ cu.$(OBJEXT) dwfl_module_nextcu.$(OBJEXT) \ dwfl_nextcu.$(OBJEXT) dwfl_cumodule.$(OBJEXT) \ @@ -442,7 +442,7 @@ dwfl_getmodules.c dwfl_getdwarf.c dwfl_module_getdwarf.c \ dwfl_module_getelf.c dwfl_validate_address.c argp-std.c \ find-debuginfo.c dwfl_build_id_find_elf.c \ - dwfl_build_id_find_debuginfo.c linux-kernel-modules.c \ + dwfl_build_id_find_debuginfo.c \ linux-proc-maps.c dwfl_addrmodule.c dwfl_addrdwarf.c cu.c \ dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \ dwfl_module_addrdie.c dwfl_addrdie.c lines.c dwfl_lineinfo.c \ @@ -579,7 +579,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lines.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/link_map.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-core-attach.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-kernel-modules.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-pid-attach.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux-proc-maps.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lzma.Po@am__quote@ --- elfutils-0.173.old/libdwfl/argp-std.c +++ elfutils-0.173/libdwfl/argp-std.c @@ -56,9 +56,6 @@ { "linux-process-map", 'M', "FILE", 0, N_("Find addresses in files mapped as read from FILE" " in Linux /proc/PID/maps format"), 0 }, - { "kernel", 'k', NULL, 0, N_("Find addresses in the running kernel"), 0 }, - { "offline-kernel", 'K', "RELEASE", OPTION_ARG_OPTIONAL, - N_("Kernel with all modules"), 0 }, { "debuginfo-path", OPT_DEBUGINFO, "PATH", 0, N_("Search path for separate debuginfo files"), 0 }, { NULL, 0, NULL, 0, NULL, 0 } @@ -85,15 +82,6 @@ .find_elf = INTUSE(dwfl_linux_proc_find_elf), }; -static const Dwfl_Callbacks kernel_callbacks = - { - .find_debuginfo = INTUSE(dwfl_standard_find_debuginfo), - .debuginfo_path = &debuginfo_path, - - .find_elf = INTUSE(dwfl_linux_kernel_find_elf), - .section_address = INTUSE(dwfl_linux_kernel_module_section_address), - }; - /* Structure held at state->HOOK. */ struct parse_opt { @@ -226,43 +214,6 @@ } break; - case 'k': - { - struct parse_opt *opt = state->hook; - if (opt->dwfl == NULL) - { - Dwfl *dwfl = INTUSE(dwfl_begin) (&kernel_callbacks); - int result = INTUSE(dwfl_linux_kernel_report_kernel) (dwfl); - if (result != 0) - return fail (dwfl, result, _("cannot load kernel symbols"), state); - result = INTUSE(dwfl_linux_kernel_report_modules) (dwfl); - if (result != 0) - /* Non-fatal to have no modules since we do have the kernel. */ - argp_failure (state, 0, result, _("cannot find kernel modules")); - opt->dwfl = dwfl; - } - else - goto toomany; - } - break; - - case 'K': - { - struct parse_opt *opt = state->hook; - if (opt->dwfl == NULL) - { - Dwfl *dwfl = INTUSE(dwfl_begin) (&offline_callbacks); - int result = INTUSE(dwfl_linux_kernel_report_offline) (dwfl, arg, - NULL); - if (result != 0) - return fail (dwfl, result, _("cannot find kernel or modules"), state); - opt->dwfl = dwfl; - } - else - goto toomany; - } - break; - case ARGP_KEY_SUCCESS: { struct parse_opt *opt = state->hook; --- elfutils-0.173.old/libdwfl/dwfl_error.c +++ elfutils-0.173/libdwfl/dwfl_error.c @@ -154,7 +154,16 @@ switch (error &~ 0xffff) { case OTHER_ERROR (ERRNO): +#if defined(__GLIBC__) return strerror_r (error & 0xffff, "bad", 0); +#else + { + static __thread char buf[128] = ""; + if (strerror_r (error & 0xffff, buf, sizeof(buf)) == 0) + return buf; + } + return "strerror_r() failed"; +#endif case OTHER_ERROR (LIBELF): return elf_errmsg (error & 0xffff); case OTHER_ERROR (LIBDW): --- elfutils-0.173.old/libelf/elf.h +++ elfutils-0.173/libelf/elf.h @@ -21,7 +21,9 @@ #include -__BEGIN_DECLS +#ifdef __cplusplus +extern "C" { +#endif /* Standard ELF types. */ @@ -3915,6 +3917,8 @@ #define R_METAG_TLS_LE_HI16 60 #define R_METAG_TLS_LE_LO16 61 -__END_DECLS +#ifdef __cplusplus +} +#endif #endif /* elf.h */ --- elfutils-0.173.old/src/Makefile.am +++ elfutils-0.173/src/Makefile.am @@ -68,8 +68,8 @@ unstrip_no_Wstack_usage = yes readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl -nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \ - $(demanglelib) +nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) \ + $(obstack_LDADD) -ldl $(demanglelib) size_LDADD = $(libelf) $(libeu) $(argp_LDADD) strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl @@ -77,9 +77,9 @@ addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib) elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl -ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) +ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LDADD) strings_LDADD = $(libelf) $(libeu) $(argp_LDADD) -ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) +ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LDADD) unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl $(demanglelib) elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) --- elfutils-0.173.old/src/Makefile.in +++ elfutils-0.173/src/Makefile.in @@ -482,8 +482,8 @@ ar_no_Wstack_usage = yes unstrip_no_Wstack_usage = yes readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl -nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \ - $(demanglelib) +nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) \ + $(obstack_LDADD) -ldl $(demanglelib) size_LDADD = $(libelf) $(libeu) $(argp_LDADD) strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl @@ -492,9 +492,9 @@ addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib) elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl -ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) +ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LDADD) strings_LDADD = $(libelf) $(libeu) $(argp_LDADD) -ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) +ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LDADD) unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl $(demanglelib) elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) --- elfutils-0.173.old/src/arlib.h +++ elfutils-0.173/src/arlib.h @@ -29,6 +29,12 @@ #include #include +#if !defined(ALLPERMS) +# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */ +#endif +#if !defined(DEFFILEMODE) +# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/ +#endif /* State of -D/-U flags. */ extern bool arlib_deterministic_output; --- elfutils-0.173.old/src/elfcompress.c +++ elfutils-0.173/src/elfcompress.c @@ -37,6 +37,13 @@ #include "libeu.h" #include "printversion.h" +#if !defined(ALLPERMS) +# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */ +#endif +#if !defined(FNM_EXTMATCH) +# define FNM_EXTMATCH ( 1 << 5) +#endif + /* Name and version of program. */ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; --- elfutils-0.173.old/src/readelf.c +++ elfutils-0.173/src/readelf.c @@ -4773,10 +4773,11 @@ return cudie_base (&cu); } +static const char *listptr_name; + static int -compare_listptr (const void *a, const void *b, void *arg) +compare_listptr (const void *a, const void *b) { - const char *name = arg; struct listptr *p1 = (void *) a; struct listptr *p2 = (void *) b; @@ -4792,21 +4793,21 @@ p1->warned = p2->warned = true; error (0, 0, gettext ("%s %#" PRIx64 " used with different address sizes"), - name, (uint64_t) p1->offset); + listptr_name, (uint64_t) p1->offset); } if (p1->dwarf64 != p2->dwarf64) { p1->warned = p2->warned = true; error (0, 0, gettext ("%s %#" PRIx64 " used with different offset sizes"), - name, (uint64_t) p1->offset); + listptr_name, (uint64_t) p1->offset); } if (listptr_base (p1) != listptr_base (p2)) { p1->warned = p2->warned = true; error (0, 0, gettext ("%s %#" PRIx64 " used with different base addresses"), - name, (uint64_t) p1->offset); + listptr_name, (uint64_t) p1->offset); } if (p1->attr != p2 ->attr) { @@ -4814,7 +4815,7 @@ error (0, 0, gettext ("%s %#" PRIx64 " used with different attribute %s and %s"), - name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr), + listptr_name, (uint64_t) p1->offset, dwarf_attr_name (p2->attr), dwarf_attr_name (p2->attr)); } } @@ -4886,8 +4887,11 @@ sort_listptr (struct listptr_table *table, const char *name) { if (table->n > 0) - qsort_r (table->table, table->n, sizeof table->table[0], - &compare_listptr, (void *) name); + { + listptr_name = name; + qsort (table->table, table->n, sizeof table->table[0], + &compare_listptr); + } } static bool --- elfutils-0.173.old/src/strip.c +++ elfutils-0.173/src/strip.c @@ -47,6 +47,13 @@ #include #include +#if !defined(ACCESSPERMS) +# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ +#endif +#if !defined(FNM_EXTMATCH) +# define FNM_EXTMATCH ( 1 << 5) +#endif + typedef uint8_t GElf_Byte; /* Name and version of program. */ --- elfutils-0.173.old/src/unstrip.c +++ elfutils-0.173/src/unstrip.c @@ -56,6 +56,15 @@ # define _(str) gettext (str) #endif +#ifndef strndupa +#define strndupa(s, n) \ + ({const char *__in = (s); \ + size_t __len = strnlen (__in, (n)) + 1; \ + char *__out = (char *) alloca (__len); \ + __out[__len-1] = '\0'; \ + (char *) memcpy (__out, __in, __len-1);}) +#endif + /* Name and version of program. */ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; --- elfutils-0.173.old/tests/lfs-symbols +++ elfutils-0.173/tests/lfs-symbols @@ -1,7 +1,4 @@ # Imported from lintian/data/binaries/lfs-symbols -# -# Exceptions: -# fts* - linux-kernel-modules.c is careful with FTS_NOSTAT # Manually maintained list of non-lfs symbols #