DragonLace.Net
Home of the GNAT AUX and future DRACO Ada compilers.

Quite a few months ago, I discovered that Ada tasking was broken on FreeBSD 9.0. Whenever a task would exit, the system would respond with "thread exits with resources held!" I noticed there was a new panic assertion in the thread library, so my first inclination was that GNAT was misbehaving on all POSIX machines, but only FreeBSD was detecting it. I was a little annoyed that new check actually caused a regression. Since I detected this on the GCC 4.6-based GNAT-Aux, the Adacore folks told me to check GCC 4.7 before they'd take it further. Fair enough.

After porting GCC 4.7 to FreeBSD (it's a new port called lang/gcc-aux), I confirmed that tasking was still broken. After more prodding by Adacore, I also confirmed that the same panic check did not break tasking in DragonFly. Oh Uh, this looks like a FreeBSD problem, not a GNAT bug. Sure enough, it was a bug in FreeBSD 9.0. It's been fixed now, so tasking will work on gnat-aux and gcc-aux on FreeBSD 9.1. A follow-up post will describe how to fix and rebuild the FreeBSD 9.0 thread library.

A second problem was discovered with the AMD64 platform (i386 platform is unaffected). All the stack-check and dereference tests would fail on gnat-aux and gcc-aux on FreeBSD 9.0 AMD64. It turns out that in order to support non-executable stacks (an option only available on AMD64), the signal trampoline had to be moved from just prior to the PS_STRINGS location to a shared page. This caused the end-of-stack detection in the FreeBSD unwind code to fail. A signal trampoline pattern match similar to what is done for NetBSD had to be created for FreeBSD 9.0 AMD. This fix will be included in the first port of gcc-aux.

Last edited Fri May 24 16:28:01 2013
© 2010 John Marino | design elements by styleshout | artwork by Arturo Aguirre