[PATCH] D34803: [LTO] Remove values from non-prevailing comdats

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 20:50:50 PDT 2017


tejohnson added a comment.

In https://reviews.llvm.org/D34803#794815, @chandlerc wrote:

> Really sorry if I'm just missing context with a drive by comment ... but is this correct? What if two symbols in a comdat are actually required to be treated as a single comdat for correctness?


Not sure what scenario you are referring to, but this is invoked if we have already decided, based on linker info, that the comdat contains a non-prevailing copy of a linkonce or weak symbol. So we would already have removed that non-prevailing symbol from the comdat, leaving it incomplete. Presumably if the linker did not select that copy of the linkonce or weak as prevailing, then it has not selected this coppy of the comdat, and so we remove everything else from the comdat so as to not leave behind an incomplete comdat. Since the regular LTO native object is passed to the final link before any native objects from ThinLTO backends, leaving an incomplete comdat there could cause it to be incorrectly selected in the final link, when it wasn't originally (which is what was happening in the associated bug).


https://reviews.llvm.org/D34803





More information about the llvm-commits mailing list