AMD64 version of GNAT Ada compiler broken due to libthr

Kostik Belousov kostikbel at gmail.com
Fri Dec 31 19:46:24 UTC 2010


On Fri, Dec 31, 2010 at 08:37:14PM +0100, John Marino wrote:
> Hi Kostik,
> 
> Thanks for pointing me in the right direction.  After some research, I 
> discovered that only DragonFly BSD allows execution on the stack by 
> default.  NetBSD and OpenBSD (and Solaris and Darwin) all were specially 
> configured within gcc to execute mprotect first to enable this 
> functionality.  FreeBSD never had this gcc configuration code and 
> frankly it looks like it should have already been there.
> 
> I created my own __enable_execute_stack macro function based on these 
> previous works and now GNAT has passed all tests!  Since i386 always 
> worked, I only applied to macro to the AMD64 configuration header.
You need the same application of mprotect() for i386 too, since
32bit binary executed on amd64 kernel gets non-executable stack as well.

> 
> You've been a great help!  Once I understood what the issue was, 
> everything fell into place.
Will you upstream the changes to gcc ?

> 
> -- John
> 
> 
> Kostik Belousov wrote:
> >On Fri, Dec 31, 2010 at 02:37:29PM +0100, John Marino wrote:
> >>Yeah, that's kind of what I was getting at.  Would this patch get into 
> >>FreeBSD 8.2, and would that mean that GNAT would start working properly 
> >>starting with FreeBSD 8.2 if that happened?
> >Definitely not in 8.2.
> >Might be in 8.3, if successfully landed in HEAD.
> >
> >Besides the patch for the base system, compiler must be configured
> >to properly mark the objects that need executable thunks on the stack.
> >See the references in the arch@ message I pointed to.
> >
> >>I guess that also means the other BSD's have been allowing executable 
> >>stacks all along.
> >Or, there is a compiler configuration that prevents using the thunks
> >on the stack.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-threads/attachments/20101231/76b381e2/attachment-0001.pgp


More information about the freebsd-threads mailing list