This post might be a bit off topic but I'm hoping there's someone here
that can help me.
I'm working on implementing support for the Objective-C ABI in the D
programing language. I've based my work on the work made by another
developer a couple of years ago. Most of the code is already in place
and I'm now trying to make sure everything works after the merging the
latest changes from the D compiler.
The problem I have is when linking some code that calls an Objective-C
method. As far as I understand the object file is supposed to contain a
section __message_refs, in the __OBJC segment. This section contains
pointers to C strings, which contain the names of the Objective-C
selectors (methods). The C strings are stored in the __cstring __TEXT
section and segment. As far as I can see the these sections looks to
have the correct flags and contents.
The problem is I'm getting an assertion in the linker:
http://www.opensource.apple.com/source/ld64/ld64-134.9/src/ld/parsers/macho_relocatable_file.cpp
Line 5024, in Objc1ClassReferences<A>::targetCString. I'm pretty sure
that the value of "fit->binding" should be
"ld::Fixup::bindingByContentBound" but instead it is
"ld::Fixup::bindingDirectlyBound". The definition of these enums are
located here:
http://www.opensource.apple.com/source/ld64/ld64-134.9/src/ld/ld.hpp
Line 358, in Fixup::TargetBinding.
This is the result of "dumpobj", a tool shipped with the D compiler,
on
the D object file that fails to link:
http://pastebin.com/uPNZ8DpA
This is the dump of a corresponding Objective-C object file:
http://pastebin.com/NjbRRdZM
The following is a dump using a pre compiled alpha release of the D
compiler that the developer I'm basing my work on released in 2011. This
does not have this problem:
http://pastebin.com/rjjT1LBU
I'm running Mac OS X 10.8.3. All code is compiled as 32bit.
--
/Jacob Carlborg