summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/libexecinfo
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-extended/libexecinfo')
-rw-r--r--meta-oe/recipes-extended/libexecinfo/libexecinfo/0001-makefile-Fix-build-on-linux.patch59
-rw-r--r--meta-oe/recipes-extended/libexecinfo/libexecinfo/0002-execinfo-Fix-compiler-errors-found-with-newer-gcc-cl.patch79
-rw-r--r--meta-oe/recipes-extended/libexecinfo/libexecinfo_1.1.bb31
3 files changed, 169 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/libexecinfo/libexecinfo/0001-makefile-Fix-build-on-linux.patch b/meta-oe/recipes-extended/libexecinfo/libexecinfo/0001-makefile-Fix-build-on-linux.patch
new file mode 100644
index 000000000..f1863f14b
--- /dev/null
+++ b/meta-oe/recipes-extended/libexecinfo/libexecinfo/0001-makefile-Fix-build-on-linux.patch
@@ -0,0 +1,59 @@
1From 910bbc2cb6cc1cfa6deed9d170da02a639902c7c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 19 Mar 2017 16:14:54 -0700
4Subject: [PATCH 1/2] makefile: Fix build on linux
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 Makefile | 33 +++++++++++++++++----------------
9 1 file changed, 17 insertions(+), 16 deletions(-)
10
11Index: libexecinfo-1.1/Makefile
12===================================================================
13--- libexecinfo-1.1.orig/Makefile
14+++ libexecinfo-1.1/Makefile
15@@ -23,24 +23,25 @@
16 # SUCH DAMAGE.
17 #
18 # $Id: Makefile,v 1.3 2004/07/19 05:19:55 sobomax Exp $
19+#
20+# Linux Makefile by Matt Smith <mcs@darkregion.net>, 2011/01/04
21
22-LIB= execinfo
23-
24-SRCS= stacktraverse.c stacktraverse.h execinfo.c execinfo.h
25-
26-INCS= execinfo.h
27-
28-SHLIB_MAJOR= 1
29-SHLIB_MINOR= 0
30-
31-NOPROFILE= yes
32-
33-DPADD= ${LIBM}
34-LDADD= -lm
35-
36-#WARNS?= 4
37-
38-#stacktraverse.c: gen.py
39-# ./gen.py > stacktraverse.c
40+CC?=cc
41+AR?=ar
42+EXECINFO_CFLAGS=$(CFLAGS) -O2 -pipe -fno-strict-aliasing -std=gnu99 -fstack-protector -c
43+EXECINFO_LDFLAGS=$(LDFLAGS)
44+
45+all: static dynamic
46+
47+static:
48+ $(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c
49+ $(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c
50+ $(AR) rcs libexecinfo.a stacktraverse.o execinfo.o
51+
52+dynamic:
53+ $(CC) -fpic -DPIC $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c -o stacktraverse.So
54+ $(CC) -fpic -DPIC $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c -o execinfo.So
55+ $(CC) -shared -Wl,-soname,libexecinfo.so.1 -o libexecinfo.so.1 $(EXECINFO_LDFLAGS) stacktraverse.So execinfo.So
56
57-.include <bsd.lib.mk>
58+clean:
59+ rm -rf *.o *.So *.a *.so
diff --git a/meta-oe/recipes-extended/libexecinfo/libexecinfo/0002-execinfo-Fix-compiler-errors-found-with-newer-gcc-cl.patch b/meta-oe/recipes-extended/libexecinfo/libexecinfo/0002-execinfo-Fix-compiler-errors-found-with-newer-gcc-cl.patch
new file mode 100644
index 000000000..423b67082
--- /dev/null
+++ b/meta-oe/recipes-extended/libexecinfo/libexecinfo/0002-execinfo-Fix-compiler-errors-found-with-newer-gcc-cl.patch
@@ -0,0 +1,79 @@
1From 0810817773fb81d7383d2fa8464244c8f79845fb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 19 Mar 2017 16:16:18 -0700
4Subject: [PATCH 2/2] execinfo: Fix compiler errors found with newer gcc/clang
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8 execinfo.c | 19 +++++++++++--------
9 1 file changed, 11 insertions(+), 8 deletions(-)
10
11diff --git a/execinfo.c b/execinfo.c
12index 906fb14..9448b60 100644
13--- a/execinfo.c
14+++ b/execinfo.c
15@@ -69,7 +69,8 @@ backtrace(void **buffer, int size)
16 char **
17 backtrace_symbols(void *const *buffer, int size)
18 {
19- int i, clen, alen, offset;
20+ size_t clen, alen;
21+ int i, offset;
22 char **rval;
23 char *cp;
24 Dl_info info;
25@@ -78,7 +79,6 @@ backtrace_symbols(void *const *buffer, int size)
26 rval = malloc(clen);
27 if (rval == NULL)
28 return NULL;
29- (char **)cp = &(rval[size]);
30 for (i = 0; i < size; i++) {
31 if (dladdr(buffer[i], &info) != 0) {
32 if (info.dli_sname == NULL)
33@@ -92,14 +92,14 @@ backtrace_symbols(void *const *buffer, int size)
34 2 + /* " <" */
35 strlen(info.dli_sname) + /* "function" */
36 1 + /* "+" */
37- D10(offset) + /* "offset */
38+ 10 + /* "offset */
39 5 + /* "> at " */
40 strlen(info.dli_fname) + /* "filename" */
41 1; /* "\0" */
42 rval = realloc_safe(rval, clen + alen);
43 if (rval == NULL)
44 return NULL;
45- snprintf(cp, alen, "%p <%s+%d> at %s",
46+ snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s",
47 buffer[i], info.dli_sname, offset, info.dli_fname);
48 } else {
49 alen = 2 + /* "0x" */
50@@ -108,12 +108,15 @@ backtrace_symbols(void *const *buffer, int size)
51 rval = realloc_safe(rval, clen + alen);
52 if (rval == NULL)
53 return NULL;
54- snprintf(cp, alen, "%p", buffer[i]);
55+ snprintf((char *) rval + clen, alen, "%p", buffer[i]);
56 }
57- rval[i] = cp;
58- cp += alen;
59+ rval[i] = (char *) clen;
60+ clen += alen;
61 }
62
63+ for (i = 0; i < size; i++)
64+ rval[i] += (long) rval;
65+
66 return rval;
67 }
68
69@@ -155,6 +158,6 @@ backtrace_symbols_fd(void *const *buffer, int size, int fd)
70 return;
71 snprintf(buf, len, "%p\n", buffer[i]);
72 }
73- write(fd, buf, len - 1);
74+ write(fd, buf, strlen(buf));
75 }
76 }
77--
782.12.0
79
diff --git a/meta-oe/recipes-extended/libexecinfo/libexecinfo_1.1.bb b/meta-oe/recipes-extended/libexecinfo/libexecinfo_1.1.bb
new file mode 100644
index 000000000..f79b1ab18
--- /dev/null
+++ b/meta-oe/recipes-extended/libexecinfo/libexecinfo_1.1.bb
@@ -0,0 +1,31 @@
1# Copyright (C) 2017 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "A quick-n-dirty BSD licensed clone of the GNU libc backtrace facility."
5HOMEPAGE = "http://www.freshports.org/devel/libexecinfo"
6LIC_FILES_CHKSUM = "file://execinfo.c;endline=25;md5=85bd3fa4ea9acae5182e29db063fe2e5"
7LICENSE = "BSD-2-Clause"
8SECTION = "libs"
9DEPENDS = ""
10
11SRC_URI = "http://distcache.freebsd.org/local-distfiles/itetcu/${BP}.tar.bz2 \
12 file://0001-makefile-Fix-build-on-linux.patch \
13 file://0002-execinfo-Fix-compiler-errors-found-with-newer-gcc-cl.patch \
14 "
15SRC_URI[md5sum] = "8e9e81c554c1c5d735bc877448e92b91"
16SRC_URI[sha256sum] = "c9a21913e7fdac8ef6b33250b167aa1fc0a7b8a175145e26913a4c19d8a59b1f"
17
18CFLAGS += "-fno-omit-frame-pointer"
19
20do_install() {
21 install -D -m 0744 ${S}/execinfo.h ${D}${includedir}/execinfo.h
22 install -D -m 0744 ${S}/stacktraverse.h ${D}${includedir}/stacktraverse.h
23 install -D -m 0744 ${B}/libexecinfo.a ${D}${libdir}/libexecinfo.a
24 install -D -m 0755 ${B}/libexecinfo.so.1 ${D}${libdir}/libexecinfo.so.1
25 ln -s libexecinfo.so.1 ${D}${libdir}/libexecinfo.so
26}
27#
28# We will skip parsing for non-musl systems
29#
30COMPATIBLE_HOST = ".*-musl.*"
31