Skip to content

Commit

Permalink
On {mips,mipsel,mips64,mips64el}-freebsd, we need to pass any -G opti…
Browse files Browse the repository at this point in the history
…on 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
  • Loading branch information
DimitryAndric committed Dec 27, 2015
1 parent f59a2b3 commit 46f338c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clang/lib/Driver/Tools.cpp
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions clang/test/Driver/freebsd-mips-as.c
Expand Up @@ -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"

0 comments on commit 46f338c

Please sign in to comment.