Commit 069c1fd2 authored by cem's avatar cem
Browse files

Add elfutils 0.163

Elfutils is a collection of utilities, including: stack (to show
backtraces); nm (for listing symbols from object files); size (for
listing the section sizes of an object or archive file); strip (for
discarding symbols); readelf (to see the raw ELF file structures);
elflint (to check for well-formed ELF files); and elfcompress (to
compress or decompress ELF sections).

It also provides libraries to allow other programs to manipulate ELF and
DWARF data.

WWW:	https://fedorahosted.org/elfutils/

Reviewed by:	bdrewery
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D7206
parent 305ca93a
......@@ -429,6 +429,7 @@
SUBDIR += elfrc
SUBDIR += elfsh
SUBDIR += elftoaout
SUBDIR += elfutils
SUBDIR += elixir-apex
SUBDIR += elixir-bson
SUBDIR += elixir-calendar
......
# Created by: Conrad Meyer <cem@FreeBSD.org>
# $FreeBSD$
PORTNAME= elfutils
PORTVERSION= 0.163
CATEGORIES= devel
MASTER_SITES= https://fedorahosted.org/releases/e/l/elfutils/
MAINTAINER= cem@FreeBSD.org
COMMENT= Library for manipulating ELF files and partial implementation of binutils
LICENSE= LGPL3 GPLv2 GPLv3
LICENSE_COMB= multi
LICENSE_FILE_GPLv3= ${WRKSRC}/COPYING
LICENSE_FILE_GPLv2= ${WRKSRC}/COPYING-GPLV2
LICENSE_FILE_LGPL3= ${WRKSRC}/COPYING-LGPLV3
BUILD_DEPENDS= gnulib>=0:devel/gnulib
OPTIONS_DEFINE= NLS
OPTIONS_SUB= yes
NLS_USES= gettext
NLS_CONFIGURE_ENABLE= nls
USES= gmake libtool tar:bzip2
USE_AUTOTOOLS= automake
USE_GCC= 4.9+
GNU_CONFIGURE= yes
# Avoid conflict with binutils / elftoolchain programs with the same names:
CONFIGURE_ARGS+= --program-prefix=eu-
post-patch:
@cd $(WRKSRC) && ${AUTOMAKE}
@${CP} -a \
$(LOCALBASE)/share/gnulib/lib/obstack.c \
$(LOCALBASE)/share/gnulib/lib/obstack.h \
$(LOCALBASE)/share/gnulib/lib/obstack_printf.c \
$(WRKSRC)/lib
.include <bsd.port.mk>
TIMESTAMP = 1468426694
SHA256 (elfutils-0.163.tar.bz2) = 7c774f1eef329309f3b05e730bdac50013155d437518a2ec0e24871d312f2e23
SIZE (elfutils-0.163.tar.bz2) = 6029307
--- backends/x86_64_initreg.c.orig 2014-06-17 18:51:09 UTC
+++ backends/x86_64_initreg.c
@@ -32,6 +32,7 @@
#include <stdlib.h>
#ifdef __x86_64__
+# include <sys/types.h>
# include <sys/user.h>
# include <sys/ptrace.h>
#endif
--- lib/Makefile.am.orig 2016-07-13 07:11:15 UTC
+++ lib/Makefile.am
@@ -35,7 +35,7 @@ noinst_LIBRARIES = libeu.a
libeu_a_SOURCES = xstrdup.c xstrndup.c xmalloc.c next_prime.c \
crc32.c crc32_file.c md5.c sha1.c \
- color.c
+ color.c error.c obstack.c obstack_printf.c
noinst_HEADERS = fixedsizehash.h system.h dynamicsizehash.h list.h md5.h \
sha1.h eu-config.h
--- lib/byteswap.h.orig 2016-07-13 06:58:54 UTC
+++ lib/byteswap.h
@@ -0,0 +1,2 @@
+#pragma once
+#include <sys/endian.h>
--- lib/endian.h.orig 2016-07-13 06:58:54 UTC
+++ lib/endian.h
@@ -0,0 +1,2 @@
+#pragma once
+#include <sys/endian.h>
--- lib/error.c.orig 2016-07-13 06:58:54 UTC
+++ lib/error.c
@@ -0,0 +1,64 @@
+#include <err.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "error.h"
+
+unsigned int error_message_count;
+int error_one_per_line;
+void (*error_print_progname)(void) = NULL;
+
+static const char *lastfile;
+static unsigned lastline;
+
+/* Good enough. */
+
+void
+error_at_line(int status, int errnum, const char *fn, unsigned line,
+ const char *format, ...)
+{
+ va_list ap;
+ int serrno;
+
+ if (error_one_per_line != 0 && fn != NULL && fn == lastfile && line ==
+ lastline)
+ return;
+
+ serrno = errno;
+ errno = errnum;
+
+ fflush(stdout);
+
+ if (error_print_progname != NULL) {
+ error_print_progname();
+ fprintf(stderr, ":");
+ }
+
+ if (fn != NULL) {
+ lastfile = fn;
+ lastline = line;
+
+ fprintf(stderr, "%s:%u: ", fn, line);
+ } else if (error_print_progname != NULL) {
+ fprintf(stderr, " ");
+ }
+
+ va_start(ap, format);
+ if (status) {
+ if (errnum)
+ verr(status, format, ap);
+ else
+ verrx(status, format, ap);
+ } else {
+ if (errnum)
+ vwarn(format, ap);
+ else
+ vwarnx(format, ap);
+ }
+ va_end(ap);
+
+ errno = serrno;
+ error_message_count++;
+}
+
--- lib/error.h.orig 2016-07-13 06:58:54 UTC
+++ lib/error.h
@@ -0,0 +1,18 @@
+#pragma once
+
+/*
+ * error, error_at_line, error_message_count, error_one_per_line,
+ * error_print_progname - glibc error reporting functions
+ */
+
+/* void error(int status, int errnum, const char *format, ...); */
+#define error(st, en, ...) error_at_line(st, en, NULL, 0, __VA_ARGS__)
+
+void error_at_line(int status, int errnum, const char *filename,
+ unsigned int linenum, const char *format, ...);
+
+extern unsigned int error_message_count;
+
+extern int error_one_per_line;
+
+extern void (*error_print_progname) (void);
--- lib/eu-config.h.orig 2015-06-11 11:38:55 UTC
+++ lib/eu-config.h
@@ -187,4 +187,147 @@ asm (".section predict_data, \"aw\"; .pr
#endif
+/* FreeBSD ports of glibcisms */
+#include <sys/cdefs.h>
+#include <libgen.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <wchar.h>
+
+#define _GL_ATTRIBUTE_PURE __attribute__((__pure__))
+
+struct obstack;
+extern int obstack_printf(struct obstack *, const char *, ...);
+extern int obstack_vprintf(struct obstack *, const char *, va_list);
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+static inline void *
+mempcpy(void * restrict dst, const void * restrict src, size_t len)
+{
+
+ return (((char *)memcpy(dst, src, len)) + len);
+}
+
+static inline wchar_t *
+wmempcpy(wchar_t * restrict dst, const wchar_t * restrict src, size_t len)
+{
+
+ return (wmemcpy(dst, src, len) + len);
+}
+#pragma GCC diagnostic pop
+
+static inline void *
+rawmemchr(const void *s, int c)
+{
+
+ return (memchr(s, c, SIZE_MAX));
+}
+
+static inline void
+tdestroy(void *vroot __unused, void (*freefct)(void *) __unused)
+{
+
+ /* XXX: Just leak the memory for now. */
+}
+
+static inline char *
+canonicalize_file_name(const char *path)
+{
+
+ return (realpath(path, NULL));
+}
+
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expr) ({ \
+ long value; \
+ do { \
+ value = (long)(expr); \
+ } while (value == -1 && errno == EINTR); \
+ (value); \
+})
+#endif
+
+#define strndupa(s, n) \
+({ \
+ size_t len = (n); \
+ const char *end; \
+ char *res; \
+ \
+ end = memchr((s), 0, (n)); \
+ if (end != NULL) \
+ len = end - (s); \
+ \
+ res = alloca(len + 1); \
+ memcpy(res, (s), len); \
+ res[len] = '\0'; \
+ res; \
+})
+
+
+#define program_invocation_short_name __DECONST(char *, getprogname())
+#ifndef loff_t
+#define loff_t off_t
+#endif
+#ifndef off64_t
+#define off64_t off_t
+#endif
+
+#define ftruncate64 ftruncate
+#define open64 open
+#define fstat64 fstat
+#define stat64 stat
+#define pread64 pread
+#define mmap64 mmap
+#define lseek64 lseek
+
+#define MAP_POPULATE MAP_PREFAULT_READ
+
+#define bswap_16 bswap16
+#define bswap_32 bswap32
+#define bswap_64 bswap64
+
+#define fputc_unlocked putc_unlocked
+#define fputs_unlocked fputs
+#define fwrite_unlocked fwrite
+#define fread_unlocked fread
+
+#ifndef __BYTE_ORDER
+#define __BYTE_ORDER _BYTE_ORDER
+#endif
+#ifndef __LITTLE_ENDIAN
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#endif
+#ifndef __BIG_ENDIAN
+#define __BIG_ENDIAN _BIG_ENDIAN
+#endif
+
+#define DL_CALL_FCT(fn, args) ((fn) args)
+
+/* This package doesn't really respect --disable-nls. Hack it. */
+#if !ENABLE_NLS
+/* Skip loading libintl.h, which is hardcoded in most source files: */
+#define _LIBINTL_H 1
+#define dgettext(module, str) (str)
+#define gettext(str) (str)
+
+static inline char *
+bindtextdomain(const char *d __unused, const char *dr __unused)
+{
+
+ return ("/");
+}
+
+static inline char *
+textdomain(const char *dom)
+{
+
+ return (__DECONST(char *, dom));
+}
+
+#define ngettext(s, p, n) (((n) == 1) ? (s) : (p))
+#endif
+
#endif /* eu-config.h */
--- lib/exitfail.h.orig 2016-07-13 08:19:52 UTC
+++ lib/exitfail.h
@@ -0,0 +1,2 @@
+#pragma once
+#define exit_failure EXIT_FAILURE
--- lib/features.h.orig 2016-07-13 04:39:31 UTC
+++ lib/features.h
@@ -0,0 +1,1 @@
+/* Nop. */
--- lib/gettext.h.orig 2016-07-13 08:20:19 UTC
+++ lib/gettext.h
@@ -0,0 +1 @@
+/* Nop */
--- lib/ssp.h.orig 2016-07-13 06:58:54 UTC
+++ lib/ssp.h
@@ -0,0 +1 @@
+#include <ssp/ssp.h>
--- lib/stdio_ext.h.orig 2016-07-13 06:58:54 UTC
+++ lib/stdio_ext.h
@@ -0,0 +1,16 @@
+#pragma once
+#include <stdio.h>
+
+enum {
+ FSETLOCKING_QUERY,
+ FSETLOCKING_INTERNAL,
+ FSETLOCKING_BYCALLER,
+};
+
+static inline int
+__fsetlocking(FILE *fp __unused, int type __unused)
+{
+
+ /* No-op on FreeBSD? */
+ return (FSETLOCKING_BYCALLER);
+}
--- lib/system.h.orig 2014-02-05 00:21:43 UTC
+++ lib/system.h
@@ -29,6 +29,8 @@
#ifndef LIB_SYSTEM_H
#define LIB_SYSTEM_H 1
+#include <ssp/string.h>
+
#include <argp.h>
#include <stddef.h>
#include <stdint.h>
@@ -36,16 +38,18 @@
#include <byteswap.h>
#include <unistd.h>
+#include <eu-config.h>
+
#if __BYTE_ORDER == __LITTLE_ENDIAN
# define LE32(n) (n)
# define LE64(n) (n)
-# define BE32(n) bswap_32 (n)
-# define BE64(n) bswap_64 (n)
+# define BE32(n) bswap32 (n)
+# define BE64(n) bswap64 (n)
#elif __BYTE_ORDER == __BIG_ENDIAN
# define BE32(n) (n)
# define BE64(n) (n)
-# define LE32(n) bswap_32 (n)
-# define LE64(n) bswap_64 (n)
+# define LE32(n) bswap32 (n)
+# define LE64(n) bswap64 (n)
#else
# error "Unknown byte order"
#endif
--- lib/vasnprintf.h.orig 2016-07-13 08:19:27 UTC
+++ lib/vasnprintf.h
@@ -0,0 +1,23 @@
+#pragma once
+#include <stdarg.h>
+#include <stdio.h>
+
+static inline char *
+vasnprintf(char *resultbuf, size_t *lengthp, const char *format, va_list args)
+{
+ char *alloc;
+ int len;
+
+ len = vasprintf(&alloc, format, args);
+ if (len < 0)
+ return (NULL);
+
+ *lengthp = len;
+
+ if (resultbuf != NULL && (size_t)len < *lengthp) {
+ memcpy(resultbuf, alloc, len + 1);
+ free(alloc);
+ return (resultbuf);
+ }
+ return (alloc);
+}
--- libdw/Makefile.am.orig 2015-06-10 19:44:33 UTC
+++ libdw/Makefile.am
@@ -105,14 +105,14 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURC
libdw_so_SOURCES =
libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
- ../libelf/libelf.so
+ ../libelf/libelf.so ../lib/libeu.a
# The rpath is necessary for libebl because its $ORIGIN use will
# not fly in a setuid executable that links in libdw.
$(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
-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)
+ $(argp_LDADD) $(zip_LIBS)
@$(textrel_check)
ln -fs $@ $@.$(VERSION)
--- libdwfl/dwfl_error.c.orig 2015-06-10 19:44:33 UTC
+++ libdwfl/dwfl_error.c
@@ -136,7 +136,7 @@ __libdwfl_seterrno (Dwfl_Error error)
global_error = canonicalize (error);
}
-
+static __thread char strerr_buf[64];
const char *
dwfl_errmsg (error)
int error;
@@ -155,7 +155,9 @@ dwfl_errmsg (error)
switch (error &~ 0xffff)
{
case OTHER_ERROR (ERRNO):
- return strerror_r (error & 0xffff, "bad", 0);
+ strcpy(strerr_buf, "bad");
+ (void)strerror_r (error & 0xffff, strerr_buf, sizeof strerr_buf);
+ return strerr_buf;
case OTHER_ERROR (LIBELF):
return elf_errmsg (error & 0xffff);
case OTHER_ERROR (LIBDW):
--- src/Makefile.am.orig 2015-06-11 11:38:55 UTC
+++ src/Makefile.am
@@ -72,11 +72,11 @@ CLEANFILES += make-debug-archive
if BUILD_STATIC
libasm = ../libasm/libasm.a
-libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl
+libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) $(libeu)
libelf = ../libelf/libelf.a
else
libasm = ../libasm/libasm.so
-libdw = ../libdw/libdw.so
+libdw = ../libdw/libdw.so $(libeu)
libelf = ../libelf/libelf.so
endif
libebl = ../libebl/libebl.a
@@ -103,27 +103,27 @@ ranlib_no_Wstack_usage = yes
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)
+nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) \
$(demanglelib)
size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
-strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
-ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD)
+ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD)
if NATIVE_LD
-# -ldl is always needed for libebl.
+# is always needed for libebl.
ld_LDADD += libld_elf.a
endif
ld_LDFLAGS = -rdynamic
-elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
+elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD)
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
+elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD)
+objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD)
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)
+unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
+stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
ldlex.o: ldscript.c
ldlex_no_Werror = yes
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment