Conversation
Avoid using sbrk(0) in emmalloc too.
|
Unfortunately this is causing applications to trap with an out of bounds access. |
|
Ah, that's unfortunate. Any help anyone might be able to provide in debugging this would be appreciated! |
Is that with or without the |
|
This is with LLVM 15.0.6. |
|
|
|
(irrelevant nit: the commit message and title of this PR have too many 'm's) |
|
|
||
| // Defind by the linker to have the address of the start of the heap. | ||
| extern unsigned char __heap_base; | ||
| extern unsigned char __heap_end __attribute__((__weak__)); |
There was a problem hiding this comment.
Since #394, this should no longer be weak.
In fact, building with MALLOC_IMPL=emmalloc is currently broken due to missing this symbol.
| unsigned char *heap_end = sbrk(0); | ||
| unsigned char *heap_end = &__heap_end; | ||
| if (heap_end == NULL) | ||
| heap_end = (unsigned char*) ((size_t) &__heap_base + (PAGE_SIZE-1) & -PAGE_SIZE); |
There was a problem hiding this comment.
Once non-weak, the NULL fallback is not needed, but the dlmalloc code is trapping on end < base.
Avoid using sbrk(0) in emmalloc too.