aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Medhurst (Tixy) <tixy@linaro.org>2012-09-04 15:57:15 +0100
committerPeter Maydell <peter.maydell@linaro.org>2012-09-04 16:19:37 +0100
commit9b9cabe5ba5937917a23fb85eafff41cdabc3276 (patch)
tree82da53a2fa4b5c44823a8f466e63c696ffa88050
parent4137f5fcbf1278acd19060500f12aec7bde804d7 (diff)
bootwrapper: Use local definition of string.h
The semihosting and FDT code makes use of libc style string functions implemented in our string.c, however it relies on the system providing the string.h header file. This causes problems on toolchains that don't provide these headers, like Android toolchains, and it also means that we include declaration for functions which aren't implemented in the bootwrapper. Resolve this by providing our own string.h which declares only the functions we implement and add the base directory to the include path so this header is found. Signed-off-by: Jon Medhurst <tixy@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--Makefile2
-rw-r--r--string.h16
2 files changed, 17 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 995fd8f..f8fc841 100644
--- a/Makefile
+++ b/Makefile
@@ -57,7 +57,7 @@ monitor.o: $(MONITOR)
$(CC) $(CPPFLAGS) -c -o $@ $<
%.o: %.c
- $(CC) $(CPPFLAGS) -O2 -ffreestanding -Ilibfdt -c -o $@ $<
+ $(CC) $(CPPFLAGS) -O2 -ffreestanding -I. -Ilibfdt -c -o $@ $<
model.lds: $(LD_SCRIPT) Makefile
$(CC) $(CPPFLAGS) -E -P -C -o $@ $<
diff --git a/string.h b/string.h
new file mode 100644
index 0000000..f1aebdf
--- /dev/null
+++ b/string.h
@@ -0,0 +1,16 @@
+#ifndef STRING_H
+#define STRING_H
+
+#include <stddef.h>
+
+extern void *(memcpy)(void *__dest, __const void *__src, size_t __n);
+extern void *(memmove)(void *__dest, __const void *__src, size_t __n);
+extern void *(memchr)(void const *s, int c, size_t n);
+extern size_t (strlen)(const char *s);
+extern void *(memset)(void *s, int c, size_t count);
+extern int (memcmp)(void const *p1, void const *p2, size_t n);
+extern int (strcmp)(char const *s1, char const *s2);
+extern int (strncmp)(char const *s1, char const *s2, size_t n);
+extern char *(strchr)(char const *s, int c);
+
+#endif