OS X 10.7 (Lion) breaks DMD-compiled executables due to ASLR (?)

Michel Fortin michel.fortin at michelf.com
Mon Jul 25 04:29:19 PDT 2011


On 2011-07-25 05:07:32 +0000, Sean Kelly <sean at invisibleduck.org> said:

> I ran into this issue but didn't have time to track it down at the time.
>  I'd guess that it's the same old object file generation issue that
> arises with every OSX release (where the way DMD marks data blocks for
> exception handling, TLS, etc, breaks for one reason or another), and
> that ASLR is simply the latest cause.  I couldn't suggest a fix
> though... I don't know how ASLR works well enough.

The way all those blocks are identified by the runtime is a hack. It 
works, but it's too fragile. What needs to be done is to use the proper 
API for getting data segments -- namely "getsectdatafromheader" or 
"getsectdatafromheader_64", or some equivalent -- instead of depending 
on some dummy segments always being ordered in a specific way by the 
linker and the loader.

There was a discussion about that on the phobos mailing list back in 
november 2010 (see "Showstopper bug: Hello world fails on OSX!").

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list