[phobos] Showstopper bug: Hello world fails on OSX!

Michel Fortin michel.fortin at michelf.com
Mon Nov 8 15:26:56 PST 2010


Le 2010-11-08 à 17:12, Walter Bright a écrit :

> See my reply: http://d.puremagic.com/issues/show_bug.cgi?id=4854

As a side note, I discovered this week that the Objective-C runtime also depends on knowing the size of a section to initialize itself properly. This is for a section that contains all the protocol definitions aggregated together; upon loading an image the list is traversed to 'fixup' the protocols...

The interesting point is that it does so without this begin,content,end section trickery, so it doesn't matter if sections get reordered during linking, which would be much more robust.

From what I found out by digging in the source code, this involves calling 'getsectdatafromheader' (or 'getsectdatafromheader_64') which returns the size as part of its last argument (see header "mach-o/getsect.h"). I'm not exactly sure how this all works, but there's definitely a way to make it work because it does work for the Objective-C runtime. Perhaps I should investigate a little more and send what I find on the list for druntime.

libobjc:

Source Browser:
<http://www.opensource.apple.com/source/objc4/objc4-437.1/>

Source Download link:
<http://www.opensource.apple.com/tarballs/objc4/objc4-437.1.tar.gz>

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





More information about the phobos mailing list