Author: David Tenty Date: 2020-02-18T16:10:11-05:00 New Revision: 58817a0783ca405cd36a312c7ee80e061d1cecc5
URL: https://github.com/llvm/llvm-project/commit/58817a0783ca405cd36a312c7ee80e061d1cecc5 DIFF: https://github.com/llvm/llvm-project/commit/58817a0783ca405cd36a312c7ee80e061d1cecc5.diff LOG: [clang][XCOFF] Indicate that XCOFF does not support COMDATs Summary: XCOFF doesn't support COMDATs, so clang shouldn't emit them. Reviewers: stevewan, sfertile, Xiangling_L Reviewed By: sfertile Subscribers: dschuff, aheejin, dexonsmith, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D74631 Added: clang/test/CodeGen/xcoff-comdat.cpp Modified: llvm/docs/LangRef.rst llvm/include/llvm/ADT/Triple.h Removed: ################################################################################ diff --git a/clang/test/CodeGen/xcoff-comdat.cpp b/clang/test/CodeGen/xcoff-comdat.cpp new file mode 100644 index 000000000000..7da8d9a2cc22 --- /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 index 2a61e0b19987..d14853a4e0d5 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -910,8 +910,8 @@ The selection kind must be one of the following: 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 index 76a754d671fb..64ba8d7e21e4 100644 --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -743,7 +743,7 @@ class Triple { /// Tests whether the target supports comdat bool supportsCOMDAT() const { - return !isOSBinFormatMachO(); + return !(isOSBinFormatMachO() || isOSBinFormatXCOFF()); } /// Tests whether the target uses emulated TLS as default. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits