From 195190912fae7329656cb1d193d3f741a0cf4015 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Thu, 18 Aug 2011 22:30:51 +0000 Subject: [PATCH] malloc build fixes --- lib/libc/ansi/malloc-debug.c | 4 ++++ lib/nbsd_libc/stdlib/Makefile.inc | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/libc/ansi/malloc-debug.c b/lib/libc/ansi/malloc-debug.c index 2a32bbfd4..c14717809 100644 --- a/lib/libc/ansi/malloc-debug.c +++ b/lib/libc/ansi/malloc-debug.c @@ -126,7 +126,11 @@ static struct block *block_alloc(size_t size) assert(ptr_min < ptr_max); /* select address at random */ +#ifdef __NBSD_LIBC + tsc = 0; +#else read_tsc_64(&tsc); +#endif totalsize = block_get_totalsize(size); page_index_max = (ptr_max - ptr_min - totalsize) / PAGE_SIZE; page_index = (page_index_max > 0) ? (ex64lo(tsc) % page_index_max) : 0; diff --git a/lib/nbsd_libc/stdlib/Makefile.inc b/lib/nbsd_libc/stdlib/Makefile.inc index 05d8c0a4e..f1abd7b2f 100644 --- a/lib/nbsd_libc/stdlib/Makefile.inc +++ b/lib/nbsd_libc/stdlib/Makefile.inc @@ -44,9 +44,9 @@ SRCS+= erand48_ieee754.c SRCS+= jemalloc.c .elif (${USE_MINIXMALLOC} != "no") SRCS+= \ - ${LIBCDIR}/../libc/stdlib/malloc.c \ - ${LIBCDIR}/../libc/stdlib/calloc.c \ - ${LIBCDIR}/../libc/stdlib/malloc-debug.c + ${LIBCDIR}/../libc/ansi/malloc.c \ + ${LIBCDIR}/../libc/ansi/calloc.c \ + ${LIBCDIR}/../libc/ansi/malloc-debug.c .else SRCS+= malloc.c .endif -- 2.44.0