a426b286c8
patch for r263619, and unify all the URLs to point to svnweb.
82 lines
3.3 KiB
Diff
82 lines
3.3 KiB
Diff
Pull in r199034 from upstream clang trunk (by Jakob Stoklund Olesen):
|
|
|
|
MIPS and SPARC assemblers both take the -KPIC flag.
|
|
|
|
Introduced here: http://svnweb.freebsd.org/changeset/base/262262
|
|
|
|
Index: tools/clang/lib/Driver/Tools.cpp
|
|
===================================================================
|
|
--- tools/clang/lib/Driver/Tools.cpp
|
|
+++ tools/clang/lib/Driver/Tools.cpp
|
|
@@ -6207,6 +6207,7 @@ void gnutools::Assemble::ConstructJob(Compilation
|
|
const ArgList &Args,
|
|
const char *LinkingOutput) const {
|
|
ArgStringList CmdArgs;
|
|
+ bool NeedsKPIC = false;
|
|
|
|
// Add --32/--64 to make sure we get the format we want.
|
|
// This is incomplete
|
|
@@ -6229,9 +6230,11 @@ void gnutools::Assemble::ConstructJob(Compilation
|
|
} else if (getToolChain().getArch() == llvm::Triple::sparc) {
|
|
CmdArgs.push_back("-32");
|
|
CmdArgs.push_back("-Av8plusa");
|
|
+ NeedsKPIC = true;
|
|
} else if (getToolChain().getArch() == llvm::Triple::sparcv9) {
|
|
CmdArgs.push_back("-64");
|
|
CmdArgs.push_back("-Av9a");
|
|
+ NeedsKPIC = true;
|
|
} else if (getToolChain().getArch() == llvm::Triple::arm) {
|
|
StringRef MArch = getToolChain().getArchName();
|
|
if (MArch == "armv7" || MArch == "armv7a" || MArch == "armv7-a")
|
|
@@ -6291,6 +6294,15 @@ void gnutools::Assemble::ConstructJob(Compilation
|
|
CmdArgs.push_back(Args.MakeArgString("-mmsa"));
|
|
}
|
|
|
|
+ NeedsKPIC = true;
|
|
+ } else if (getToolChain().getArch() == llvm::Triple::systemz) {
|
|
+ // Always pass an -march option, since our default of z10 is later
|
|
+ // than the GNU assembler's default.
|
|
+ StringRef CPUName = getSystemZTargetCPU(Args);
|
|
+ CmdArgs.push_back(Args.MakeArgString("-march=" + CPUName));
|
|
+ }
|
|
+
|
|
+ if (NeedsKPIC) {
|
|
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,
|
|
@@ -6302,11 +6314,6 @@ void gnutools::Assemble::ConstructJob(Compilation
|
|
LastPICArg->getOption().matches(options::OPT_fpie))) {
|
|
CmdArgs.push_back("-KPIC");
|
|
}
|
|
- } else if (getToolChain().getArch() == llvm::Triple::systemz) {
|
|
- // Always pass an -march option, since our default of z10 is later
|
|
- // than the GNU assembler's default.
|
|
- StringRef CPUName = getSystemZTargetCPU(Args);
|
|
- CmdArgs.push_back(Args.MakeArgString("-march=" + CPUName));
|
|
}
|
|
|
|
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
|
|
Index: tools/clang/test/Driver/linux-as.c
|
|
===================================================================
|
|
--- tools/clang/test/Driver/linux-as.c
|
|
+++ tools/clang/test/Driver/linux-as.c
|
|
@@ -66,8 +66,18 @@
|
|
// CHECK-SPARCV9: as
|
|
// CHECK-SPARCV9: -64
|
|
// CHECK-SPARCV9: -Av9a
|
|
+// CHECK-SPARCV9-NOT: -KPIC
|
|
// CHECK-SPARCV9: -o
|
|
//
|
|
+// RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
|
|
+// RUN: -no-integrated-as -fpic -c %s 2>&1 \
|
|
+// RUN: | FileCheck -check-prefix=CHECK-SPARCV9PIC %s
|
|
+// CHECK-SPARCV9PIC: as
|
|
+// CHECK-SPARCV9PIC: -64
|
|
+// CHECK-SPARCV9PIC: -Av9a
|
|
+// CHECK-SPARCV9PIC: -KPIC
|
|
+// CHECK-SPARCV9PIC: -o
|
|
+//
|
|
// RUN: %clang -target sparc-linux -mcpu=invalid-cpu -### \
|
|
// RUN: -no-integrated-as -c %s 2>&1 \
|
|
// RUN: | FileCheck -check-prefix=CHECK-SPARCV8 %s
|