COFF: Add a test for ICF and circular references.
ICF is a feature to merge sections not by name (which is the regular COMDAT merging) but by contents. If two or more sections have the identical contents and relocations, ICF merges them to save space. Accessors or templated functions tend to have the same contents, and ICF can hold them. If we consider sections as vertices and relocations as edges, the problem is to find as many isomorphic graphs as possile from input graphs. MSVC linker is smart enough to identify isomorphic graphs even if they contain circles (GNU gold cannot handle circles according to http://research.google.com/pubs/pub36912.html, so this is impressive). Circular references are not uncommon in COFF object files. One example is .pdata. .pdata sections contain exception handler info for functions, so they naturally have relocations for the functions. The functions in turn have references to the .pdata sections so that the functions and their .pdata are linked together. As a result, they form circles. This is a test case for circular graphs. LLD is not able to handle this test case yet. I'll add code soon. llvm-svn: 245827
Loading
Please sign in to comment