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

Jacob Carlborg doob at me.com
Mon Jul 25 05:57:27 PDT 2011


On 2011-07-25 13:29, Michel Fortin wrote:
> 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!").

I created a patch back then but it was never applied. The patch removed 
those "hacks" and uses "getsectdatafromheader" instead, but it never 
fixed the "Hello world fails on OSX!" issue completely.

http://d.puremagic.com/issues/show_bug.cgi?id=4854

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list