Commit 08d22f9b by Ian Lance Taylor

runtime: Check _end rather than end to find end of program.

This fixes a problem on Solaris, where end is not defined in
the main program but comes from some shared library.  This
only matters for 32-bit targets.

From-SVN: r201220
parent f735ce31
...@@ -319,7 +319,7 @@ runtime_mallocinit(void) ...@@ -319,7 +319,7 @@ runtime_mallocinit(void)
{ {
byte *p; byte *p;
uintptr arena_size, bitmap_size; uintptr arena_size, bitmap_size;
extern byte end[]; extern byte _end[];
byte *want; byte *want;
uintptr limit; uintptr limit;
...@@ -408,7 +408,7 @@ runtime_mallocinit(void) ...@@ -408,7 +408,7 @@ runtime_mallocinit(void)
// So adjust it upward a little bit ourselves: 1/4 MB to get // So adjust it upward a little bit ourselves: 1/4 MB to get
// away from the running binary image and then round up // away from the running binary image and then round up
// to a MB boundary. // to a MB boundary.
want = (byte*)(((uintptr)end + (1<<18) + (1<<20) - 1)&~((1<<20)-1)); want = (byte*)(((uintptr)_end + (1<<18) + (1<<20) - 1)&~((1<<20)-1));
if(0xffffffff - (uintptr)want <= bitmap_size + arena_size) if(0xffffffff - (uintptr)want <= bitmap_size + arena_size)
want = 0; want = 0;
p = runtime_SysReserve(want, bitmap_size + arena_size); p = runtime_SysReserve(want, bitmap_size + arena_size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment