[PATCH] D74631: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

David Tenty via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 14 10:39:40 PST 2020


daltenty created this revision.
daltenty added reviewers: stevewan, sfertile, Xiangling_L.
Herald added subscribers: llvm-commits, cfe-commits, dexonsmith.
Herald added projects: clang, LLVM.
daltenty updated this revision to Diff 244708.
daltenty added a comment.

- Add missing newline


XCOFF doesn't support COMDATs, so clang shouldn't emit them.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74631

Files:
  clang/test/CodeGen/xcoff-comdat.cpp
  llvm/include/llvm/ADT/Triple.h


Index: llvm/include/llvm/ADT/Triple.h
===================================================================
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-    return !isOSBinFormatMachO();
+    return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.
Index: clang/test/CodeGen/xcoff-comdat.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74631.244708.patch
Type: text/x-patch
Size: 887 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200214/4800cbc8/attachment.bin>


More information about the cfe-commits mailing list