[phobos] Showstopper bug: Hello world fails on OSX!
Jacob Carlborg
doob at me.com
Tue Nov 9 00:25:08 PST 2010
It should work using getsectdatafromheader, that's what I changed when I added support for dynamic libraries to Tango. Have a look at the Tango code:
http://dsource.org/projects/tango/browser/trunk/tango/core/rt/compiler/dmd/object_.d#L1270 and http://dsource.org/projects/tango/browser/trunk/tango/core/rt/compiler/dmd/darwin/Image.d#L103 .
The file in the last link is completely made by me so you won't have to be afraid for looking at it. Or if you don't want to look at Tango source files at all you can look at this druntime change: http://www.dsource.org/projects/druntime/changeset/372 , to be more specific: http://www.dsource.org/projects/druntime/browser/trunk/src/rt/image.d?rev=372#L105
On 9 nov 2010, at 00:26, 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>
>
> --
> Michel Fortin
> michel.fortin at michelf.com
> http://michelf.com/
>
>
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
--
/Jacob Carlborg
More information about the phobos
mailing list