mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 17:26:07 +00:00
[Driver] Properly report error for unsupported powerpc darwin/macos triples
The removal started at https://reviews.llvm.org/D50989 and https://reviews.llvm.org/D75494 removed the Triple support. Without recognizing Darwin triples as Mach-O, we will get assertion error in ToolChains/Darwin.h due to the universal binary mechanism. Fix #47698 --- This requires fixing many misuses of llc -march= and llvm-mc -arch= ( commits 806761a7629df268c8aed49657aeccffa6bca449 and 252c42354eca54274ed7b10c32c73c6937478e8b).
This commit is contained in:
parent
ec42c78cc4
commit
2bdf5aa5df
@ -59,3 +59,7 @@
|
||||
// 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{{.*}}'
|
||||
|
@ -787,6 +787,8 @@ 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:
|
||||
@ -795,9 +797,7 @@ static Triple::ObjectFormatType getDefaultFormat(const Triple &T) {
|
||||
case Triple::thumb:
|
||||
case Triple::x86:
|
||||
case Triple::x86_64:
|
||||
if (T.isOSDarwin())
|
||||
return Triple::MachO;
|
||||
else if (T.isOSWindows())
|
||||
if (T.isOSWindows())
|
||||
return Triple::COFF;
|
||||
return Triple::ELF;
|
||||
|
||||
|
@ -1937,6 +1937,7 @@ 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());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user