From 98c6cad0e93dcada30f66b60ffc29254c9227f55 Mon Sep 17 00:00:00 2001 From: Ziyao Date: Fri, 15 Apr 2022 14:41:11 +0800 Subject: [PATCH] Update README --- README | 6 +++--- tests/malloc.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 tests/malloc.c diff --git a/README b/README index c515855..8e9f1f3 100644 --- a/README +++ b/README @@ -9,15 +9,15 @@ still missing,including: The original versions of __syscall4(),__syscall5() and __syscall6() don't work.They are replaced by assembly implemention in /src/internal/x86_64/syscall.S -- math library is removed momently. - Because some missing floating-point features of TinyCC.I am working - on completing. +- math library has been use the pure C implementation + Because some missing floating-point features of TinyCC. - @PLT dynamic linking function calls are removed. TinyCC does not have the feature.Dynamic linking library(.so) is expected not to work. Some features had been removed momently but now they are usable,including: - fenv library(maybe applying a patch to TinyCC is needed) +- math library(using C implementation now) To compile,simply run ./configure --target=x86_64 CC='tcc' AR='tcc -ar' RANLIB='echo' \ diff --git a/tests/malloc.c b/tests/malloc.c new file mode 100644 index 0000000..f9e3d90 --- /dev/null +++ b/tests/malloc.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include +#include + +#define BLK_SIZE (2 << 10) +#define TEST_NUM (2 << 10) + +int main(void) +{ + uint8_t **slots = (uint8_t**)malloc(sizeof(uint8_t*) * TEST_NUM); + printf("%p\n",slots); + assert(slots); + for (int i = 0;i < TEST_NUM;i++) { + slots[i] = (uint8_t*)malloc(BLK_SIZE); + assert(slots[i]); + memset(slots[i],(uint8_t)i,BLK_SIZE); + } + + for (int i = 0;i < TEST_NUM;i++) + free(slots[i]); + + return 0; +}