[boehm-gc] Use thr_stksegment to determine Solaris stack base

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Wed Mar 6 11:31:00 GMT 2013

Since Solaris 11.1/x86, a few 32-bit boehm-gc testcases started to FAIL:

FAIL: boehm-gc.c/gctest.c -O2 execution test
FAIL: boehm-gc.c/leak_test.c -O2 execution test
FAIL: boehm-gc.c/thread_leak_test.c -O2 execution test
FAIL: boehm-gc.lib/staticrootstest.c -O2 execution test

They all SEGV on the first call to GC_mark_from.  This turns out to be a
side effect of the virtual memory system rewrite (VM 2.0) in that
Solaris version: one of the very few user-visible changes in that
release was that the 32-bit x86 stack base changed, unfortunately
without updating the USRSTACK definition in <sys/vmparam.h>.

Unlike the boehm-gc 6.6-based version in the gcc tree, the failure
doesn't happen with gc 7.2c.  It turns out that this is case since that
version uses the thr_stksegment(3C) function instead of the macro.  This
function exists since at least Solaris 2.5.1 and has the additional
advantage of also working with ASLR also introduced with VM2, where a
fixed stack base is wrong.

This patch fixes the failures by backporting the use of thr_stksegment
from gc 7.2c.

Bootstrapped without regressions on i386-pc-solaris2.{9,10,11} and
sparc-sun-solaris2.{9,10,11}, fixes the i386-pc-solaris2.11 failures.

Ok for mainline?


2013-03-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* os_dep.c [SOLARIS_STACKBOTTOM] (GC_solaris_stack_base): New
	[!BEOS && !AMIGA && !MSWIN32 && !MSWINCE && !OS2 && !NOSYS &&
	!ECOS] (GC_get_stack_base): Use it.
	* include/private/gcconfig.h [SPARC && SUNOS5]
	[I386 && SUNOS5]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol2-boehm-gc-stack.patch
Type: text/x-patch
Size: 4413 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130306/c3deac6f/attachment.bin>
-------------- next part --------------

Rainer Orth, Center for Biotechnology, Bielefeld University

More information about the Gcc-patches mailing list