On {mips,mipsel,mips64,mips64el}-freebsd, we need to pass any -G option to the assembler.

Summary:
See also:
https://sourceware.org/binutils/docs/as/MIPS-Options.html#index-g_t_0040code_007b_002dG_007d-option-_0028MIPS_0029-1392

Reviewers: theraven, atanasyan, brooks, emaste

Subscribers: rnk, emaste, cfe-commits, seanbruno, dim

Differential Revision: http://reviews.llvm.org/D10137

llvm-svn: 256468
This commit is contained in:
Dimitry Andric 2015-12-27 10:36:44 +00:00
parent f59a2b3901
commit 46f338ce7f
2 changed files with 12 additions and 0 deletions

View File

@ -7776,6 +7776,12 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
else
CmdArgs.push_back("-EL");
if (Arg *A = Args.getLastArg(options::OPT_G)) {
StringRef v = A->getValue();
CmdArgs.push_back(Args.MakeArgString("-G" + v));
A->claim();
}
AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
break;
}

View File

@ -89,3 +89,9 @@
// RUN: -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R2 %s
// MIPS-ALIAS-64R2: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EB"
//
// RUN: %clang -target mips-unknown-freebsd -### \
// RUN: -no-integrated-as -G0 -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS32-EB-AS-G0 %s
// MIPS32-EB-AS-G0: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB" "-G0"
// MIPS32-EB-AS-G0-NOT: "-KPIC"