<div dir="ltr"><br><div>Hi all,</div><div><br></div><div>With C++'s ODR, we are able to unique C++ types by using type identifiers to refer to types.</div><div>Type identifiers are generated by C++ mangler. What about languages without ODR? Should we unique C types as well?</div>
<div><br></div><div>One solution for C types is to generate a cross-CU unique identifier for C types. And before linking, we update all type identifiers in a source module with the corresponding hash of the C types, then linking can continue as usual.</div>
<div><br></div><div>This requires clang to generate a cross-CU unique identifier for C types (one simple scheme is using a identifier that is unique within the CU and concatenating the CU's file name). And it also requires hashing of C types at DebugInfo IR level. We can add an API such as updateTypeIdentifiers(Module *), linker can call it right before linking in a source module.</div>
<div><br></div><div>This is a preliminary design to start discussion.</div><div><br></div><div>Comments and feedback are welcome.</div><div><br></div><div>Thanks,</div><div>Manman</div><div><br></div><div><br></div></div>