[cfe-commits] r157635 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/mips-as.c
Simon Atanasyan
satanasyan at mips.com
Tue May 29 12:07:33 PDT 2012
Author: atanasyan
Date: Tue May 29 14:07:33 2012
New Revision: 157635
URL: http://llvm.org/viewvc/llvm-project?rev=157635&view=rev
Log:
MIPS: Pass -KPIC argument to MIPS assembler if necessary.
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=157635&r1=157634&r2=157635&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue May 29 14:07:33 2012
@@ -5137,6 +5137,18 @@
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,
Modified: cfe/trunk/test/Driver/mips-as.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-as.c?rev=157635&r1=157634&r2=157635&view=diff
==============================================================================
--- cfe/trunk/test/Driver/mips-as.c (original)
+++ cfe/trunk/test/Driver/mips-as.c Tue May 29 14:07:33 2012
@@ -4,6 +4,13 @@
// RUN: -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=MIPS32-EB-AS %s
// CHECK-MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
+// CHECK-MIPS32-EB-AS-NOT: "-KPIC"
+//
+// RUN: %clang -target mips-linux-gnu -### \
+// RUN: -no-integrated-as -fPIC -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=MIPS32-EB-PIC %s
+// CHECK-MIPS32-EB-PIC: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB"
+// CHECK-MIPS32-EB-PIC: "-KPIC"
//
// RUN: %clang -target mipsel-linux-gnu -### \
// RUN: -no-integrated-as -c %s 2>&1 \
More information about the cfe-commits
mailing list