[clang] cc20130 - Revert "[Driver] Properly report error for unsupported powerpc darwin/macos triples"

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 14:09:10 PDT 2023


Author: Nico Weber
Date: 2023-09-11T14:08:59-07:00
New Revision: cc2013061ee63f3fc4f9b49c6d836d99d102071b

URL: https://github.com/llvm/llvm-project/commit/cc2013061ee63f3fc4f9b49c6d836d99d102071b
DIFF: https://github.com/llvm/llvm-project/commit/cc2013061ee63f3fc4f9b49c6d836d99d102071b.diff

LOG: Revert "[Driver] Properly report error for unsupported powerpc darwin/macos triples"

This reverts commit 9f77facfce3ca23213c1de2e3e4c969b5187e29d.

The change unintentionally changed lots of codegen, see
https://github.com/llvm/llvm-project/issues/47698#issuecomment-1714548640

Also revert a follow-up:
This reverts commit b40a5bead2cb95c90ecd8c0fa566722e6133e01c.

Added: 
    

Modified: 
    clang/test/Driver/unsupported-target-arch.c
    llvm/lib/TargetParser/Triple.cpp
    llvm/unittests/TargetParser/TripleTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/Driver/unsupported-target-arch.c b/clang/test/Driver/unsupported-target-arch.c
index 8df0ee9fe7d06f1..24174650151f1ce 100644
--- a/clang/test/Driver/unsupported-target-arch.c
+++ b/clang/test/Driver/unsupported-target-arch.c
@@ -59,7 +59,3 @@
 // RUN: not %clang --target=thumbeb-none-elf -o %t.o %s 2> %t.err
 // RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-THUMBEB-INVALID-ENV %s
 // CHECK-THUMBEB-INVALID-ENV: warning: mismatch between architecture and environment in target triple 'thumbeb-none-elf'; did you mean 'thumbeb-none-eabi'? [-Winvalid-command-line-argument]{{$}}
-
-// RUN: not %clang --target=powerpc-apple-darwin -o /dev/null %s 2> %t.err
-// RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-PPCMAC %s
-// CHECK-PPCMAC: error: unknown target triple 'unknown-apple-macosx{{.*}}'

diff  --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
index 3da145f3b0b8927..260819d4a83d5a2 100644
--- a/llvm/lib/TargetParser/Triple.cpp
+++ b/llvm/lib/TargetParser/Triple.cpp
@@ -787,8 +787,6 @@ static Triple::SubArchType parseSubArch(StringRef SubArchName) {
 }
 
 static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
-  if (T.isOSDarwin())
-    return Triple::MachO;
   switch (T.getArch()) {
   case Triple::UnknownArch:
   case Triple::aarch64:
@@ -797,7 +795,9 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
   case Triple::thumb:
   case Triple::x86:
   case Triple::x86_64:
-    if (T.isOSWindows())
+    if (T.isOSDarwin())
+      return Triple::MachO;
+    else if (T.isOSWindows())
       return Triple::COFF;
     return Triple::ELF;
 

diff  --git a/llvm/unittests/TargetParser/TripleTest.cpp b/llvm/unittests/TargetParser/TripleTest.cpp
index 2b2ec73fcb8a926..dae5a82ff491860 100644
--- a/llvm/unittests/TargetParser/TripleTest.cpp
+++ b/llvm/unittests/TargetParser/TripleTest.cpp
@@ -1937,7 +1937,6 @@ TEST(TripleTest, FileFormat) {
   EXPECT_EQ(Triple::MachO, Triple("i686-apple-macosx").getObjectFormat());
   EXPECT_EQ(Triple::MachO, Triple("i686-apple-ios").getObjectFormat());
   EXPECT_EQ(Triple::MachO, Triple("i686---macho").getObjectFormat());
-  EXPECT_EQ(Triple::MachO, Triple("powerpc-apple-macosx").getObjectFormat());
 
   EXPECT_EQ(Triple::COFF, Triple("i686--win32").getObjectFormat());
 


        


More information about the cfe-commits mailing list