[PATCH] [PECOFF] Support yet another new type of weak symbol.

Rui Ueyama ruiu at google.com
Thu Mar 13 14:25:11 PDT 2014


  In the latest patch, I made a change to compare atoms by section's size rather than atom's size when choosing the largest one. As we discussed offline, this is the correct semantics for SELECT_LARGEST attribute because the attribute is not defined for a symbol but for the entire section. In order to compare section's size we follow layout-{before,after} edges to find all atoms in the same section.

  The difference of section size and atom size is not visible if the following two conditions meet:
   - There's only one symbol in a COMDAT section
   - The offset of the symbol is zero

  Otherwise, section size and atom size are not the same. In that case comparing atom sizes produces wrong results.

Comment at: include/lld/Core/DefinedAtom.h:103
@@ -102,1 +102,3 @@
+    mergeLargest,           // Choose the largest one from atoms with the same
+                            // name
     mergeByContent,         // Merge with other constants with same content.
kledzik at apple.com wrote:
> mergeSameNameLargestSize
The identifier seems a bit too long. Do you think we should rename the existing identifiers as


For existing identifiers "SameName" is implied. I'm even inclined to remove "SameName" from "mergeSameNameAndSize" for consistency.


More information about the llvm-commits mailing list