<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 26, 2011, at 8:11 AM, Talin wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; "><div style="word-wrap: break-word; "><div class="im"><div><blockquote type="cite"><div class="gmail_quote"><div><br class="Apple-interchange-newline">If that's true, then it means that we're back to the case where every type has to be fully defined down to the leaf level.</div></div></blockquote><br></div></div><div>I'm not sure what you mean.  LLVM is perfectly fine with opaque structs so long as you don't "deference" them, GEP into them, need their size, etc.</div></div></blockquote><div><br></div><div>Let me try with another example: Let's say Module A and Module B both import class Exception. Class Exception has a "message" field which is a pointer to type String. Now, let's say Module A dereferences the Exception.message field by printing the message. The compiler sees this dereference, and automatically loads the String module. Type String is added to Module A as a fully-resolved struct type.</div><div><br></div><div>In Module B, on the other hand, there is no dereference of the message field. So the compiler includes the definition of Exception, but the definition of String is opaque, because no code in Module B ever referred to any of the fields of class String. In fact the compiler never even loaded the definition of String because it wasn't needed.</div><div><br></div><div>Now we attempt to link together a bunch of modules including A and B. The linker sees that there are two types named "Exception" and renamed one of them. It also sees that there are two types named "String" and renames one of those as well. At this point, the linker fails because of a type mismatch. At least, this is the behavior that I am seeing.</div></span></blockquote></div><br><div>What do you mean "the linker fails"? Type mismatches should not cause the linker to fail.  In any case, this example should link, please provide a minimal example of two .ll files that repros what you're seeing with llvm-link.  Thanks,</div><div><br></div><div>-Chris</div></body></html>