forked from OSchip/llvm-project
Apply some driver improvements for freebsd-*-mips*.
Patch by Brooks Davis. llvm-svn: 163249
This commit is contained in:
parent
dbc6c0bbc9
commit
c0f1a5e46e
|
@ -5131,17 +5131,48 @@ void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
// When building 32-bit code on FreeBSD/amd64, we have to explicitly
|
||||
// instruct as in the base system to assemble 32-bit code.
|
||||
if (getToolChain().getArchName() == "i386")
|
||||
if (getToolChain().getArch() == llvm::Triple::x86)
|
||||
CmdArgs.push_back("--32");
|
||||
|
||||
if (getToolChain().getArchName() == "powerpc")
|
||||
else if (getToolChain().getArch() == llvm::Triple::ppc)
|
||||
CmdArgs.push_back("-a32");
|
||||
else if (getToolChain().getArch() == llvm::Triple::mips ||
|
||||
getToolChain().getArch() == llvm::Triple::mipsel ||
|
||||
getToolChain().getArch() == llvm::Triple::mips64 ||
|
||||
getToolChain().getArch() == llvm::Triple::mips64el) {
|
||||
StringRef CPUName;
|
||||
StringRef ABIName;
|
||||
getMipsCPUAndABI(Args, getToolChain(), CPUName, ABIName);
|
||||
|
||||
// Set byte order explicitly
|
||||
if (getToolChain().getArchName() == "mips")
|
||||
CmdArgs.push_back("-EB");
|
||||
else if (getToolChain().getArchName() == "mipsel")
|
||||
CmdArgs.push_back("-EL");
|
||||
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)
|
||||
CmdArgs.push_back("-EB");
|
||||
else
|
||||
CmdArgs.push_back("-EL");
|
||||
|
||||
Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
|
||||
options::OPT_fpic, options::OPT_fno_pic,
|
||||
options::OPT_fPIE, options::OPT_fno_PIE,
|
||||
options::OPT_fpie, options::OPT_fno_pie);
|
||||
if (LastPICArg &&
|
||||
(LastPICArg->getOption().matches(options::OPT_fPIC) ||
|
||||
LastPICArg->getOption().matches(options::OPT_fpic) ||
|
||||
LastPICArg->getOption().matches(options::OPT_fPIE) ||
|
||||
LastPICArg->getOption().matches(options::OPT_fpie))) {
|
||||
CmdArgs.push_back("-KPIC");
|
||||
}
|
||||
}
|
||||
|
||||
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
|
||||
options::OPT_Xassembler);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// REQUIRES: ppc32-registered-target,ppc64-registered-target
|
||||
// REQUIRES: ppc32-registered-target,ppc64-registered-target,mips-registered-target
|
||||
// RUN: %clang -ccc-clang-archs powerpc -no-canonical-prefixes \
|
||||
// RUN: -target powerpc-pc-freebsd8 %s \
|
||||
// RUN: --sysroot=%S/Inputs/basic_freebsd_tree -### 2>&1 \
|
||||
|
@ -43,6 +43,34 @@
|
|||
// CHECK-LDFLAGS8: --enable-new-dtags
|
||||
// CHECK-LDFLAGS9: --hash-style=both
|
||||
// CHECK-LDFLAGS9: --enable-new-dtags
|
||||
//
|
||||
// Check that we do not pass --hash-style=gnu and --hash-style=both to linker
|
||||
// and provide correct path to the dynamic linker for MIPS platforms.
|
||||
// Also verify that we tell the assembler to target the right ISA and ABI.
|
||||
// RUN: %clang %s -### -o %t.o 2>&1 \
|
||||
// RUN: -target mips-unknown-freebsd10.0 -ccc-clang-archs mips \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-MIPS %s
|
||||
// CHECK-MIPS: "{{.*}}ld"
|
||||
// CHECK-MIPS: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
|
||||
// CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
|
||||
// RUN: %clang %s -### -o %t.o 2>&1 \
|
||||
// RUN: -target mipsel-unknown-freebsd10.0 -ccc-clang-archs mipsel \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-MIPSEL %s
|
||||
// CHECK-MIPSEL: "{{.*}}ld"
|
||||
// CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
|
||||
// CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
|
||||
// RUN: %clang %s -### -o %t.o 2>&1 \
|
||||
// RUN: -target mips64-unknown-freebsd10.0 -ccc-clang-archs mips64 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-MIPS64 %s
|
||||
// CHECK-MIPS64: "{{.*}}ld"
|
||||
// CHECK-MIPS64: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
|
||||
// CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
|
||||
// RUN: %clang %s -### -o %t.o 2>&1 \
|
||||
// RUN: -target mips64el-unknown-freebsd10.0 -ccc-clang-archs mips64el \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL %s
|
||||
// CHECK-MIPS64EL: "{{.*}}ld"
|
||||
// CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/libexec/ld-elf.so.1"
|
||||
// CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
|
||||
|
||||
// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -static %s \
|
||||
// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
|
||||
|
|
Loading…
Reference in New Issue