[llvm-branch-commits] [clang] c278f4c - clang driver throws error for -mabi=elfv2 or elfv2
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Aug 3 00:03:09 PDT 2023
Author: Kishan Parmar
Date: 2023-08-03T09:00:54+02:00
New Revision: c278f4c0a576d499cba9de158f09ddbd60752b39
URL: https://github.com/llvm/llvm-project/commit/c278f4c0a576d499cba9de158f09ddbd60752b39
DIFF: https://github.com/llvm/llvm-project/commit/c278f4c0a576d499cba9de158f09ddbd60752b39.diff
LOG: 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
(cherry picked from commit 065da3574b4fe9d4ee6283de2c82b8ce1c08af08)
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/ppc-abi.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index e3fa315ffcb1e9..8bd7d0918b3a81 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -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
diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c
index cc07b084132f15..a433f4c0f5d8fc 100644
--- 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=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
More information about the llvm-branch-commits
mailing list