elfutils: import package from packages.git

elfutils is required by perf. So we'll move this package from
packages.git and make it part of the core distribution.

Signed-off-by: Mathieu Olivari <mathieu@codeaurora.org>

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45969 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Felix Fietkau 2015-06-14 17:43:40 +00:00
parent fe3348e669
commit e605221325
10 changed files with 2988 additions and 0 deletions

View File

@ -0,0 +1,97 @@
#
# Copyright (C) 2010-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=elfutils
PKG_VERSION:=0.161
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://fedorahosted.org/releases/e/l/$(PKG_NAME)/$(PKG_VERSION)
PKG_MD5SUM:=e1b9847c9a6a1ad340de8d47a863ec52
PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
PKG_LICENSE:=GPL-3.0+
PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3
PKG_INSTALL:=1
PKG_USE_MIPS16:=0
PKG_BUILD_DEPENDS:=USE_UCLIBC:argp-standalone USE_MUSL:argp-standalone
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/elfutils/Default
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=$(INTL_DEPENDS)
TITLE:=ELF manipulation libraries
URL:=https://fedorahosted.org/elfutils/
endef
define Package/libasm
$(call Package/elfutils/Default)
TITLE+= (libasm)
DEPENDS:=libelf1
endef
define Package/libdw
$(call Package/elfutils/Default)
DEPENDS:=libelf1 +zlib +libbz2
TITLE+= (libdw)
endef
define Package/libelf1
$(call Package/elfutils/Default)
TITLE+= (libelf)
endef
ifeq ($(CONFIG_BUILD_NLS),y)
TARGET_LDFLAGS += "-lintl"
endif
ifdef CONFIG_USE_UCLIBC
CONFIGURE_VARS += \
LIBS="-largp"
endif
ifdef CONFIG_USE_MUSL
CONFIGURE_VARS += \
LIBS="-largp"
endif
CONFIGURE_ARGS += \
--disable-werror \
--without-lzma
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libasm/libasm.{a,so*} $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/libdw/libdw.{a,so*} $(1)/usr/lib/
$(CP) $(PKG_BUILD_DIR)/libelf/libelf.{a,so*} $(1)/usr/lib/
endef
define Package/libasm/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libasm/libasm.so* $(1)/usr/lib/
endef
define Package/libdw/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libdw/libdw.so* $(1)/usr/lib/
endef
define Package/libelf1/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/libelf/libelf.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libasm))
$(eval $(call BuildPackage,libdw))
$(eval $(call BuildPackage,libelf1))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
--- elfutils-0.160/lib/color.c.old 2014-11-06 03:46:43.584116134 -0200
+++ elfutils-0.160/lib/color.c 2014-11-06 03:47:25.840116128 -0200
@@ -131,8 +131,10 @@
- '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

@ -0,0 +1,49 @@
--- elfutils-0.160/libelf/libelfP.h.old 2014-11-06 01:47:55.420116984 -0200
+++ elfutils-0.160/libelf/libelfP.h 2014-11-06 01:48:33.368116980 -0200
@@ -43,6 +43,9 @@
#include <string.h>
+#ifdef _ /* fix libintl-stub */
+#undef _
+#endif
/* gettext helper macros. */
#define _(Str) dgettext ("elfutils", Str)
--- elfutils-0.160/libdw/libdwP.h.old 2014-11-06 02:27:12.628116703 -0200
+++ elfutils-0.160/libdw/libdwP.h 2014-11-06 02:27:39.816116700 -0200
@@ -36,7 +36,9 @@
#include <libdw.h>
#include <dwarf.h>
-
+#ifdef _ /* fix libintl-stub */
+#undef _
+#endif
/* gettext helper macros. */
#define _(Str) dgettext ("elfutils", Str)
--- elfutils-0.160/libdwfl/libdwflP.h.old 2014-11-06 02:31:20.112116673 -0200
+++ elfutils-0.160/libdwfl/libdwflP.h 2014-11-06 02:33:00.548116661 -0200
@@ -46,6 +46,9 @@
typedef struct Dwfl_Process Dwfl_Process;
+#ifdef _ /* fix libintl-stub */
+#undef _
+#endif
/* gettext helper macros. */
#define _(Str) dgettext ("elfutils", Str)
--- elfutils-0.160/libasm/libasmP.h.old 2014-11-06 02:31:32.064116672 -0200
+++ elfutils-0.160/libasm/libasmP.h 2014-11-06 02:33:08.656116660 -0200
@@ -33,6 +33,9 @@
#include <libasm.h>
+#ifdef _ /* fix libintl-stub */
+#undef _
+#endif
/* gettext helper macros. */
#define _(Str) dgettext ("elfutils", Str)

View File

@ -0,0 +1,11 @@
--- elfutils-0.160/libelf/elf_getarsym.c.org 2014-11-06 01:56:58.664116919 -0200
+++ elfutils-0.160/libelf/elf_getarsym.c 2014-11-06 01:57:09.396116918 -0200
@@ -166,7 +166,7 @@
/* 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

@ -0,0 +1,14 @@
--- a/libelf/libelf.h
+++ b/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

@ -0,0 +1,24 @@
--- elfutils-0.160/Makefile.in.old 2014-11-06 03:56:04.828116067 -0200
+++ elfutils-0.160/Makefile.in 2014-11-06 03:57:03.380116060 -0200
@@ -359,8 +359,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
+SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libasm
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
COPYING COPYING-GPLV2 COPYING-LGPLV3
--- elfutils-0.160/Makefile.am.old 2014-11-06 03:58:13.012116051 -0200
+++ elfutils-0.160/Makefile.am 2014-11-06 03:58:25.948116050 -0200
@@ -23,8 +23,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
+SUBDIRS = config m4 lib libelf libebl libdwelf libdwfl libdw libasm
EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
COPYING COPYING-GPLV2 COPYING-LGPLV3

View File

@ -0,0 +1,11 @@
--- elfutils-0.161/libdw/Makefile.in.orig 2015-01-16 03:50:15.311237461 -0200
+++ elfutils-0.161/libdw/Makefile.in 2015-01-16 03:55:35.082090075 -0200
@@ -969,7 +969,7 @@
-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

@ -0,0 +1,788 @@
--- a/lib/system.h
+++ b/lib/system.h
@@ -68,6 +68,16 @@ extern int crc32_file (int fd, uint32_t
#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)
--- a/lib/color.c
+++ b/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>
--- a/lib/xmalloc.c
+++ b/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>
--- a/src/addr2line.c
+++ b/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>
--- a/src/ar.c
+++ b/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>
--- a/src/arlib2.c
+++ b/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>
--- a/src/arlib.c
+++ b/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>
--- a/src/elfcmp.c
+++ b/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>
--- a/src/elflint.c
+++ b/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>
--- a/src/findtextrel.c
+++ b/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>
--- a/src/i386_ld.c
+++ b/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>
--- a/src/ld.c
+++ b/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>
--- a/src/ldgeneric.c
+++ b/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>
--- a/src/ldlex.c
+++ b/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>
--- a/src/ldscript.c
+++ b/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
--- a/src/nm.c
+++ b/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>
--- a/src/objdump.c
+++ b/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>
--- a/src/ranlib.c
+++ b/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>
--- a/src/readelf.c
+++ b/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>
--- a/src/size.c
+++ b/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>
--- a/src/stack.c
+++ b/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>
--- a/src/strings.c
+++ b/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>
--- a/src/strip.c
+++ b/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>
--- a/src/unstrip.c
+++ b/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>
--- a/tests/addrscopes.c
+++ b/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>
--- a/tests/allregs.c
+++ b/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>
--- a/tests/backtrace.c
+++ b/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>
--- a/tests/backtrace-data.c
+++ b/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>
--- a/tests/buildid.c
+++ b/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>
--- a/tests/debugaltlink.c
+++ b/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>
--- a/tests/debuglink.c
+++ b/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>
--- a/tests/dwfl-addr-sect.c
+++ b/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)
--- a/tests/dwfl-bug-addr-overflow.c
+++ b/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)
--- a/tests/dwfl-bug-fd-leak.c
+++ b/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>
--- a/tests/dwfl-bug-getmodules.c
+++ b/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 =
{
--- a/tests/dwfllines.c
+++ b/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[])
--- a/tests/dwflmodtest.c
+++ b/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)
--- a/tests/dwfl-report-elf-align.c
+++ b/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>
--- a/tests/dwflsyms.c
+++ b/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 *
--- a/tests/early-offscn.c
+++ b/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>
--- a/tests/ecp.c
+++ b/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>
--- a/tests/find-prologues.c
+++ b/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>
--- a/tests/funcretval.c
+++ b/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>
--- a/tests/funcscopes.c
+++ b/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>
--- a/tests/line2addr.c
+++ b/tests/line2addr.c
@@ -26,7 +26,7 @@
#include <locale.h>
#include <stdlib.h>
#include <string.h>
-#include <error.h>
+#include <err.h>
static void
--- a/tests/low_high_pc.c
+++ b/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>
--- a/tests/md5-sha1-test.c
+++ b/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"
--- a/tests/rdwrmmap.c
+++ b/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>
--- a/tests/saridx.c
+++ b/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>
--- a/tests/sectiondump.c
+++ b/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>
--- a/tests/varlocs.c
+++ b/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>
--- a/libelf/libelf.h
+++ b/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. */
--- a/libasm/asm_end.c
+++ b/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>
--- a/libasm/asm_newscn.c
+++ b/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>
--- a/libcpu/i386_gendis.c
+++ b/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>
--- a/libcpu/i386_lex.c
+++ b/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>
--- a/libcpu/i386_lex.l
+++ b/libcpu/i386_lex.l
@@ -31,7 +31,7 @@
#endif
#include <ctype.h>
-#include <error.h>
+#include <err.h>
#include <libintl.h>
#include <system.h>
--- a/libcpu/i386_parse.c
+++ b/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>
--- a/libdw/libdw_alloc.c
+++ b/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 ("hid
__libdw_oom (void)
{
while (1)
- error (EXIT_FAILURE, ENOMEM, "libdw");
+ err (EXIT_FAILURE, "libdw: out of memory");
}
--- a/libebl/eblopenbackend.c
+++ b/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>
--- a/src/ldlex.l
+++ b/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>
--- a/libebl/eblwstrtab.c
+++ b/libebl/eblwstrtab.c
@@ -305,7 +305,7 @@ copystrings (struct Ebl_WStrent *nodep,
/* 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)
--- a/libdwfl/dwfl_error.c
+++ b/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):
--- a/libdwfl/libdwfl.h
+++ b/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;
--- a/libdwfl/find-debuginfo.c
+++ b/libdwfl/find-debuginfo.c
@@ -338,7 +338,7 @@ dwfl_standard_find_debuginfo (Dwfl_Modul
/* 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,
--- a/libdwfl/dwfl_build_id_find_elf.c
+++ b/libdwfl/dwfl_build_id_find_elf.c
@@ -80,7 +80,7 @@ __libdwfl_open_by_build_id (Dwfl_Module
{
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;
--- a/libelf/elf_getarsym.c
+++ b/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. */

View File

@ -0,0 +1,109 @@
--- a/libdwfl/argp-std.c
+++ b/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_callbac
.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 ar
}
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;
--- a/libdwfl/Makefile.in
+++ b/libdwfl/Makefile.in
@@ -113,7 +113,7 @@ am__libdwfl_a_SOURCES_DIST = dwfl_begin.
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.$(OBJE
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_en
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@