|
From: Dave N. <dc...@us...> - 2006-10-09 22:40:51
|
This happens on valgrind initialization irrespective of client program/32K or
64K mode. I tracked this down to the fact that on RHEL5 some PPCs can have 64K
pages. Valgrind hardwires the pagesize to be 4K and so the first call to mmap()
fails because the address is not a multiple of 64K.
Initially I thought I could get ./configure to generate a program to invoke
sysconf() and if it returned 64K setup some #define that can be used to
select the correct VKI_PAGE_SHIFT. However, after talking to a colleague I
learned that the valgrind executable (both 32K or 64K mode) has to be able to
handle both page sizes (because this will be compiled into a Red Hat release),
so the check needs to be dynamic.
Here is what I tried in include/vki-ppc{64,32}-linux.h:
#include <unistd.h>
...
/* PAGE_SHIFT determines the page size. On RHEL5 allows 64K page size */
static long __vki_page_shift = 0;
static inline long get_vki_page_shift() {
long page = sysconf(_SC_PAGESIZE);
while (!(page & 1)) {
__vki_page_shift++;
page >>= 1;
}
return __vki_page_shift;
}
#define VKI_PAGE_SHIFT \
(__vki_page_shift == 0 ? get_vki_page_shift() : __vki_page_shift)
This didn't link because the linker couldn't find sysconf(). I know that you
try to limit your dependence on system libraries so I assumed that it must be
from one of those libraries.
Any suggestions on how to proceed?
Julian Seward wrote:
>>>> Valgrind's memory management: out of memory:
>>>> newSuperblock's request for 1048576 bytes failed.
>>>> 14286848 bytes have already been allocated.
>>>> Valgrind cannot continue. Sorry.
>
> We need details. Is it able to run a simple hello-world program?
> In 32-bit or 64-bit mode? With --tool=none? If you can make a really
> simple test case fail, also send the result of running it with '-d -d -v -v'.
>
> J
|