MIPS: Pass -mabi option to the assmbler when compile MIPS targets.

llvm-svn: 154270
This commit is contained in:
Simon Atanasyan 2012-04-07 22:31:29 +00:00
parent 3b7589a6c3
commit 571d7bde3c
2 changed files with 28 additions and 14 deletions

View File

@ -5029,17 +5029,21 @@ void linuxtools::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
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);
if (CPUName) {
CmdArgs.push_back("-march");
CmdArgs.push_back(CPUName);
}
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";
CmdArgs.push_back("-mabi");
CmdArgs.push_back(ABIName.data());
if (getToolChain().getArch() == llvm::Triple::mips ||
getToolChain().getArch() == llvm::Triple::mips64)

View File

@ -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"