freebsd-skq/contrib/llvm/patches/patch-r262262-clang-r198311-sparc.diff

32 lines
1.3 KiB
Diff
Raw Normal View History

Pull in r198311 from upstream clang trunk (by Roman Divacky):
In the FreeBSD assembler driver, inform the sparc assembler that we're producing
PIC code.
Introduced here: http://svn.freebsd.org/changeset/base/262262
Index: tools/clang/lib/Driver/Tools.cpp
===================================================================
--- tools/clang/lib/Driver/Tools.cpp
+++ tools/clang/lib/Driver/Tools.cpp
@@ -5785,6 +5785,19 @@ void freebsd::Assemble::ConstructJob(Compilation &
default:
CmdArgs.push_back("-matpcs");
}
+ } else if (getToolChain().getArch() == llvm::Triple::sparc ||
+ getToolChain().getArch() == llvm::Triple::sparcv9) {
+ 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,