Merge pull request #3019 from pullmoll/elfutils

elfutils: update to 0.164
This commit is contained in:
Jürgen Buchmüller 2015-11-20 10:27:50 +01:00
commit 7ba76405a3
25 changed files with 499 additions and 3204 deletions

View file

@ -1,113 +0,0 @@
diff --git libdwfl/Makefile.in libdwfl/Makefile.in
index 278b434..a2382bf 100644
--- libdwfl/Makefile.in
+++ libdwfl/Makefile.in
@@ -113,7 +113,7 @@ am__libdwfl_a_SOURCES_DIST = dwfl_begin.c dwfl_end.c dwfl_error.c \
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 \
@@ -142,7 +142,7 @@ am_libdwfl_a_OBJECTS = dwfl_begin.$(OBJEXT) dwfl_end.$(OBJEXT) \
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) \
@@ -402,7 +402,7 @@ libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c \
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 \
@@ -540,7 +540,6 @@ distclean-compile:
@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@
diff --git libdwfl/argp-std.c libdwfl/argp-std.c
index 42b7e78..7892907 100644
--- libdwfl/argp-std.c
+++ libdwfl/argp-std.c
@@ -52,9 +52,6 @@ static const struct argp_option options[] =
{ "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 }
@@ -81,15 +78,6 @@ static const Dwfl_Callbacks proc_callbacks =
.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
{
@@ -219,43 +207,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
}
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"));
- result = INTUSE(dwfl_linux_kernel_report_modules) (dwfl);
- if (result != 0)
- /* Non-fatal to have no modules since we do have the kernel. */
- failure (dwfl, 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"));
- opt->dwfl = dwfl;
- }
- else
- goto toomany;
- }
- break;
-
case ARGP_KEY_SUCCESS:
{
struct parse_opt *opt = state->hook;

View file

@ -0,0 +1,27 @@
#ifndef _ERROR_H_
#define _ERROR_H_
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
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_ */

File diff suppressed because it is too large Load diff

View file

@ -1,16 +0,0 @@
diff --git lib/color.c lib/color.c
index d1309ed..f3cc906 100644
--- lib/color.c
+++ lib/color.c
@@ -131,8 +131,10 @@ valid arguments are:\n\
- 'never', 'no', 'none'\n\
- 'auto', 'tty', 'if-tty'\n"),
program_invocation_short_name, arg);
+ char program_invocation_short_name_nonconst[sizeof(program_invocation_short_name)];
+ strcpy(program_invocation_short_name_nonconst, program_invocation_short_name);
argp_help (&color_argp, stderr, ARGP_HELP_SEE,
- program_invocation_short_name);
+ program_invocation_short_name_nonconst);
exit (EXIT_FAILURE);
}
}

View file

@ -1,57 +0,0 @@
diff --git libasm/libasmP.h libasm/libasmP.h
index 49b6484..18e4831 100644
--- libasm/libasmP.h
+++ libasm/libasmP.h
@@ -33,6 +33,9 @@
#include <libasm.h>
+#ifdef _ /* fix libintl-stub */
+#undef _
+#endif
/* gettext helper macros. */
#define _(Str) dgettext ("elfutils", Str)
diff --git libdw/libdwP.h libdw/libdwP.h
index 5ab7219..0a87cf4 100644
--- libdw/libdwP.h
+++ libdw/libdwP.h
@@ -36,7 +36,9 @@
#include <libdw.h>
#include <dwarf.h>
-
+#ifdef _ /* fix libintl-stub */
+#undef _
+#endif
/* gettext helper macros. */
#define _(Str) dgettext ("elfutils", Str)
diff --git libdwfl/libdwflP.h libdwfl/libdwflP.h
index 12ee116..f876eed 100644
--- libdwfl/libdwflP.h
+++ libdwfl/libdwflP.h
@@ -46,6 +46,9 @@
typedef struct Dwfl_Process Dwfl_Process;
+#ifdef _ /* fix libintl-stub */
+#undef _
+#endif
/* gettext helper macros. */
#define _(Str) dgettext ("elfutils", Str)
diff --git libelf/libelfP.h libelf/libelfP.h
index 52cf745..2029ebe 100644
--- libelf/libelfP.h
+++ libelf/libelfP.h
@@ -42,6 +42,9 @@
#include <stdio.h>
#include <string.h>
+#ifdef _ /* fix libintl-stub */
+#undef _
+#endif
/* gettext helper macros. */
#define _(Str) dgettext ("elfutils", Str)

View file

@ -1,13 +0,0 @@
diff --git libelf/elf_getarsym.c libelf/elf_getarsym.c
index 40633aa..132d1a2 100644
--- libelf/elf_getarsym.c
+++ libelf/elf_getarsym.c
@@ -166,7 +166,7 @@ elf_getarsym (elf, ptr)
/* We have an archive. The first word in there is the number of
entries in the table. */
- uint64_t n;
+ uint64_t n = 0;
size_t off = elf->start_offset + SARMAG + sizeof (struct ar_hdr);
if (read_number_entries (&n, elf, &off, index64_p) < 0)
{

View file

@ -1,16 +0,0 @@
diff --git libelf/libelf.h libelf/libelf.h
index 5a2b3af..4ead65a 100644
--- libelf/libelf.h
+++ libelf/libelf.h
@@ -34,6 +34,11 @@
/* Get the ELF types. */
#include <elf.h>
+#ifndef _LIBC
+#ifndef __mempcpy
+#define __mempcpy mempcpy
+#endif
+#endif
/* Known translation types. */
typedef enum

View file

@ -1,26 +0,0 @@
diff --git Makefile.am Makefile.am
index d044a7c..7f5fba4 100644
--- Makefile.am
+++ Makefile.am
@@ -24,7 +24,7 @@ pkginclude_HEADERS = version.h
# Add doc back when we have some real content.
SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libcpu libasm \
- backends src po tests
+ backends
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
COPYING COPYING-GPLV2 COPYING-LGPLV3
diff --git Makefile.in Makefile.in
index f5c3ebe..149a8cb 100644
--- Makefile.in
+++ Makefile.in
@@ -360,7 +360,7 @@ pkginclude_HEADERS = version.h
# Add doc back when we have some real content.
SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libcpu libasm \
- backends src po tests
+ backends
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
COPYING COPYING-GPLV2 COPYING-LGPLV3

View file

@ -1,13 +0,0 @@
diff --git libdw/Makefile.in libdw/Makefile.in
index 1aa13dd..1c1e0d7 100644
--- libdw/Makefile.in
+++ libdw/Makefile.in
@@ -969,7 +969,7 @@ libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
-Wl,--version-script,$<,--no-undefined \
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
- -ldl $(zip_LIBS)
+ -ldl $(zip_LIBS) $(LIBS)
@$(textrel_check)
ln -fs $@ $@.$(VERSION)

View file

@ -1,968 +0,0 @@
diff --git lib/color.c lib/color.c
index f3cc906..ea6ee73 100644
--- lib/color.c
+++ lib/color.c
@@ -32,7 +32,7 @@
#endif
#include <argp.h>
-#include <error.h>
+#include <err.h>
#include <libintl.h>
#include <stdlib.h>
#include <string.h>
diff --git lib/fixedsizehash.h lib/fixedsizehash.h
index 06ce6a2..566def2 100644
--- lib/fixedsizehash.h
+++ lib/fixedsizehash.h
@@ -30,12 +30,12 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <system.h>
-#define CONCAT(t1,t2) __CONCAT (t1,t2)
+#define CONCAT1(x,y) x##y
+#define CONCAT(x,y) CONCAT1(x,y)
/* Before including this file the following macros must be defined:
diff --git lib/system.h lib/system.h
index f31cfd0..191462a 100644
--- lib/system.h
+++ lib/system.h
@@ -68,6 +68,16 @@ extern int crc32_file (int fd, uint32_t *resp);
#define gettext_noop(Str) Str
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+ (__extension__ \
+ ({ long int __result; \
+ do __result = (long int) (expression); \
+ while (__result == -1L && errno == EINTR); \
+ __result; }))
+#endif
+
+#define error(status, errno, ...) err(status, __VA_ARGS__)
static inline ssize_t __attribute__ ((unused))
pwrite_retry (int fd, const void *buf, size_t len, off_t off)
diff --git lib/xmalloc.c lib/xmalloc.c
index 27ccab9..87292fc 100644
--- lib/xmalloc.c
+++ lib/xmalloc.c
@@ -30,7 +30,7 @@
# include <config.h>
#endif
-#include <error.h>
+#include <err.h>
#include <libintl.h>
#include <stddef.h>
#include <stdlib.h>
diff --git libasm/asm_end.c libasm/asm_end.c
index f4145a7..a50cbf5 100644
--- libasm/asm_end.c
+++ libasm/asm_end.c
@@ -32,7 +32,7 @@
#endif
#include <assert.h>
-#include <error.h>
+#include <err.h>
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
diff --git libasm/asm_newscn.c libasm/asm_newscn.c
index ece7f5c..da95351 100644
--- libasm/asm_newscn.c
+++ libasm/asm_newscn.c
@@ -32,7 +32,7 @@
#endif
#include <assert.h>
-#include <error.h>
+#include <err.h>
#include <libintl.h>
#include <stdlib.h>
#include <string.h>
diff --git libcpu/i386_gendis.c libcpu/i386_gendis.c
index aae5eae..6d76016 100644
--- libcpu/i386_gendis.c
+++ libcpu/i386_gendis.c
@@ -31,7 +31,7 @@
# include <config.h>
#endif
-#include <error.h>
+#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
diff --git libcpu/i386_lex.c libcpu/i386_lex.c
index cb0be8d..2cffc02 100644
--- libcpu/i386_lex.c
+++ libcpu/i386_lex.c
@@ -571,7 +571,7 @@ char *i386_text;
#endif
#include <ctype.h>
-#include <error.h>
+#include <err.h>
#include <libintl.h>
#include <system.h>
diff --git libcpu/i386_lex.l libcpu/i386_lex.l
index 1e10dd7..0fba91e 100644
--- libcpu/i386_lex.l
+++ libcpu/i386_lex.l
@@ -31,7 +31,7 @@
#endif
#include <ctype.h>
-#include <error.h>
+#include <err.h>
#include <libintl.h>
#include <system.h>
diff --git libcpu/i386_parse.c libcpu/i386_parse.c
index cf8fe25..269ced3 100644
--- libcpu/i386_parse.c
+++ libcpu/i386_parse.c
@@ -107,7 +107,7 @@
#include <assert.h>
#include <ctype.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <inttypes.h>
#include <libintl.h>
#include <math.h>
diff --git libdw/libdw_alloc.c libdw/libdw_alloc.c
index a3b7958..4b7b9af 100644
--- libdw/libdw_alloc.c
+++ libdw/libdw_alloc.c
@@ -31,7 +31,7 @@
# include <config.h>
#endif
-#include <error.h>
+#include <err.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/param.h>
@@ -74,5 +74,5 @@ __attribute ((noreturn, visibility ("hidden")))
__libdw_oom (void)
{
while (1)
- error (EXIT_FAILURE, ENOMEM, "libdw");
+ err (EXIT_FAILURE, "libdw: out of memory");
}
diff --git libdwfl/dwfl_build_id_find_elf.c libdwfl/dwfl_build_id_find_elf.c
index 062aad1..eec3ce6 100644
--- libdwfl/dwfl_build_id_find_elf.c
+++ libdwfl/dwfl_build_id_find_elf.c
@@ -80,7 +80,7 @@ __libdwfl_open_by_build_id (Dwfl_Module *mod, bool debug, char **file_name,
{
if (*file_name != NULL)
free (*file_name);
- *file_name = canonicalize_file_name (name);
+ *file_name = realpath (name, NULL);
if (*file_name == NULL)
{
*file_name = name;
diff --git libdwfl/dwfl_error.c libdwfl/dwfl_error.c
index d9ca9e7..31236af 100644
--- libdwfl/dwfl_error.c
+++ libdwfl/dwfl_error.c
@@ -128,6 +128,7 @@ const char *
dwfl_errmsg (error)
int error;
{
+ static __thread char s[64] = "";
if (error == 0 || error == -1)
{
int last_error = global_error;
@@ -142,7 +143,8 @@ dwfl_errmsg (error)
switch (error &~ 0xffff)
{
case OTHER_ERROR (ERRNO):
- return strerror_r (error & 0xffff, "bad", 0);
+ strerror_r (error & 0xffff, s, sizeof(s));
+ return s;
case OTHER_ERROR (LIBELF):
return elf_errmsg (error & 0xffff);
case OTHER_ERROR (LIBDW):
diff --git libdwfl/find-debuginfo.c libdwfl/find-debuginfo.c
index 3f5314a..954dbe8 100644
--- libdwfl/find-debuginfo.c
+++ libdwfl/find-debuginfo.c
@@ -338,7 +338,7 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
/* If FILE_NAME is a symlink, the debug file might be associated
with the symlink target name instead. */
- char *canon = canonicalize_file_name (file_name);
+ char *canon = realpath (file_name, NULL);
if (canon != NULL && strcmp (file_name, canon))
fd = find_debuginfo_in_path (mod, canon,
debuglink_file, debuglink_crc,
diff --git libdwfl/libdwfl.h libdwfl/libdwfl.h
index 2bb4f45..b6675c0 100644
--- libdwfl/libdwfl.h
+++ libdwfl/libdwfl.h
@@ -31,6 +31,27 @@
#include "libdw.h"
#include <stdio.h>
+#include <unistd.h>
+#include <alloca.h>
+#include <string.h>
+
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+ (__extension__ \
+ ({ long int __result; \
+ do __result = (long int) (expression); \
+ while (__result == -1L && errno == EINTR); \
+ __result; }))
+#endif
+
+#ifndef strndupa
+#define strndupa(s, n) \
+ (__extension__ ({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
/* Handle for a session using the library. */
typedef struct Dwfl Dwfl;
diff --git libebl/eblopenbackend.c libebl/eblopenbackend.c
index 3a22f53..296d0f0 100644
--- libebl/eblopenbackend.c
+++ libebl/eblopenbackend.c
@@ -32,7 +32,7 @@
#include <assert.h>
#include <dlfcn.h>
-#include <error.h>
+#include <err.h>
#include <libelfP.h>
#include <dwarf.h>
#include <stdlib.h>
diff --git libebl/eblwstrtab.c libebl/eblwstrtab.c
index 08e0ba7..2981b47 100644
--- libebl/eblwstrtab.c
+++ libebl/eblwstrtab.c
@@ -305,7 +305,7 @@ copystrings (struct Ebl_WStrent *nodep, wchar_t **freep, size_t *offsetp)
/* Process the current node. */
nodep->offset = *offsetp;
- *freep = wmempcpy (*freep, nodep->string, nodep->len);
+ *freep = wmemcpy (*freep, nodep->string, nodep->len) + nodep->len;
*offsetp += nodep->len * sizeof (wchar_t);
for (subs = nodep->next; subs != NULL; subs = subs->next)
diff --git libelf/elf.h libelf/elf.h
index 40e87b2..fab9796 100644
--- libelf/elf.h
+++ libelf/elf.h
@@ -19,9 +19,10 @@
#ifndef _ELF_H
#define _ELF_H 1
-#include <features.h>
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
/* Standard ELF types. */
@@ -3358,6 +3359,8 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_TILEGX_NUM 130
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif /* elf.h */
diff --git libelf/elf_getarsym.c libelf/elf_getarsym.c
index 132d1a2..4c6d24c 100644
--- libelf/elf_getarsym.c
+++ libelf/elf_getarsym.c
@@ -284,7 +284,7 @@ elf_getarsym (elf, ptr)
arsym[cnt].as_off = file_data->u32[cnt];
arsym[cnt].as_hash = _dl_elf_hash (str_data);
- str_data = rawmemchr (str_data, '\0') + 1;
+ str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
}
/* At the end a special entry. */
diff --git libelf/libelf.h libelf/libelf.h
index 4ead65a..34304aa 100644
--- libelf/libelf.h
+++ libelf/libelf.h
@@ -29,6 +29,7 @@
#ifndef _LIBELF_H
#define _LIBELF_H 1
+#include <fcntl.h>
#include <sys/types.h>
/* Get the ELF types. */
diff --git src/addr2line.c src/addr2line.c
index e982982..d70da46 100644
--- src/addr2line.c
+++ src/addr2line.c
@@ -23,7 +23,7 @@
#include <argp.h>
#include <assert.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <inttypes.h>
#include <libdwfl.h>
diff --git src/ar.c src/ar.c
index f51f0ef..9437516 100644
--- src/ar.c
+++ src/ar.c
@@ -22,7 +22,7 @@
#include <argp.h>
#include <assert.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <libintl.h>
diff --git src/arlib.c src/arlib.c
index 43a9145..091d8c3 100644
--- src/arlib.c
+++ src/arlib.c
@@ -21,7 +21,7 @@
#endif
#include <assert.h>
-#include <error.h>
+#include <err.h>
#include <gelf.h>
#include <libintl.h>
#include <stdio.h>
diff --git src/arlib2.c src/arlib2.c
index 7998fc6..df0e7d5 100644
--- src/arlib2.c
+++ src/arlib2.c
@@ -20,7 +20,7 @@
# include <config.h>
#endif
-#include <error.h>
+#include <err.h>
#include <libintl.h>
#include <limits.h>
#include <string.h>
diff --git src/elfcmp.c src/elfcmp.c
index d1008b3..df83832 100644
--- src/elfcmp.c
+++ src/elfcmp.c
@@ -23,7 +23,7 @@
#include <argp.h>
#include <assert.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <locale.h>
#include <libintl.h>
diff --git src/elflint.c src/elflint.c
index 7e73253..78f73b1 100644
--- src/elflint.c
+++ src/elflint.c
@@ -24,7 +24,7 @@
#include <assert.h>
#include <byteswap.h>
#include <endian.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <inttypes.h>
diff --git src/findtextrel.c src/findtextrel.c
index d7de202..aa5497a 100644
--- src/findtextrel.c
+++ src/findtextrel.c
@@ -23,7 +23,7 @@
#include <argp.h>
#include <assert.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <libdw.h>
diff --git src/i386_ld.c src/i386_ld.c
index d196177..ba57657 100644
--- src/i386_ld.c
+++ src/i386_ld.c
@@ -20,7 +20,7 @@
#endif
#include <assert.h>
-#include <error.h>
+#include <err.h>
#include <libintl.h>
#include <stdlib.h>
#include <string.h>
diff --git src/ld.c src/ld.c
index 73e4f04..8f33870 100644
--- src/ld.c
+++ src/ld.c
@@ -21,7 +21,7 @@
#include <argp.h>
#include <assert.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <libelf.h>
#include <libintl.h>
diff --git src/ldgeneric.c src/ldgeneric.c
index 1b5d0f9..e1e7b3a 100644
--- src/ldgeneric.c
+++ src/ldgeneric.c
@@ -23,7 +23,7 @@
#include <ctype.h>
#include <dlfcn.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <gelf.h>
diff --git src/ldlex.c src/ldlex.c
index 03870df..77d239d 100644
--- src/ldlex.c
+++ src/ldlex.c
@@ -1099,7 +1099,7 @@ char *ldtext;
#include <assert.h>
#include <ctype.h>
#include <elf.h>
-#include <error.h>
+#include <err.h>
#include <inttypes.h>
#include <libintl.h>
#include <stdbool.h>
diff --git src/ldlex.l src/ldlex.l
index bfc8bbe..fce3d03 100644
--- src/ldlex.l
+++ src/ldlex.l
@@ -23,7 +23,7 @@
#include <assert.h>
#include <ctype.h>
#include <elf.h>
-#include <error.h>
+#include <err.h>
#include <inttypes.h>
#include <libintl.h>
#include <stdbool.h>
diff --git src/ldscript.c src/ldscript.c
index 690d805..ad8a888 100644
--- src/ldscript.c
+++ src/ldscript.c
@@ -95,7 +95,7 @@
#endif
#include <assert.h>
-#include <error.h>
+#include <err.h>
#include <libintl.h>
#include <stdbool.h>
#include <stdint.h>
@@ -106,7 +106,7 @@
#include <system.h>
#include <ld.h>
-/* The error handler. */
+/* The err.handler. */
static void yyerror (const char *s);
/* Some helper functions we need to construct the data structures
diff --git src/nm.c src/nm.c
index 4f2e0e7..676402e 100644
--- src/nm.c
+++ src/nm.c
@@ -26,7 +26,7 @@
#include <ctype.h>
#include <dwarf.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <inttypes.h>
diff --git src/objdump.c src/objdump.c
index 87290cc..cada7f2 100644
--- src/objdump.c
+++ src/objdump.c
@@ -21,7 +21,7 @@
#endif
#include <argp.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <inttypes.h>
#include <libintl.h>
diff --git src/ranlib.c src/ranlib.c
index 8435fc1..36ff6f4 100644
--- src/ranlib.c
+++ src/ranlib.c
@@ -24,7 +24,7 @@
#include <argp.h>
#include <assert.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <libintl.h>
diff --git src/readelf.c src/readelf.c
index 772cfca..37658d2 100644
--- src/readelf.c
+++ src/readelf.c
@@ -25,7 +25,7 @@
#include <ctype.h>
#include <dwarf.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <inttypes.h>
diff --git src/size.c src/size.c
index 0e7e41e..0297fc0 100644
--- src/size.c
+++ src/size.c
@@ -21,7 +21,7 @@
#endif
#include <argp.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <inttypes.h>
diff --git src/stack.c src/stack.c
index c277dfd..d85858e 100644
--- src/stack.c
+++ src/stack.c
@@ -18,7 +18,7 @@
#include <config.h>
#include <assert.h>
#include <argp.h>
-#include <error.h>
+#include <err.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdio.h>
diff --git src/strings.c src/strings.c
index dae6ab2..9685c92 100644
--- src/strings.c
+++ src/strings.c
@@ -25,7 +25,7 @@
#include <ctype.h>
#include <endian.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <inttypes.h>
diff --git src/strip.c src/strip.c
index 1b34eee..204e3d8 100644
--- src/strip.c
+++ src/strip.c
@@ -24,7 +24,7 @@
#include <assert.h>
#include <byteswap.h>
#include <endian.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <libelf.h>
diff --git src/unstrip.c src/unstrip.c
index 989ac5f..ed3e483 100644
--- src/unstrip.c
+++ src/unstrip.c
@@ -31,7 +31,7 @@
#include <argp.h>
#include <assert.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <libintl.h>
diff --git tests/addrscopes.c tests/addrscopes.c
index fca61d3..f33cae4 100644
--- tests/addrscopes.c
+++ tests/addrscopes.c
@@ -25,7 +25,7 @@
#include <stdio_ext.h>
#include <locale.h>
#include <stdlib.h>
-#include <error.h>
+#include <err.h>
#include <string.h>
diff --git tests/allregs.c tests/allregs.c
index b103ce1..675234a 100644
--- tests/allregs.c
+++ tests/allregs.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <error.h>
+#include <err.h>
#include <locale.h>
#include <argp.h>
#include <assert.h>
diff --git tests/backtrace-data.c tests/backtrace-data.c
index 01c1c00..0a10611 100644
--- tests/backtrace-data.c
+++ tests/backtrace-data.c
@@ -27,7 +27,7 @@
#include <dirent.h>
#include <stdlib.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <unistd.h>
#include <dwarf.h>
#include <sys/resource.h>
diff --git tests/backtrace.c tests/backtrace.c
index 46af9b5..9e45fbe 100644
--- tests/backtrace.c
+++ tests/backtrace.c
@@ -24,7 +24,7 @@
#include <dirent.h>
#include <stdlib.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <unistd.h>
#include <dwarf.h>
#include <sys/resource.h>
diff --git tests/buildid.c tests/buildid.c
index 87c1877..2953e6b 100644
--- tests/buildid.c
+++ tests/buildid.c
@@ -23,7 +23,7 @@
#include ELFUTILS_HEADER(elf)
#include ELFUTILS_HEADER(dwelf)
#include <stdio.h>
-#include <error.h>
+#include <err.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
diff --git tests/debugaltlink.c tests/debugaltlink.c
index 6d97d50..ee7e559 100644
--- tests/debugaltlink.c
+++ tests/debugaltlink.c
@@ -23,7 +23,7 @@
#include ELFUTILS_HEADER(dw)
#include ELFUTILS_HEADER(dwelf)
#include <stdio.h>
-#include <error.h>
+#include <err.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
diff --git tests/debuglink.c tests/debuglink.c
index 935d102..741cb81 100644
--- tests/debuglink.c
+++ tests/debuglink.c
@@ -21,7 +21,7 @@
#include <errno.h>
#include ELFUTILS_HEADER(dwelf)
#include <stdio.h>
-#include <error.h>
+#include <err.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
diff --git tests/dwfl-addr-sect.c tests/dwfl-addr-sect.c
index 21e470a..1ea1e3b 100644
--- tests/dwfl-addr-sect.c
+++ tests/dwfl-addr-sect.c
@@ -23,7 +23,7 @@
#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
-#include <error.h>
+#include <err.h>
#include <locale.h>
#include <argp.h>
#include ELFUTILS_HEADER(dwfl)
diff --git tests/dwfl-bug-addr-overflow.c tests/dwfl-bug-addr-overflow.c
index aa8030e..02c8bef 100644
--- tests/dwfl-bug-addr-overflow.c
+++ tests/dwfl-bug-addr-overflow.c
@@ -20,7 +20,7 @@
#include <inttypes.h>
#include <stdio.h>
#include <stdio_ext.h>
-#include <error.h>
+#include <err.h>
#include <locale.h>
#include ELFUTILS_HEADER(dwfl)
diff --git tests/dwfl-bug-fd-leak.c tests/dwfl-bug-fd-leak.c
index 170a61a..d80deb9 100644
--- tests/dwfl-bug-fd-leak.c
+++ tests/dwfl-bug-fd-leak.c
@@ -24,7 +24,7 @@
#include <dirent.h>
#include <stdlib.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <unistd.h>
#include <dwarf.h>
#include <sys/resource.h>
diff --git tests/dwfl-bug-getmodules.c tests/dwfl-bug-getmodules.c
index 1ee989f..fd62e65 100644
--- tests/dwfl-bug-getmodules.c
+++ tests/dwfl-bug-getmodules.c
@@ -18,7 +18,7 @@
#include <config.h>
#include ELFUTILS_HEADER(dwfl)
-#include <error.h>
+#include <err.h>
static const Dwfl_Callbacks callbacks =
{
diff --git tests/dwfl-report-elf-align.c tests/dwfl-report-elf-align.c
index a4e97d3..f471587 100644
--- tests/dwfl-report-elf-align.c
+++ tests/dwfl-report-elf-align.c
@@ -20,7 +20,7 @@
#include <inttypes.h>
#include <stdio.h>
#include <stdio_ext.h>
-#include <error.h>
+#include <err.h>
#include <locale.h>
#include <string.h>
#include <stdlib.h>
diff --git tests/dwfllines.c tests/dwfllines.c
index 90379dd..cbdf6c4 100644
--- tests/dwfllines.c
+++ tests/dwfllines.c
@@ -27,7 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <error.h>
+#include <err.h>
int
main (int argc, char *argv[])
diff --git tests/dwflmodtest.c tests/dwflmodtest.c
index 0027f96..e68d3bc 100644
--- tests/dwflmodtest.c
+++ tests/dwflmodtest.c
@@ -23,7 +23,7 @@
#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
-#include <error.h>
+#include <err.h>
#include <locale.h>
#include <argp.h>
#include ELFUTILS_HEADER(dwfl)
diff --git tests/dwflsyms.c tests/dwflsyms.c
index 49ac334..cf07830 100644
--- tests/dwflsyms.c
+++ tests/dwflsyms.c
@@ -25,7 +25,7 @@
#include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
-#include <error.h>
+#include <err.h>
#include <string.h>
static const char *
diff --git tests/early-offscn.c tests/early-offscn.c
index 924cb9e..6f60d5a 100644
--- tests/early-offscn.c
+++ tests/early-offscn.c
@@ -19,7 +19,7 @@
#endif
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <stdio.h>
diff --git tests/ecp.c tests/ecp.c
index 39a4851..c4de16a 100644
--- tests/ecp.c
+++ tests/ecp.c
@@ -16,7 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <stdlib.h>
diff --git tests/find-prologues.c tests/find-prologues.c
index ba8ae37..76f5f04 100644
--- tests/find-prologues.c
+++ tests/find-prologues.c
@@ -25,7 +25,7 @@
#include <stdio_ext.h>
#include <locale.h>
#include <stdlib.h>
-#include <error.h>
+#include <err.h>
#include <string.h>
#include <fnmatch.h>
diff --git tests/funcretval.c tests/funcretval.c
index 8d19d11..c8aaa93 100644
--- tests/funcretval.c
+++ tests/funcretval.c
@@ -25,7 +25,7 @@
#include <stdio_ext.h>
#include <locale.h>
#include <stdlib.h>
-#include <error.h>
+#include <err.h>
#include <string.h>
#include <fnmatch.h>
diff --git tests/funcscopes.c tests/funcscopes.c
index 720ff3b..01afbe1 100644
--- tests/funcscopes.c
+++ tests/funcscopes.c
@@ -25,7 +25,7 @@
#include <stdio_ext.h>
#include <locale.h>
#include <stdlib.h>
-#include <error.h>
+#include <err.h>
#include <string.h>
#include <fnmatch.h>
diff --git tests/line2addr.c tests/line2addr.c
index 7c171b9..8ea266b 100644
--- tests/line2addr.c
+++ tests/line2addr.c
@@ -26,7 +26,7 @@
#include <locale.h>
#include <stdlib.h>
#include <string.h>
-#include <error.h>
+#include <err.h>
static void
diff --git tests/low_high_pc.c tests/low_high_pc.c
index d0f4302..8da4fbd 100644
--- tests/low_high_pc.c
+++ tests/low_high_pc.c
@@ -25,7 +25,7 @@
#include <stdio_ext.h>
#include <locale.h>
#include <stdlib.h>
-#include <error.h>
+#include <err.h>
#include <string.h>
#include <fnmatch.h>
diff --git tests/md5-sha1-test.c tests/md5-sha1-test.c
index 49de078..d4ab508 100644
--- tests/md5-sha1-test.c
+++ tests/md5-sha1-test.c
@@ -19,7 +19,7 @@
#endif
#include <string.h>
-#include <error.h>
+#include <err.h>
#include "md5.h"
#include "sha1.h"
diff --git tests/rdwrmmap.c tests/rdwrmmap.c
index 95a4df3..9849b07 100644
--- tests/rdwrmmap.c
+++ tests/rdwrmmap.c
@@ -15,7 +15,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
diff --git tests/saridx.c tests/saridx.c
index 8a450d8..b387801 100644
--- tests/saridx.c
+++ tests/saridx.c
@@ -17,7 +17,7 @@
#include <config.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <stdio.h>
diff --git tests/sectiondump.c tests/sectiondump.c
index f865954..83ef20d 100644
--- tests/sectiondump.c
+++ tests/sectiondump.c
@@ -18,7 +18,7 @@
#include <config.h>
#include <errno.h>
-#include <error.h>
+#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <inttypes.h>
diff --git tests/varlocs.c tests/varlocs.c
index 04f17ff..af8a6c9 100644
--- tests/varlocs.c
+++ tests/varlocs.c
@@ -25,7 +25,7 @@
#include <dwarf.h>
#include <stdio.h>
#include <stdlib.h>
-#include <error.h>
+#include <err.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>

View file

@ -0,0 +1,17 @@
--- libcpu/i386_disasm.c 2015-08-21 14:22:37.000000000 +0200
+++ libcpu/i386_disasm.c 2015-11-20 06:30:59.250629957 +0100
@@ -1,4 +1,4 @@
-/* Disassembler for x86.
+/* Disassembler for x86.
Copyright (C) 2007, 2008, 2009, 2011 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2007.
@@ -710,6 +710,7 @@
case 'm':
/* Mnemonic. */
+ str = mnebuf;
if (unlikely (instrtab[cnt].mnemonic == MNE_INVALID))
{

View file

@ -0,0 +1,13 @@
--- src/strip.c 2015-10-12 12:22:58.000000000 +0200
+++ src/strip.c 2015-11-20 07:44:13.626287111 +0100
@@ -44,6 +44,10 @@
#include <libebl.h>
#include <system.h>
+#if !defined(ACCESSPERMS)
+#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO)
+#endif
+
typedef uint8_t GElf_Byte;
/* Name and version of program. */

View file

@ -0,0 +1,22 @@
--- libdwfl/dwfl_build_id_find_elf.c 2015-10-12 12:22:58.000000000 +0200
+++ libdwfl/dwfl_build_id_find_elf.c 2015-11-20 05:13:10.972994172 +0100
@@ -94,7 +94,7 @@
{
if (*file_name != NULL)
free (*file_name);
- *file_name = canonicalize_file_name (name);
+ *file_name = realpath (name, NULL);
if (*file_name == NULL)
{
*file_name = name;
--- libdwfl/find-debuginfo.c 2015-10-12 12:22:58.000000000 +0200
+++ libdwfl/find-debuginfo.c 2015-11-20 05:18:56.990967176 +0100
@@ -372,7 +372,7 @@
/* If FILE_NAME is a symlink, the debug file might be associated
with the symlink target name instead. */
- char *canon = canonicalize_file_name (file_name);
+ char *canon = realpath (file_name, NULL);
if (canon != NULL && strcmp (file_name, canon))
fd = find_debuginfo_in_path (mod, canon,
debuglink_file, debuglink_crc,

View file

@ -0,0 +1,20 @@
--- libelf/elf.h 2015-08-21 14:22:37.000000000 +0200
+++ libelf/elf.h 2015-11-20 04:54:33.948081321 +0100
@@ -21,6 +21,17 @@
#include <features.h>
+#if !defined(__GLIBC__)
+/* C++ needs to know that types and declarations are C, not C++. */
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS
+# define __END_DECLS
+#endif
+#endif
+
__BEGIN_DECLS
/* Standard ELF types. */

View file

@ -0,0 +1,17 @@
--- lib/fixedsizehash.h 2015-08-21 14:22:37.000000000 +0200
+++ lib/fixedsizehash.h 2015-11-20 05:05:45.648028916 +0100
@@ -30,12 +30,12 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <system.h>
-#define CONCAT(t1,t2) __CONCAT (t1,t2)
+#define CONCAT1(x,y) x##y
+#define CONCAT(x,y) CONCAT1(x,y)
/* Before including this file the following macros must be defined:

View file

@ -0,0 +1,122 @@
--- configure.ac 2015-10-15 15:16:57.000000000 +0200
+++ configure.ac 2015-11-20 05:32:57.723901582 +0100
@@ -305,6 +305,62 @@
fi
AC_SUBST([argp_LDADD])
+dnl Check if we have fts available from our libc
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#if !defined(__x86_64__)
+ #undef _FILE_OFFSET_BITS
+ #define _FILE_OFFSET_BITS 32
+ #endif
+ #include <fts.h>],
+ [FTS* fts = 0; return fts_close(fts); return 0;]
+ )],
+ [libc_has_fts="true"],
+ [libc_has_fts="false"]
+)
+
+dnl If our libc doesn't provide fts, then test for libfts
+if test "$libc_has_fts" = "false" ; then
+ AC_MSG_WARN("libc does not have fts")
+ AC_CHECK_LIB([fts], [fts_close], [have_fts="true"], [have_fts="false"])
+
+ if test "$have_fts" = "false"; then
+ AC_MSG_ERROR("no libfts found")
+ else
+ fts_LDADD="-lfts"
+ fi
+else
+ fts_LDADD=""
+fi
+AC_SUBST([fts_LDADD])
+
+dnl Check if we have obstack available from our libc
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <obstack.h>],
+ [_obstack_begin(0, 0, 0, NULL, NULL); return 0;]
+ )],
+ [libc_has_obstack="true"],
+ [libc_has_obstack="false"]
+)
+
+dnl If our libc doesn't provide obstack, then test for libobstack
+if test "$libc_has_obstack" = "false" ; then
+ AC_MSG_WARN("libc does not have obstack")
+ AC_CHECK_LIB([obstack], [_obstack_begin], [have_obstack="true"], [have_obstack="false"])
+
+ if test "$have_obstack" = "false"; then
+ AC_MSG_ERROR("no libobstack found")
+ else
+ obstack_LDADD="-lobstack"
+ fi
+else
+ obstack_LDADD=""
+fi
+AC_SUBST([obstack_LDADD])
+
+dnl The directories with content.
+
dnl The directories with content.
dnl Documentation.
--- libdw/Makefile.am 2015-10-07 03:39:16.000000000 +0200
+++ libdw/Makefile.am 2015-11-20 08:18:04.225128686 +0100
@@ -112,7 +112,7 @@
-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
-Wl,--version-script,$<,--no-undefined \
-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
- -ldl $(argp_LDADD) $(zip_LIBS)
+ -ldl $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(zip_LIBS)
@$(textrel_check)
$(AM_V_at)ln -fs $@ $@.$(VERSION)
--- src/Makefile.am 2015-10-12 12:23:15.000000000 +0200
+++ src/Makefile.am 2015-11-20 08:20:23.148117847 +0100
@@ -104,27 +104,28 @@
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 \
+readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
+nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl \
$(demanglelib)
-size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
-strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
-ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+size_LDADD = $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
+strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
+ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
if NATIVE_LD
# -ldl is always needed for libebl.
ld_LDADD += libld_elf.a
endif
ld_LDFLAGS = -rdynamic
-elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
-findtextrel_LDADD = $(libdw) $(libelf) $(argp_LDADD)
-addr2line_LDADD = $(libdw) $(libelf) $(argp_LDADD) $(demanglelib)
-elfcmp_LDADD = $(libebl) $(libelf) $(argp_LDADD) -ldl
-objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
-ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
-strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
-ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD)
-unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl
-stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl $(demanglelib)
+elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
+findtextrel_LDADD = $(libdw) $(libelf) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
+addr2line_LDADD = $(libdw) $(libelf) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) $(demanglelib)
+elfcmp_LDADD = $(libebl) $(libelf) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
+objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
+ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
+strings_LDADD = $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
+ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD)
+unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl
+stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(fts_LDADD) $(obstack_LDADD) -ldl \
+ $(demanglelib)
ldlex.o: ldscript.c
ldlex_no_Werror = yes

View file

@ -0,0 +1,71 @@
--- libdw/libdw.h 2015-08-21 14:22:37.000000000 +0200
+++ libdw/libdw.h 2015-11-20 08:31:14.160067056 +0100
@@ -33,7 +33,27 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include <unistd.h>
+#include <alloca.h>
+#include <string.h>
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+ (__extension__ \
+ ({ long int __result; \
+ do __result = (long int) (expression); \
+ while (__result == -1L && errno == EINTR); \
+ __result; }))
+#endif
+
+#ifndef strndupa
+#define strndupa(s, n) \
+ (__extension__ ({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
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
# define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))
--- src/ld.h 2015-08-21 14:22:37.000000000 +0200
+++ src/ld.h 2015-11-20 07:58:05.722222192 +0100
@@ -24,6 +24,19 @@
#include <stdio.h>
#include "xelf.h"
+#if !defined(DL_CALL_FCT)
+# define DL_CALL_FCT(fctp, args) (*fctp) args
+#endif /* !defined(DL_CALL_FCT) */
+
+#if !defined(ACCESSPERMS)
+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+#endif
+#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
/* Recommended size of the buffer passed to ld_strerror. */
#define ERRBUFSIZE (512)
--- src/arlib.h 2015-08-21 14:22:37.000000000 +0200
+++ src/arlib.h 2015-11-20 08:02:55.153199611 +0100
@@ -29,6 +29,16 @@
#include <stdint.h>
#include <sys/types.h>
+#if !defined(ACCESSPERMS)
+# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
+#endif
+#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;

View file

@ -0,0 +1,24 @@
--- src/nm.c 2015-08-21 14:22:37.000000000 +0200
+++ src/nm.c 2015-11-20 07:31:20.508347429 +0100
@@ -46,6 +46,21 @@
#include <system.h>
#include "../libebl/libeblP.h"
+#if !defined(__GLIBC__)
+static int obstack_printf(struct obstack *obst, const char *fmt, ...)
+{
+ char buf[1024];
+ va_list ap;
+ int len;
+
+ va_start(ap, fmt);
+ len = vsnprintf(buf, sizeof(buf), fmt, ap);
+ obstack_grow(obst, buf, len);
+ va_end(ap);
+
+ return len;
+}
+#endif
/* Name and version of program. */
static void print_version (FILE *stream, struct argp_state *state);

View file

@ -0,0 +1,27 @@
--- src/ldgeneric.c 2015-08-21 14:22:37.000000000 +0200
+++ src/ldgeneric.c 2015-11-20 08:25:42.003092970 +0100
@@ -2628,12 +2628,12 @@
}
-/* Callback function registered with on_exit to make sure the temporary
+/* Callback function registered with atexit to make sure the temporary
files gets removed if something goes wrong. */
static void
-remove_tempfile (int status, void *arg)
+remove_tempfile (void)
{
- if (status != 0 && ld_state.tempfname != NULL)
+ if (error_message_count != 0 && ld_state.tempfname != NULL)
unlink (ld_state.tempfname);
}
@@ -2680,7 +2680,7 @@
/* Make sure we remove the temporary file in case something goes
wrong. */
- on_exit (remove_tempfile, NULL);
+ atexit (remove_tempfile);
/* Create the ELF file data for the output file. */
Elf *elf = ld_state.outelf = elf_begin (fd,

View file

@ -0,0 +1,56 @@
--- src/readelf.c 2015-10-12 12:22:58.000000000 +0200
+++ src/readelf.c 2015-11-20 08:11:32.945159213 +0100
@@ -4366,10 +4366,11 @@
return base;
}
+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;
@@ -4385,21 +4386,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);
}
}
@@ -4464,9 +4465,11 @@
static void
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);
+ if (table->n > 0) {
+ listptr_name = name;
+ qsort (table->table, table->n, sizeof table->table[0],
+ &compare_listptr);
+ }
}
static bool

View file

@ -0,0 +1,11 @@
--- libelf/elf_getarsym.c 2015-10-12 12:22:58.000000000 +0200
+++ libelf/elf_getarsym.c 2015-11-20 05:01:57.762046695 +0100
@@ -297,7 +297,7 @@
arsym[cnt].as_off = (*u32)[cnt];
arsym[cnt].as_hash = _dl_elf_hash (str_data);
- str_data = rawmemchr (str_data, '\0') + 1;
+ str_data = memchr (str_data, '\0', SIZE_MAX) + 1;
}
/* At the end a special entry. */

View file

@ -0,0 +1,31 @@
--- lib/system.h 2015-08-21 14:22:37.000000000 +0200
+++ lib/system.h 2015-11-20 04:36:49.563164363 +0100
@@ -35,6 +35,7 @@
#include <endian.h>
#include <byteswap.h>
#include <unistd.h>
+#include <fcntl.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
# define LE32(n) (n)
@@ -50,6 +50,20 @@
# error "Unknown byte order"
#endif
+#if !defined(__GLIBC__)
+
+/* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno'
+ set to EINTR. */
+
+# define TEMP_FAILURE_RETRY(expression) \
+ (__extension__ \
+ ({ long int __result; \
+ do __result = (long int) (expression); \
+ while (__result == -1L && errno == EINTR); \
+ __result; }))
+
+#endif
+
extern void *xmalloc (size_t) __attribute__ ((__malloc__));
extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
extern void *xrealloc (void *, size_t) __attribute__ ((__malloc__));

View file

@ -0,0 +1,19 @@
--- libdwfl/dwfl_error.c 2015-09-29 17:18:51.000000000 +0200
+++ libdwfl/dwfl_error.c 2015-11-20 05:11:29.889002058 +0100
@@ -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 (0 == strerror_r(error & 0xffff, buf, sizeof(buf)))
+ return buf;
+ }
+ return "strerror_r() failed";
+#endif
case OTHER_ERROR (LIBELF):
return elf_errmsg (error & 0xffff);
case OTHER_ERROR (LIBDW):

View file

@ -0,0 +1,11 @@
--- libebl/eblwstrtab.c 2015-08-21 14:22:37.000000000 +0200
+++ libebl/eblwstrtab.c 2015-11-20 05:07:55.650018773 +0100
@@ -305,7 +305,7 @@
/* Process the current node. */
nodep->offset = *offsetp;
- *freep = wmempcpy (*freep, nodep->string, nodep->len);
+ *freep = wmemcpy (*freep, nodep->string, nodep->len) + nodep->len;
*offsetp += nodep->len * sizeof (wchar_t);
for (subs = nodep->next; subs != NULL; subs = subs->next)

View file

@ -1,36 +1,34 @@
# Template file for 'elfutils'
pkgname=elfutils
version=0.161
revision=3
version=0.164
revision=1
build_style=gnu-configure
configure_args="--program-prefix=eu-"
hostmakedepends="m4"
hostmakedepends="automake libtool"
makedepends="zlib-devel bzip2-devel liblzma-devel"
short_desc="Utilities to handle ELF object files"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-3"
homepage="https://fedorahosted.org/elfutils/"
distfiles="https://fedorahosted.org/releases/e/l/${pkgname}/${version}/${pkgname}-${version}.tar.bz2"
checksum=570c91a1783fa5386aaa2dfdd08dda1de777c2b63bf3b9c1437d635ffdd7a070
checksum=9683c025928a12d06b7fe812928aa6235249e22d197d086f7084606a48165900
CFLAGS="-Wno-unused-result"
# Suppress certain warnings to not fail for -Werror
CFLAGS="-Wno-unused-result -Wno-format-nonliteral"
case "$XBPS_TARGET_MACHINE" in
*-musl) makedepends+=" argp-standalone" ;;
*-musl) makedepends+=" argp-standalone musl-fts musl-obstack" ;;
esac
post_extract() {
sed -i '/<linux\/uio.h>/d' backends/*_initreg.c
case "$XBPS_TARGET_MACHINE" in
*-musl) patch -Np0 <${FILESDIR}/009-no-fts.patch
*-musl) cp ${FILESDIR}/error.h lib
cp ${FILESDIR}/error.h src
esac
}
do_configure() {
case "$XBPS_TARGET_MACHINE" in
*-musl) export LIBS="-largp" ;;
esac
./configure ${configure_args}
pre_configure() {
autoreconf -if
}
libelf_package() {