[clang] [llvm] [TargetParser][PGO] NVPTX does not support COMDAT (PR #245705)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 12:05:59 PST 2026


================
@@ -1286,8 +1286,12 @@ class Triple {
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
+    // NVPTX is formatted as ELF, which does support COMDAT, unlike the other
+    // formats listed here.  However, it is compiled to PTX, assembled by ptxas
+    // into a cubin, which is linked by nvlink, and neither of those tools
+    // honors COMDAT.
     return !(isOSBinFormatMachO() || isOSBinFormatXCOFF() ||
-             isOSBinFormatDXContainer());
+             isOSBinFormatDXContainer() || isNVPTX());
----------------
jhuber6 wrote:

NVPTX pulls double duty, referring to textual PTX and cubins. Cubin files are ostensibly ELF, though they are heavily non-standards compliant. I think this is a valid approach given these constraints.

https://github.com/llvm/llvm-project/pull/245705


More information about the cfe-commits mailing list