[LLVMdev] StructType for dispatch_object_t changed by Linker

Duncan Sands baldrick at free.fr
Fri Dec 14 01:43:41 PST 2012


Hi Jaymie,

...
 > Step 2: %union.dispatch_object_t = type { %struct.dispatch_object_s* }
> Step 4: %union.dispatch_object_t = type { %struct.dispatch_object_s.1* }
>
> Code that reproduces the problem is at http://pastebin.com/pxveBUJa and
> http://pastebin.com/GDb9n9xA.
>
> A workaround is to call
> `StructType::create(mod->getContext(), "union.dispatch_object_t")` before doing
> Step 1.
>
> This sounds like what Chris was talking about in his blog post on the LLVM 3.0
> type system <http://blog.llvm.org/2011/11/llvm-30-type-system-rewrite.html>,
> "The Linker 'links' types and retypes IR objects".

exactly, this is where it is coming from.

  Except that I would have
> expected the Linker to recognize that the `dispatch_object_t` type in the loaded
> module and the generated code are the same. Am I doing something wrong, or is
> this a bug in LLVM? (I have LLVM 3.1, Mac OS X 10.6.)

Probably the types are not defined precisely the same in each module (maybe you
could send the exact definitions in each module to the mailing list?), but I
think there were also some bugs in this area that were fixed in 3.2.

Ciao, Duncan.




More information about the llvm-dev mailing list