From 24463a168a84bdc4d8d8e5664ea211a4b91c6813 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 26 Jul 2015 12:55:52 +0300 Subject: [PATCH] Add a stub getenv() implementation. This is not strictly necessary to build libunwind (it can be built with -DNDEBUG), but it will be handy while it is debugged. It can be removed afterwards. --- software/libbase/Makefile | 2 +- software/libbase/environ.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 software/libbase/environ.c diff --git a/software/libbase/Makefile b/software/libbase/Makefile index c1f2434df..35f92f659 100644 --- a/software/libbase/Makefile +++ b/software/libbase/Makefile @@ -1,7 +1,7 @@ MSCDIR=../.. include $(MSCDIR)/software/common.mak -OBJECTS=exception.o libc.o errno.o crc16.o crc32.o console.o system.o id.o uart.o time.o qsort.o strtod.o spiflash.o +OBJECTS=exception.o libc.o errno.o crc16.o crc32.o console.o environ.o system.o id.o uart.o time.o qsort.o strtod.o spiflash.o all: crt0-$(CPU).o libbase.a libbase-nofloat.a diff --git a/software/libbase/environ.c b/software/libbase/environ.c new file mode 100644 index 000000000..2c2c92f08 --- /dev/null +++ b/software/libbase/environ.c @@ -0,0 +1,11 @@ +#include +#include + +char *getenv(const char *varname) { + if(!strcmp(varname, "LIBUNWIND_PRINT_APIS") || + !strcmp(varname, "LIBUNWIND_PRINT_UNWINDING")) { + return "1"; + } else { + return NULL; + } +}