[cfe-commits] r154270 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/mips-as.c
Simon Atanasyan
satanasyan at mips.com
Sat Apr 7 15:31:30 PDT 2012
Author: atanasyan
Date: Sat Apr 7 17:31:29 2012
New Revision: 154270
URL: http://llvm.org/viewvc/llvm-project?rev=154270&view=rev
Log:
MIPS: Pass -mabi option to the assmbler when compile MIPS targets.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/mips-as.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=154270&r1=154269&r2=154270&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sat Apr 7 17:31:29 2012
@@ -5029,17 +5029,21 @@
getToolChain().getArch() == llvm::Triple::mipsel ||
getToolChain().getArch() == llvm::Triple::mips64 ||
getToolChain().getArch() == llvm::Triple::mips64el) {
- // Get Mips CPU name and pass it to 'as'.
- const char *CPUName;
- if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
- CPUName = A->getValue(Args);
- else
- CPUName = getMipsCPUFromArch(getToolChain().getArchName());
+ StringRef CPUName;
+ StringRef ABIName;
+ getMipsCPUAndABI(Args, getToolChain(), CPUName, ABIName);
+
+ CmdArgs.push_back("-march");
+ CmdArgs.push_back(CPUName.data());
+
+ // Convert ABI name to the GNU tools acceptable variant.
+ if (ABIName == "o32")
+ ABIName = "32";
+ else if (ABIName == "n64")
+ ABIName = "64";
- if (CPUName) {
- CmdArgs.push_back("-march");
- CmdArgs.push_back(CPUName);
- }
+ CmdArgs.push_back("-mabi");
+ CmdArgs.push_back(ABIName.data());
if (getToolChain().getArch() == llvm::Triple::mips ||
getToolChain().getArch() == llvm::Triple::mips64)
Modified: cfe/trunk/test/Driver/mips-as.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-as.c?rev=154270&r1=154269&r2=154270&view=diff
==============================================================================
--- cfe/trunk/test/Driver/mips-as.c (original)
+++ cfe/trunk/test/Driver/mips-as.c Sat Apr 7 17:31:29 2012
@@ -3,19 +3,29 @@
// RUN: %clang -target mips-linux-gnu -### \
// RUN: -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS32-EB-AS %s
-// CHECK-MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips32" "-EB"
+// CHECK-MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
//
// RUN: %clang -target mipsel-linux-gnu -### \
// RUN: -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS32-EL-AS %s
-// CHECK-MIPS32-EL-AS: as{{(.exe)?}}" "-march" "mips32" "-EL"
+// CHECK-MIPS32-EL-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EL"
//
// RUN: %clang -target mips64-linux-gnu -### \
// RUN: -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS64-EB-AS %s
-// CHECK-MIPS64-EB-AS: as{{(.exe)?}}" "-march" "mips64" "-EB"
+// CHECK-MIPS64-EB-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB"
//
// RUN: %clang -target mips64el-linux-gnu -### \
// RUN: -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS64-EL-AS %s
-// CHECK-MIPS64-EL-AS: as{{(.exe)?}}" "-march" "mips64" "-EL"
+// CHECK-MIPS64-EL-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EL"
+//
+// RUN: %clang -target mips-linux-gnu -mabi=eabi -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-EABI %s
+// CHECK-MIPS-EABI: as{{(.exe)?}}" "-march" "mips32" "-mabi" "eabi" "-EB"
+//
+// RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \
+// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS-N32 %s
+// CHECK-MIPS-N32: as{{(.exe)?}}" "-march" "mips64" "-mabi" "n32" "-EB"
More information about the cfe-commits
mailing list