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

Jacob Carlborg doob at me.com
Tue Nov 9 00:33:04 PST 2010


See my replay to Michel Fortin.

Just out of curiosity why does DMD use this approach with begin, content, end to determine a section on Mac OS X? Looking at the source code for object_.d in Tango for LDC, the same implementation is used for all Posix systems and that is the same approach which is used in druntime for Linux, Solaris and FreeBSD.

On 9 nov 2010, at 00:51, Walter Bright wrote:

> 
> 
> Michel Fortin wrote:
>> 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>
>> 
>>  
> 
> If such works, then I'm all for using it to replace the current method.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos

-- 
/Jacob Carlborg



More information about the phobos mailing list