[PATCH] D156351: clang driver throws error for -mabi=elfv2 or elfv2
Kishan Parmar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 27 03:06:27 PDT 2023
long5hot updated this revision to Diff 544674.
long5hot added a comment.
Herald added a subscriber: kbarton.
failure is only when we do not give full target triple.
for e.x. --target=ppc64 -mabi=elfv2
or even when OS option is unknown e.g. --target=powerpc64-unknown-gnu
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156351/new/
https://reviews.llvm.org/D156351
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/ppc-abi.c
Index: clang/test/Driver/ppc-abi.c
===================================================================
--- clang/test/Driver/ppc-abi.c
+++ 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
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156351.544674.patch
Type: text/x-patch
Size: 1982 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230727/11333208/attachment-0001.bin>
More information about the cfe-commits
mailing list