It does this due to the non default link location to allow loading RISC-V executables into the lower part in the non privileged common address space proxy model (not --privileged which currently implements a soft-mmu).
The platform allocator is not guaranteed to adjust its allocation area for the new text segment location so we implement a custom allocator that is the same on all platforms.
The issue is Clang generates code like this on x86_64, which requires allocations to be 16-byte aligned:
There are some pretty deep assumptions made in the TLSF allocator around 4 and 8 byte alignment so the allocator may need to be changed for a more flexible and thread-safe cross platform allocator.
The meta emulator uses the TLSF memory allocator: https://github.com/mattconte/tlsf
It does this due to the non default link location to allow loading RISC-V executables into the lower part in the non privileged common address space proxy model (not --privileged which currently implements a soft-mmu).
MACOS_LDFLAGS = -Wl,-pagezero_size,0x1000 -Wl,-no_pie -image_base 0x40000000 LINUX_LDFLAGS = -Wl,--section-start=.text=0x40000000 -static
The platform allocator is not guaranteed to adjust its allocation area for the new text segment location so we implement a custom allocator that is the same on all platforms.
The issue is Clang generates code like this on x86_64, which requires allocations to be 16-byte aligned:
There are some pretty deep assumptions made in the TLSF allocator around 4 and 8 byte alignment so the allocator may need to be changed for a more flexible and thread-safe cross platform allocator.