diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -2068,6 +2068,12 @@ } else if (V == "vec-extabi") { VecExtabi = true; A->claim(); + } else if (V == "elfv1") { + ABIName = "elfv1"; + A->claim(); + } else if (V == "elfv2") { + ABIName = "elfv2"; + A->claim(); } else if (V != "altivec") // The ppc64 linux abis are all "altivec" abis by default. Accept and ignore // the option if given as we don't have backend support for any targets diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c --- a/clang/test/Driver/ppc-abi.c +++ b/clang/test/Driver/ppc-abi.c @@ -15,6 +15,10 @@ // RUN: -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2 %s // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \ // RUN: -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2 %s +// RUN: %clang -target powerpc64le-unknown-unknown-gnu %s -### -o %t.o 2>&1 \ +// RUN: -mabi=elfv1 | FileCheck -check-prefix=CHECK-UNKNOWN-ELFv1 %s +// RUN: %clang -target powerpc64le-unknown-unknown-gnu %s -### -o %t.o 2>&1 \ +// RUN: -mabi=elfv2 | FileCheck -check-prefix=CHECK-UNKNOWN-ELFv2 %s // RUN: %clang -target powerpc64-unknown-freebsd11 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv1 %s // RUN: %clang -target powerpc64-unknown-freebsd12 %s -### 2>&1 | FileCheck --check-prefix=CHECK-ELFv1 %s @@ -31,6 +35,8 @@ // CHECK-ELFv2-BE: "-target-abi" "elfv2" // CHECK-ELFv2-BE-PIE: "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" // CHECK-ELFv2-BE-PIE: "-target-abi" "elfv2" +// CHECK-UNKNOWN-ELFv1: "-target-abi" "elfv1" +// CHECK-UNKNOWN-ELFv2: "-target-abi" "elfv2" // RUN: %clang -fPIC -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ELFv1-PIC %s