[PATCH] D53234: Don't remove COMDATs when internalizing global objects

Aaron Hill via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 16 07:15:27 PDT 2018


Aaron1011 added a comment.

> So perhaps this code needs to handle comdat containing an object with associated metadata specially (e.g. could just include in the ExternalComdats set)?

My concern is that the current behavior would still be incorrect for other uses of COMDATS - or at the very least, quite counterintuitive.
If I specify a COMDAT for two global objects, I would expect one of the following things to happen:

1. Both objects appear in the final object, both still in the COMDAT.
2. Neither object appears in the final object, and the COMDAT section does not exist (both objects were optimized out).

Having only one of the two objects be present, and having it //lack// a COMDAT, seems very unexpected to me - especially considering that the COMDAT section
can be read using external tools (e.g. `readelf`).


https://reviews.llvm.org/D53234





More information about the llvm-commits mailing list