From 14f9cffa6e8be465ada1c16390a403620ef292d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nagy=20K=C3=A1roly=20G=C3=A1briel?= Date: Fri, 13 Nov 2020 18:05:22 +0200 Subject: [PATCH] libexecinfo: Added libexecinfo 1.1 - A BSD licensed clone of the GNU libc backtrace facility --- develop/libexecinfo/10-execinfo.patch | 80 +++++++++++++++++++ .../libexecinfo/20-define-gnu-source.patch | 40 ++++++++++ develop/libexecinfo/30-linux-makefile.patch | 60 ++++++++++++++ develop/libexecinfo/libexecinfo.cache | 9 +++ develop/libexecinfo/libexecinfo.conf | 32 ++++++++ develop/libexecinfo/libexecinfo.desc | 33 ++++++++ 6 files changed, 254 insertions(+) create mode 100644 develop/libexecinfo/10-execinfo.patch create mode 100644 develop/libexecinfo/20-define-gnu-source.patch create mode 100644 develop/libexecinfo/30-linux-makefile.patch create mode 100644 develop/libexecinfo/libexecinfo.cache create mode 100644 develop/libexecinfo/libexecinfo.conf create mode 100644 develop/libexecinfo/libexecinfo.desc diff --git a/develop/libexecinfo/10-execinfo.patch b/develop/libexecinfo/10-execinfo.patch new file mode 100644 index 000000000..c432a4737 --- /dev/null +++ b/develop/libexecinfo/10-execinfo.patch @@ -0,0 +1,80 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../libexecinfo/10-execinfo.patch +# Copyright (C) 2020 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This patch file is dual-licensed. It is available under the license the +# patched project is licensed under, as long as it is an OpenSource license +# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms +# of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# --- SDE-COPYRIGHT-NOTE-END --- + +--- a/execinfo.c.orig ++++ b/execinfo.c +@@ -69,7 +69,8 @@ + char ** + backtrace_symbols(void *const *buffer, int size) + { +- int i, clen, alen, offset; ++ size_t clen, alen; ++ int i, offset; + char **rval; + char *cp; + Dl_info info; +@@ -78,7 +79,6 @@ + rval = malloc(clen); + if (rval == NULL) + return NULL; +- (char **)cp = &(rval[size]); + for (i = 0; i < size; i++) { + if (dladdr(buffer[i], &info) != 0) { + if (info.dli_sname == NULL) +@@ -92,14 +92,14 @@ + 2 + /* " <" */ + strlen(info.dli_sname) + /* "function" */ + 1 + /* "+" */ +- D10(offset) + /* "offset */ ++ 10 + /* "offset */ + 5 + /* "> at " */ + strlen(info.dli_fname) + /* "filename" */ + 1; /* "\0" */ + rval = realloc_safe(rval, clen + alen); + if (rval == NULL) + return NULL; +- snprintf(cp, alen, "%p <%s+%d> at %s", ++ snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s", + buffer[i], info.dli_sname, offset, info.dli_fname); + } else { + alen = 2 + /* "0x" */ +@@ -108,12 +108,15 @@ + rval = realloc_safe(rval, clen + alen); + if (rval == NULL) + return NULL; +- snprintf(cp, alen, "%p", buffer[i]); ++ snprintf((char *) rval + clen, alen, "%p", buffer[i]); + } +- rval[i] = cp; +- cp += alen; ++ rval[i] = (char *) clen; ++ clen += alen; + } + ++ for (i = 0; i < size; i++) ++ rval[i] += (long) rval; ++ + return rval; + } + +@@ -155,6 +158,6 @@ + return; + snprintf(buf, len, "%p\n", buffer[i]); + } +- write(fd, buf, len - 1); ++ write(fd, buf, strlen(buf)); + } + } diff --git a/develop/libexecinfo/20-define-gnu-source.patch b/develop/libexecinfo/20-define-gnu-source.patch new file mode 100644 index 000000000..3d76e42b6 --- /dev/null +++ b/develop/libexecinfo/20-define-gnu-source.patch @@ -0,0 +1,40 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../libexecinfo/20-define-gnu-source.patch +# Copyright (C) 2020 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This patch file is dual-licensed. It is available under the license the +# patched project is licensed under, as long as it is an OpenSource license +# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms +# of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# --- SDE-COPYRIGHT-NOTE-END --- + +--- a/execinfo.c.orig ++++ b/execinfo.c +@@ -26,6 +26,7 @@ + * $Id: execinfo.c,v 1.3 2004/07/19 05:21:09 sobomax Exp $ + */ + ++#define _GNU_SOURCE + #include + #include + #include +--- a/stacktraverse.c.orig ++++ b/stacktraverse.c +@@ -1,3 +1,4 @@ ++#define _GNU_SOURCE + #include + + #include "stacktraverse.h" +--- a/test.c.orig ++++ b/test.c +@@ -1,3 +1,4 @@ ++#define _GNU_SOURCE + #include + #include + diff --git a/develop/libexecinfo/30-linux-makefile.patch b/develop/libexecinfo/30-linux-makefile.patch new file mode 100644 index 000000000..dbec2c3bf --- /dev/null +++ b/develop/libexecinfo/30-linux-makefile.patch @@ -0,0 +1,60 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../libexecinfo/30-linux-makefile.patch +# Copyright (C) 2020 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This patch file is dual-licensed. It is available under the license the +# patched project is licensed under, as long as it is an OpenSource license +# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms +# of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# --- SDE-COPYRIGHT-NOTE-END --- + +--- a/Makefile.orig ++++ b/Makefile +@@ -23,24 +23,25 @@ + # SUCH DAMAGE. + # + # $Id: Makefile,v 1.3 2004/07/19 05:19:55 sobomax Exp $ ++# ++# Linux Makefile by Matt Smith , 2011/01/04 + +-LIB= execinfo ++CC=cc ++AR=ar ++EXECINFO_CFLAGS=$(CFLAGS) -O2 -pipe -fno-strict-aliasing -std=gnu99 -fstack-protector -c ++EXECINFO_LDFLAGS=$(LDFLAGS) + +-SRCS= stacktraverse.c stacktraverse.h execinfo.c execinfo.h ++all: static dynamic + +-INCS= execinfo.h ++static: ++ $(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c ++ $(CC) $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c ++ $(AR) rcs libexecinfo.a stacktraverse.o execinfo.o + +-SHLIB_MAJOR= 1 +-SHLIB_MINOR= 0 ++dynamic: ++ $(CC) -fpic -DPIC $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) stacktraverse.c -o stacktraverse.So ++ $(CC) -fpic -DPIC $(EXECINFO_CFLAGS) $(EXECINFO_LDFLAGS) execinfo.c -o execinfo.So ++ $(CC) -shared -Wl,-soname,libexecinfo.so.1 -o libexecinfo.so.1 stacktraverse.So execinfo.So + +-NOPROFILE= yes +- +-DPADD= ${LIBM} +-LDADD= -lm +- +-#WARNS?= 4 +- +-#stacktraverse.c: gen.py +-# ./gen.py > stacktraverse.c +- +-.include ++clean: ++ rm -rf *.o *.So *.a *.so diff --git a/develop/libexecinfo/libexecinfo.cache b/develop/libexecinfo/libexecinfo.cache new file mode 100644 index 000000000..9b88a3507 --- /dev/null +++ b/develop/libexecinfo/libexecinfo.cache @@ -0,0 +1,9 @@ + +[TIMESTAMP] 1605282758 Fri Nov 13 15:52:38 2020 +[BUILDTIME] 0 (5) +[SIZE] 0.15 MB, 12 files + +[DEP] binutils +[DEP] coreutils +[DEP] gcc +[DEP] musl diff --git a/develop/libexecinfo/libexecinfo.conf b/develop/libexecinfo/libexecinfo.conf new file mode 100644 index 000000000..8c9f5c85e --- /dev/null +++ b/develop/libexecinfo/libexecinfo.conf @@ -0,0 +1,32 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../libexecinfo/libexecinfo.conf +# Copyright (C) 2020 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +var_append CFLAGS " " "-fno-omit-frame-pointer" + +libexecinfo_install() +{ + local x= + for x in execinfo.h stacktraverse.h; do + install -m 644 $x "$root$includedir/" + done + for x in libexecinfo.a libexecinfo.so.1; do + install -m 755 $x "$root$libdir/" + done + + cd $root/$libdir; ln -svf libexecinfo.so{.1,} +} + +makeinstopt= +hook_add postmake 5 "libexecinfo_install" + diff --git a/develop/libexecinfo/libexecinfo.desc b/develop/libexecinfo/libexecinfo.desc new file mode 100644 index 000000000..fef0258a8 --- /dev/null +++ b/develop/libexecinfo/libexecinfo.desc @@ -0,0 +1,33 @@ +[COPY] --- SDE-COPYRIGHT-NOTE-BEGIN --- +[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch. +[COPY] +[COPY] Filename: package/.../libexecinfo/libexecinfo.desc +[COPY] Copyright (C) 2020 The OpenSDE Project +[COPY] +[COPY] More information can be found in the files COPYING and README. +[COPY] +[COPY] This program is free software; you can redistribute it and/or modify +[COPY] it under the terms of the GNU General Public License as published by +[COPY] the Free Software Foundation; version 2 of the License. A copy of the +[COPY] GNU General Public License can be found in the file COPYING. +[COPY] --- SDE-COPYRIGHT-NOTE-END --- + +[I] A BSD licensed clone of the GNU libc backtrace facility + +[T] This is a quick-n-dirty BSD licensed clone of backtrace facility +[T] found in the GNU libc, mainly intended for porting Linuxish code to BSD +[T] platforms, however it can be used at any platform which has a gcc compiler. + +[U] http://www.freshports.org/devel/libexecinfo + +[A] Maxim Sobolev +[M] Nagy Károly Gábriel + +[C] extra/tool + +[L] BSD +[S] Stable +[V] 1.1 +[P] X -----5---9 098.000 + +[D] 2941339995 libexecinfo-1.1.tar.bz2 http://distcache.freebsd.org/local-distfiles/itetcu/