clang driver throws error for -mabi=elfv2 or elfv2

After clang release/16.x there is a regression that -mabi=elfv1
or -mabi=elfv2 are being unused and throws warning. But clang-trunk
throws error for -mabi=elfv2 or elfv1. Intent of this patch to accept
elfv1 or elfv2 for -mabi.

Reviewed By : nemanjai
Differential Revision: https://reviews.llvm.org/D156351
This commit is contained in:
Kishan Parmar
2023-07-29 16:09:54 +05:30
parent 87d0aedaa2
commit 065da3574b
2 changed files with 12 additions and 0 deletions

View File

@@ -2068,6 +2068,12 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
} 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

View File

@@ -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=ppc64 -mabi=elfv1 %s -### -o %t.o 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-UNKNOWN-ELFv1 %s
// RUN: %clang --target=ppc64 -mabi=elfv2 %s -### -o %t.o 2>&1 \
// RUN: | 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