diff --git a/liba/Makefile b/liba/Makefile index db13011f5..92111d16f 100644 --- a/liba/Makefile +++ b/liba/Makefile @@ -7,4 +7,7 @@ tests += $(addprefix liba/test/, stdint.c) # The use of aeabi-rt could be made conditional to an AEABI target. # In practice we're always using liba on such a target. -objs += $(addprefix liba/src/aeabi-rt/, memcpy.o) +objs += $(addprefix liba/src/aeabi-rt/, \ + memclr.o \ + memcpy.o \ +) diff --git a/liba/src/aeabi-rt/README.txt b/liba/src/aeabi-rt/README.txt index be3109f12..37691aaf5 100644 --- a/liba/src/aeabi-rt/README.txt +++ b/liba/src/aeabi-rt/README.txt @@ -9,6 +9,7 @@ memory copying/clearing/setting, etc... Since we're telling our compiler to build an AEABI binary, it may decide to use those symbols, and so we have to provide an implementation for them. Refer to the "Run-time ABI for the ARM Architecture" for a full list of functions. +http://infocenter.arm.com/help/topic/com.arm.doc.ihi0043d/IHI0043D_rtabi.pdf Note that this is not formally the job of a libc implementation. Similar code is often shipped alongside a compiler (LLVM calls it compiler-rt, GCC libgcc). But diff --git a/liba/src/aeabi-rt/memclr.c b/liba/src/aeabi-rt/memclr.c new file mode 100644 index 000000000..d777c7e65 --- /dev/null +++ b/liba/src/aeabi-rt/memclr.c @@ -0,0 +1,8 @@ +#include +#include + +/* See the "Run-time ABI for the ARM Architecture", Section 4.3.3 */ + +void __aeabi_memclr4(void * dest, size_t n) { + memset(dest, 0, n); +}