[PATCH] D156351: clang driver throws error for -mabi=elfv2 or elfv2

Kishan Parmar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 29 03:44:29 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG065da3574b4f: clang driver throws error for -mabi=elfv2 or elfv2 (authored by long5hot).

Changed prior to commit:
  https://reviews.llvm.org/D156351?vs=544674&id=545359#toc

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=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
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.545359.patch
Type: text/x-patch
Size: 1928 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230729/ebbd454f/attachment.bin>


More information about the cfe-commits mailing list