From mboxrd@z Thu Jan 1 00:00:00 1970 From: ality@pbrane.org (Anthony Martin) Date: Sun, 3 Apr 2011 14:13:33 -0700 Subject: [9fans] Go Plan 9 In-Reply-To: References: Message-ID: <20110403211333.GA3905@dinah> Topicbox-Message-UUID: c6f8a138-ead6-11e9-9d60-3106f5b1d025 andrey mirtchovski once said: > cross-compilation (GOOS=plan9, GOARCH=386, link with -s), but there > are a few issues -- the build fails at crypto, so fmt is not compiled. > for a hello world you need to manually make install pkg/strconv and > pkg/reflect and pkg/fmt. Everything works fine for me without the '-s' flag. Pavel Zholkover once said: > The produced binaries do not run properly on 9vx since the last gc > changes so its native or kvm+qemu etc. The reason it doesn't work on 9vx is because the 32 bit Go runtime reserves a large chunk of address space (currently 768mb). On all other platforms, this is accomplised with an mmap equivalient, which we all know won't work on Plan 9. Right now, if you want to run Go binaries on Plan 9, you have to apply the patch at the bottom of this message. In the future we should probably have the runtime use the segment(3) device. Anthony diff -r 11611373ac8a src/pkg/runtime/malloc.goc --- a/src/pkg/runtime/malloc.goc Sun Apr 03 09:11:41 2011 -0700 +++ b/src/pkg/runtime/malloc.goc Sun Apr 03 14:00:13 2011 -0700 @@ -231,7 +231,7 @@ int32 runtime?sizeof_C_MStats = sizeof(MStats); -#define MaxArena32 (2U<<30) +#define MaxArena32 (240U<<20) void runtime?mallocinit(void) @@ -292,7 +292,7 @@ // kernel threw at us, but normally that's a waste of 512 MB // of address space, which is probably too much in a 32-bit world. bitmap_size = MaxArena32 / (sizeof(void*)*8/4); - arena_size = 512<<20; + arena_size = 64<<20; // SysReserve treats the address we ask for, end, as a hint, // not as an absolute requirement. If we ask for the end