summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-09-01 11:20:05 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-11-17 11:36:55 +0100
commit3516b8b7558a69dfd06410b0c997d096a78221c9 (patch)
tree6e3d993f086e5fd3fd90f998e3d88988ac07ce7d /lib
parentd3b66fbf88b07f7954ee5e7ceddab543bdd3a833 (diff)
Add libmissing
This patch adds a libmissing library to mtd-utils, containing implementations of functionality found in glibc but typically missing from embedded C libraries such as uclibc ot musl. For now, the library only contains stub implementations of the backtrace*() family of functions. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/Makemodule.am5
-rw-r--r--lib/execinfo.c25
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/Makemodule.am b/lib/Makemodule.am
index 2fd933d..b30a8aa 100644
--- a/lib/Makemodule.am
+++ b/lib/Makemodule.am
@@ -5,4 +5,7 @@ libmtd_a_SOURCES = \
lib/libmtd_legacy.c \
lib/libmtd_int.h
-noinst_LIBRARIES += libmtd.a
+libmissing_a_SOURCES = \
+ lib/execinfo.c
+
+noinst_LIBRARIES += libmtd.a libmissing.a
diff --git a/lib/execinfo.c b/lib/execinfo.c
new file mode 100644
index 0000000..a39df83
--- /dev/null
+++ b/lib/execinfo.c
@@ -0,0 +1,25 @@
+#include "libmissing.h"
+
+#ifndef HAVE_EXECINFO
+#define PROGRAM_NAME "libmissing"
+#include "common.h"
+
+int backtrace(void **buffer, int size)
+{
+ void *addr = __builtin_return_address(0);
+
+ errmsg("backtrace() is not implemented. Called from %p", addr);
+ return 0;
+}
+
+char **backtrace_symbols(void *const *buffer, int size)
+{
+ errmsg("backtrace_symbols() is not implemented");
+ return NULL;
+}
+
+void backtrace_symbols_fd(void *const *buffer, int size, int fd)
+{
+ errmsg("backtrace_symbols_fd() is not implemented");
+}
+#endif /* !HAVE_EXECINFO */