diff --git a/clang/test/CodeGen/xcoff-comdat.cpp b/clang/test/CodeGen/xcoff-comdat.cpp new file mode 100644 --- /dev/null +++ b/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 diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -910,8 +910,8 @@ The linker may choose any COMDAT key but the sections must contain the same amount of data. -Note that the Mach-O platform doesn't support COMDATs, and ELF and WebAssembly -only support ``any`` as a selection kind. +Note that XCOFF and the Mach-O platform don't support COMDATs, and ELF and +WebAssembly only support ``any`` as a selection kind. Here is an example of a COMDAT group where a function will only be selected if the COMDAT key's section is the largest: diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h --- a/llvm/include/llvm/ADT/Triple.h +++ b/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.