broken testing caused by r248546
Yaron Keren via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 25 01:58:20 PDT 2015
Hi Katya,
Either option is OK, as long as the bots are green again.Once they are OK
you can take your time to figure out how to best solve the issue.
The problem with failing bots is that they stop reporting new failures so
if some commit is breaking more tests on failing bot the committer will not
even get a notification.
Yaron
2015-09-25 11:24 GMT+03:00 Romanova, Katya <
Katya_Romanova at playstation.sony.com>:
> Thank you, Yaron!
>
>
>
> We might have to change or remove one newly added test (namely, ps4-linker-win.c) while we investigating. It looks like that’s the only test that creates problems for non-PS4 buildbots.
>
> Hopefully, nobody outside SCE is concerned about PS4 buildbot (llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast) test failures. We are trying to come up with an acceptable solution internally. Hopefully, it will involve PS4 builtbot infrastructure changes only.
>
>
>
> Do you think I should revert r248546 completely or just remove the new ‘ps4-linker-win.c’ test that fails on non-PS4 Windows bots.
>
>
>
> Hopefully, we could resolve PS4 buildbot issues tomorrow.
>
>
>
> Katya.
>
>
>
>
>
>
>
>
>
> *From:* Yaron Keren [mailto:yaron.keren at gmail.com]
> *Sent:* Friday, September 25, 2015 12:09 AM
> *To:* Romanova, Katya
> *Cc:* cfe-commits at lists.llvm.org
> *Subject:* Re: broken testing caused by r248546
>
>
>
> Here too:
>
>
>
> http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/3285
>
>
>
>
> http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/3285/steps/test-clang/logs/Clang%20%3A%3A%20Driver__ps4-linker-win.c
>
>
>
>
>
> 2015-09-25 2:10 GMT+03:00 Romanova, Katya via cfe-commits <
> cfe-commits at lists.llvm.org>:
>
> Hi,
>
>
>
> My today’s commit r248546 caused some problem for PS4 bot:
>
>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/342
>
> and for x64-ninja-win7 bot
>
> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/5355
>
>
>
> It was a single problem that caused all the failures. The tests (or PS4
> bot setup) will be changed to adjust accordingly. The compiler will not be
> changed.
>
>
>
> If all other platforms, except PS4, are not affected, please do not revert
> the change! We are looking into this problem.
>
>
>
> I saw that sanitizer-windows bot failed too. However, it looks like it’s a
> svn timeout problem and it’s not related to our patch.
>
> http://lab.llvm.org:8011/builders/sanitizer-windows/builds/10285
>
>
>
> Katya.
>
>
>
>
>
>
>
>
>
>
>
>
>
> -----Original Message-----
>
> From: cfe-commits [mailto:cfe-commits-bounces at lists.llvm.org
> <cfe-commits-bounces at lists.llvm.org>] On Behalf Of Ekaterina Romanova via
> cfe-commits
>
> Sent: Thursday, September 24, 2015 15:07
>
> To: cfe-commits at lists.llvm.org
>
> Subject: r248546 - This patch adds missing pieces to clang, including the
> PS4 toolchain
>
>
>
> Author: kromanova
>
> Date: Thu Sep 24 17:06:52 2015
>
> New Revision: 248546
>
>
>
> URL: http://llvm.org/viewvc/llvm-project?rev=248546&view=rev
>
> Log:
>
> This patch adds missing pieces to clang, including the PS4 toolchain
> definition, added warnings, PS4 defaults, and Driver changes needed for our
> compiler.
>
>
>
> A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!
>
>
>
> Differential Revision: http://reviews.llvm.org/D11279
>
>
>
>
>
> Added:
>
> cfe/trunk/test/Driver/Inputs/scei-ps4_tree/
>
> cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/
>
> cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/include/
>
> cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/include/.keep
>
> cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/include_common/
>
> cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/include_common/.keep
>
> cfe/trunk/test/Driver/ps4-header-search.c
>
> cfe/trunk/test/Driver/ps4-linker-non-win.c
>
> cfe/trunk/test/Driver/ps4-linker-win.c
>
> cfe/trunk/test/Driver/ps4-pic.c
>
> cfe/trunk/test/Driver/ps4-sdk-root.c
>
> Modified:
>
> cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
>
> cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>
> cfe/trunk/lib/Driver/Driver.cpp
>
> cfe/trunk/lib/Driver/ToolChains.cpp
>
> cfe/trunk/lib/Driver/ToolChains.h
>
> cfe/trunk/lib/Driver/Tools.cpp
>
> cfe/trunk/lib/Driver/Tools.h
>
> cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>
> cfe/trunk/test/Driver/debug-options.c
>
> cfe/trunk/test/Driver/rtti-options.cpp
>
> cfe/trunk/test/Driver/stack-protector.c
>
>
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
>
> +++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Thu Sep 24
>
> +++ 17:06:52 2015
>
> @@ -192,4 +192,18 @@ def warn_target_unsupported_nan2008 : Wa def
> warn_target_unsupported_nanlegacy : Warning<
>
> "ignoring '-mnan=legacy' option because the '%0' architecture does not
> support it">,
>
> InGroup<UnsupportedNan>;
>
> +
>
> +def warn_drv_unable_to_find_directory_expected : Warning<
>
> + "unable to find %0 directory, expected to be in '%1'">,
>
> + InGroup<InvalidOrNonExistentDirectory>;
>
> +
>
> +def warn_drv_ps4_force_pic : Warning<
>
> + "option '%0' was ignored by the PS4 toolchain, using '-fPIC'">,
>
> + InGroup<OptionIgnored>;
>
> +
>
> +def warn_drv_ps4_sdk_dir : Warning<
>
> + "environment variable SCE_PS4_SDK_DIR is set, but points to invalid
>
> +or nonexistent directory '%0'">,
>
> + InGroup<InvalidOrNonExistentDirectory>;
>
> +
>
> +def err_drv_unsupported_linker : Error<"unsupported value '%0' for
>
> +-linker option">;
>
> }
>
>
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
>
> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Thu Sep 24
>
> +++ 17:06:52 2015
>
> @@ -820,3 +820,7 @@ def CudaCompat : DiagGroup<"cuda-compat"
>
> // A warning group for things that will change semantics in the future.
>
> def FutureCompat : DiagGroup<"future-compat">;
>
> +
>
> +def InvalidOrNonExistentDirectory :
>
> +DiagGroup<"invalid-or-nonexistent-directory">;
>
> +
>
> +def OptionIgnored : DiagGroup<"option-ignored">;
>
>
>
> Modified: cfe/trunk/lib/Driver/Driver.cpp
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/lib/Driver/Driver.cpp (original)
>
> +++ cfe/trunk/lib/Driver/Driver.cpp Thu Sep 24 17:06:52 2015
>
> @@ -2254,6 +2254,9 @@ const ToolChain &Driver::getToolChain(co
>
> case llvm::Triple::CUDA:
>
> TC = new toolchains::CudaToolChain(*this, Target, Args);
>
> break;
>
> + case llvm::Triple::PS4:
>
> + TC = new toolchains::PS4CPU(*this, Target, Args);
>
> + break;
>
> default:
>
> // Of these targets, Hexagon is the only one that might have
>
> // an OS of Linux, in which case it got handled above already.
>
>
>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
>
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Sep 24 17:06:52 2015
>
> @@ -4065,3 +4065,69 @@ void WebAssembly::addClangTargetOptions(
>
> options::OPT_fno_use_init_array, true))
>
> CC1Args.push_back("-fuse-init-array");
>
> }
>
> +
>
> +PS4CPU::PS4CPU(const Driver &D, const llvm::Triple &Triple, const ArgList
> &Args)
>
> + : Generic_ELF(D, Triple, Args) {
>
> + if (Args.hasArg(options::OPT_static))
>
> + D.Diag(diag::err_drv_unsupported_opt_for_target) << "-static" <<
>
> +"PS4";
>
> +
>
> + // Determine where to find the PS4 libraries. We use SCE_PS4_SDK_DIR
>
> + // if it exists; otherwise use the driver's installation path, which
>
> + // should be <SDK_DIR>/host_tools/bin.
>
> + const char *EnvValue = getenv("SCE_PS4_SDK_DIR"); if (EnvValue &&
>
> + !llvm::sys::fs::exists(EnvValue))
>
> + getDriver().Diag(clang::diag::warn_drv_ps4_sdk_dir) << EnvValue;
>
> +
>
> + std::string PS4SDKDir = (EnvValue ? EnvValue : getDriver().Dir +
>
> + "/../..");
>
> +
>
> + // Report a warning if we can't find the include or lib directories
>
> + from // the SDK.
>
> + // If -isysroot was passed, use that as the SDK base path.
>
> + std::string PrefixDir;
>
> + if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
>
> + PrefixDir = A->getValue();
>
> + if (!llvm::sys::fs::exists(PrefixDir))
>
> + getDriver().Diag(clang::diag::warn_missing_sysroot) << PrefixDir;
>
> + } else
>
> + PrefixDir = PS4SDKDir;
>
> +
>
> + std::string PS4SDKIncludeDir = PrefixDir + "/target/include"; if
>
> + (!Args.hasArg(options::OPT_nostdinc) &&
>
> + !Args.hasArg(options::OPT_nostdlibinc) &&
>
> + !Args.hasArg(options::OPT_isysroot) &&
>
> + !Args.hasArg(options::OPT__sysroot_EQ) &&
>
> + !llvm::sys::fs::exists(PS4SDKIncludeDir)) {
>
> +
> getDriver().Diag(clang::diag::warn_drv_unable_to_find_directory_expected)
>
> + << "PS4 system headers" << PS4SDKIncludeDir; }
>
> +
>
> + std::string PS4SDKLibDir = PS4SDKDir + "/target/lib";
>
> + if (!Args.hasArg(options::OPT_nostdlib) &&
>
> + !Args.hasArg(options::OPT_nodefaultlibs) &&
>
> + !Args.hasArg(options::OPT__sysroot_EQ) &&
> !Args.hasArg(options::OPT_E) &&
>
> + !Args.hasArg(options::OPT_c) && !Args.hasArg(options::OPT_S) &&
>
> + !Args.hasArg(options::OPT_emit_ast) &&
>
> + !llvm::sys::fs::exists(PS4SDKLibDir)) {
>
> +
> getDriver().Diag(clang::diag::warn_drv_unable_to_find_directory_expected)
>
> + << "PS4 system libraries" << PS4SDKLibDir;
>
> + return;
>
> + }
>
> + getFilePaths().push_back(PS4SDKLibDir);
>
> +}
>
> +
>
> +Tool *PS4CPU::buildAssembler() const {
>
> + return new tools::PS4cpu::Assemble(*this); }
>
> +
>
> +Tool *PS4CPU::buildLinker() const { return new
>
> +tools::PS4cpu::Link(*this); }
>
> +
>
> +bool PS4CPU::isPICDefault() const { return true; }
>
> +
>
> +bool PS4CPU::HasNativeLLVMSupport() const { return true; }
>
> +
>
> +SanitizerMask PS4CPU::getSupportedSanitizers() const {
>
> + SanitizerMask Res = ToolChain::getSupportedSanitizers();
>
> + Res |= SanitizerKind::Address;
>
> + Res |= SanitizerKind::Vptr;
>
> + return Res;
>
> +}
>
>
>
> Modified: cfe/trunk/lib/Driver/ToolChains.h
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/lib/Driver/ToolChains.h (original)
>
> +++ cfe/trunk/lib/Driver/ToolChains.h Thu Sep 24 17:06:52 2015
>
> @@ -1002,6 +1002,27 @@ private:
>
> llvm::opt::ArgStringList &CC1Args) const
> override; };
>
> +class LLVM_LIBRARY_VISIBILITY PS4CPU : public Generic_ELF {
>
> +public:
>
> + PS4CPU(const Driver &D, const llvm::Triple &Triple,
>
> + const llvm::opt::ArgList &Args);
>
> +
>
> + bool IsMathErrnoDefault() const override { return false; } bool
>
> + IsObjCNonFragileABIDefault() const override { return true; } bool
>
> + HasNativeLLVMSupport() const override; bool isPICDefault() const
>
> + override;
>
> +
>
> + unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const
> override {
>
> + return 2; // SSPStrong
>
> + }
>
> +
>
> + SanitizerMask getSupportedSanitizers() const override;
>
> +
>
> +protected:
>
> + Tool *buildAssembler() const override;
>
> + Tool *buildLinker() const override;
>
> +};
>
> +
>
> } // end namespace toolchains
>
> } // end namespace driver
>
> } // end namespace clang
>
>
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>
> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Sep 24 17:06:52 2015
>
> @@ -3102,15 +3102,23 @@ ParsePICArgs(const ToolChain &ToolChain,
>
> O.matches(options::OPT_fPIE) || O.matches(options::OPT_fPIC);
>
> } else {
>
> PIE = PIC = false;
>
> + if (Triple.isPS4CPU()) {
>
> + Arg *ModelArg = Args.getLastArg(options::OPT_mcmodel_EQ);
>
> + StringRef Model = ModelArg ? ModelArg->getValue() : "";
>
> + if (Model != "kernel") {
>
> + PIC = true;
>
> + ToolChain.getDriver().Diag(diag::warn_drv_ps4_force_pic)
>
> + << LastPICArg->getSpelling();
>
> + }
>
> + }
>
> }
>
> }
>
> }
>
> - // Introduce a Darwin-specific hack. If the default is PIC, but the
>
> - // PIC level would've been set to level 1, force it back to level 2
>
> - // PIC instead. This matches the behavior of Darwin GCC (based on
>
> - // chandlerc's informal testing in 2012).
>
> - if (PIC && ToolChain.getTriple().isOSDarwin())
>
> + // Introduce a Darwin and PS4-specific hack. If the default is PIC,
>
> + but the // PIC level would've been set to level 1, force it back to
>
> + level 2 PIC // instead.
>
> + if (PIC && (ToolChain.getTriple().isOSDarwin() || Triple.isPS4CPU()))
>
> IsPICLevelTwo |= ToolChain.isPICDefault();
>
> // This kernel flags are a trump-card: they will disable PIC/PIE @@
> -3182,6 +3190,7 @@ void Clang::ConstructJob(Compilation &C,
>
> bool IsWindowsCygnus =
>
> getToolChain().getTriple().isWindowsCygwinEnvironment();
>
> bool IsWindowsMSVC =
> getToolChain().getTriple().isWindowsMSVCEnvironment();
>
> + bool IsPS4CPU = getToolChain().getTriple().isPS4CPU();
>
> // Check number of inputs for sanity. We need at least one input.
>
> assert(Inputs.size() >= 1 && "Must have at least one input."); @@
> -3823,8 +3832,10 @@ void Clang::ConstructJob(Compilation &C,
>
> // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
>
> Args.ClaimAllArgs(options::OPT_g_flags_Group);
>
> +
>
> + // PS4 defaults to no column info
>
> if (Args.hasFlag(options::OPT_gcolumn_info,
> options::OPT_gno_column_info,
>
> - /*Default*/ true))
>
> + /*Default=*/ !IsPS4CPU))
>
> CmdArgs.push_back("-dwarf-column-info");
>
> // FIXME: Move backend command line options to the module.
>
> @@ -3851,7 +3862,8 @@ void Clang::ConstructJob(Compilation &C,
>
> // -gdwarf-aranges turns on the emission of the aranges section in the
>
> // backend.
>
> - if (Args.hasArg(options::OPT_gdwarf_aranges)) {
>
> + // Always enabled on the PS4.
>
> + if (Args.hasArg(options::OPT_gdwarf_aranges) || IsPS4CPU) {
>
> CmdArgs.push_back("-backend-option");
>
> CmdArgs.push_back("-generate-arange-section");
>
> }
>
> @@ -9846,3 +9858,320 @@ void tools::Myriad::Linker::ConstructJob
>
> C.addCommand(llvm::make_unique<Command>(JA, *this,
> Args.MakeArgString(Exec),
>
> CmdArgs, Inputs)); }
>
> +
>
> +void PS4cpu::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
>
> + const InputInfo &Output,
>
> + const InputInfoList &Inputs,
>
> + const ArgList &Args,
>
> + const char *LinkingOutput) const {
>
> + claimNoWarnArgs(Args);
>
> + ArgStringList CmdArgs;
>
> +
>
> + Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
>
> + options::OPT_Xassembler);
>
> +
>
> + CmdArgs.push_back("-o");
>
> + CmdArgs.push_back(Output.getFilename());
>
> +
>
> + const char *Exec =
>
> + Args.MakeArgString(getToolChain().GetProgramPath("ps4-as"));
>
> + C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs,
>
> +Inputs)); }
>
> +
>
> +static void AddPS4ProfileRT(const ToolChain &TC, const ArgList &Args,
>
> + ArgStringList &CmdArgs) {
>
> + if (!(Args.hasFlag(options::OPT_fprofile_arcs,
> options::OPT_fno_profile_arcs,
>
> + false) ||
>
> + Args.hasArg(options::OPT_fprofile_generate) ||
>
> + Args.hasArg(options::OPT_fprofile_instr_generate) ||
>
> + Args.hasArg(options::OPT_fcreate_profile) ||
>
> + Args.hasArg(options::OPT_coverage)))
>
> + return;
>
> +
>
> + assert(TC.getTriple().isPS4CPU() &&
>
> + "Profiling libraries are only implemented for the PS4 CPU");
>
> + CmdArgs.push_back("-lclang_rt.profile-x86_64");
>
> +}
>
> +
>
> +static void AddPS4SanitizerArgs(const ToolChain &TC, ArgStringList
>
> +&CmdArgs) {
>
> + const SanitizerArgs &SanArgs = TC.getSanitizerArgs();
>
> + if (SanArgs.needsUbsanRt()) {
>
> + CmdArgs.push_back("-lSceDbgUBSanitizer_stub_weak");
>
> + }
>
> + if (SanArgs.needsAsanRt()) {
>
> + CmdArgs.push_back("-lSceDbgAddressSanitizer_stub_weak");
>
> + }
>
> +}
>
> +
>
> +static void ConstructPS4LinkJob(const Tool &T, Compilation &C,
>
> + const JobAction &JA, const InputInfo
> &Output,
>
> + const InputInfoList &Inputs,
>
> + const ArgList &Args,
>
> + const char *LinkingOutput) {
>
> + const toolchains::FreeBSD &ToolChain =
>
> + static_cast<const toolchains::FreeBSD &>(T.getToolChain());
>
> + const Driver &D = ToolChain.getDriver();
>
> + ArgStringList CmdArgs;
>
> +
>
> + // Silence warning for "clang -g foo.o -o foo"
>
> + Args.ClaimAllArgs(options::OPT_g_Group);
>
> + // and "clang -emit-llvm foo.o -o foo"
>
> + Args.ClaimAllArgs(options::OPT_emit_llvm);
>
> + // and for "clang -w foo.o -o foo". Other warning options are already
>
> + // handled somewhere else.
>
> + Args.ClaimAllArgs(options::OPT_w);
>
> +
>
> + if (!D.SysRoot.empty())
>
> + CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>
> +
>
> + if (Args.hasArg(options::OPT_pie))
>
> + CmdArgs.push_back("-pie");
>
> +
>
> + if (Args.hasArg(options::OPT_rdynamic))
>
> + CmdArgs.push_back("-export-dynamic");
>
> + if (Args.hasArg(options::OPT_shared))
>
> + CmdArgs.push_back("--oformat=so");
>
> +
>
> + if (Output.isFilename()) {
>
> + CmdArgs.push_back("-o");
>
> + CmdArgs.push_back(Output.getFilename());
>
> + } else {
>
> + assert(Output.isNothing() && "Invalid output."); }
>
> +
>
> + Args.AddAllArgs(CmdArgs, options::OPT_L); Args.AddAllArgs(CmdArgs,
>
> + options::OPT_T_Group); Args.AddAllArgs(CmdArgs, options::OPT_e);
>
> + Args.AddAllArgs(CmdArgs, options::OPT_s); Args.AddAllArgs(CmdArgs,
>
> + options::OPT_t); Args.AddAllArgs(CmdArgs, options::OPT_r);
>
> +
>
> + if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
>
> + CmdArgs.push_back("--no-demangle");
>
> +
>
> + AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
>
> +
>
> + if (Args.hasArg(options::OPT_pthread)) {
>
> + CmdArgs.push_back("-lpthread");
>
> + }
>
> +
>
> + AddPS4ProfileRT(ToolChain, Args, CmdArgs);
>
> + AddPS4SanitizerArgs(ToolChain, CmdArgs);
>
> +
>
> + const char *Exec =
>
> + Args.MakeArgString(ToolChain.GetProgramPath("ps4-ld"));
>
> +
>
> + C.addCommand(llvm::make_unique<Command>(JA, T, Exec, CmdArgs,
>
> +Inputs)); }
>
> +
>
> +static void ConstructGoldLinkJob(const Tool &T, Compilation &C,
>
> + const JobAction &JA, const InputInfo
> &Output,
>
> + const InputInfoList &Inputs,
>
> + const ArgList &Args,
>
> + const char *LinkingOutput) {
>
> + const toolchains::FreeBSD &ToolChain =
>
> + static_cast<const toolchains::FreeBSD &>(T.getToolChain());
>
> + const Driver &D = ToolChain.getDriver();
>
> + ArgStringList CmdArgs;
>
> +
>
> + // Silence warning for "clang -g foo.o -o foo"
>
> + Args.ClaimAllArgs(options::OPT_g_Group);
>
> + // and "clang -emit-llvm foo.o -o foo"
>
> + Args.ClaimAllArgs(options::OPT_emit_llvm);
>
> + // and for "clang -w foo.o -o foo". Other warning options are already
>
> + // handled somewhere else.
>
> + Args.ClaimAllArgs(options::OPT_w);
>
> +
>
> + if (!D.SysRoot.empty())
>
> + CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
>
> +
>
> + if (Args.hasArg(options::OPT_pie))
>
> + CmdArgs.push_back("-pie");
>
> +
>
> + if (Args.hasArg(options::OPT_static)) {
>
> + CmdArgs.push_back("-Bstatic");
>
> + } else {
>
> + if (Args.hasArg(options::OPT_rdynamic))
>
> + CmdArgs.push_back("-export-dynamic");
>
> + CmdArgs.push_back("--eh-frame-hdr");
>
> + if (Args.hasArg(options::OPT_shared)) {
>
> + CmdArgs.push_back("-Bshareable");
>
> + } else {
>
> + CmdArgs.push_back("-dynamic-linker");
>
> + CmdArgs.push_back("/libexec/ld-elf.so.1");
>
> + }
>
> + CmdArgs.push_back("--enable-new-dtags");
>
> + }
>
> +
>
> + if (Output.isFilename()) {
>
> + CmdArgs.push_back("-o");
>
> + CmdArgs.push_back(Output.getFilename());
>
> + } else {
>
> + assert(Output.isNothing() && "Invalid output."); }
>
> +
>
> + if (!Args.hasArg(options::OPT_nostdlib) &&
>
> + !Args.hasArg(options::OPT_nostartfiles)) {
>
> + const char *crt1 = NULL;
>
> + if (!Args.hasArg(options::OPT_shared)) {
>
> + if (Args.hasArg(options::OPT_pg))
>
> + crt1 = "gcrt1.o";
>
> + else if (Args.hasArg(options::OPT_pie))
>
> + crt1 = "Scrt1.o";
>
> + else
>
> + crt1 = "crt1.o";
>
> + }
>
> + if (crt1)
>
> +
>
> + CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1)));
>
> +
>
> +
>
> + CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")))
>
> + ;
>
> +
>
> + const char *crtbegin = NULL;
>
> + if (Args.hasArg(options::OPT_static))
>
> + crtbegin = "crtbeginT.o";
>
> + else if (Args.hasArg(options::OPT_shared) ||
> Args.hasArg(options::OPT_pie))
>
> + crtbegin = "crtbeginS.o";
>
> + else
>
> + crtbegin = "crtbegin.o";
>
> +
>
> +
>
> + CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)))
>
> + ;
>
> + }
>
> +
>
> + Args.AddAllArgs(CmdArgs, options::OPT_L);
>
> +
>
> + const ToolChain::path_list Paths = ToolChain.getFilePaths(); for
>
> + (ToolChain::path_list::const_iterator i = Paths.begin(), e = Paths.end();
>
> + i != e; ++i)
>
> + CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + *i));
>
> +
>
> + Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
>
> + Args.AddAllArgs(CmdArgs, options::OPT_e); Args.AddAllArgs(CmdArgs,
>
> + options::OPT_s); Args.AddAllArgs(CmdArgs, options::OPT_t);
>
> + Args.AddAllArgs(CmdArgs, options::OPT_r);
>
> +
>
> + if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
>
> + CmdArgs.push_back("--no-demangle");
>
> +
>
> + AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
>
> +
>
> + if (!Args.hasArg(options::OPT_nostdlib) &&
>
> + !Args.hasArg(options::OPT_nodefaultlibs)) {
>
> + // For PS4, we always want to pass libm, libstdc++ and libkernel
>
> + // libraries for both C and C++ compilations.
>
> + CmdArgs.push_back("-lkernel");
>
> + if (D.CCCIsCXX()) {
>
> + ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
>
> + if (Args.hasArg(options::OPT_pg))
>
> + CmdArgs.push_back("-lm_p");
>
> + else
>
> + CmdArgs.push_back("-lm");
>
> + }
>
> + // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding
>
> + // the default system libraries. Just mimic this for now.
>
> + if (Args.hasArg(options::OPT_pg))
>
> + CmdArgs.push_back("-lgcc_p");
>
> + else
>
> + CmdArgs.push_back("-lcompiler_rt");
>
> + if (Args.hasArg(options::OPT_static)) {
>
> + CmdArgs.push_back("-lstdc++");
>
> + } else if (Args.hasArg(options::OPT_pg)) {
>
> + CmdArgs.push_back("-lgcc_eh_p");
>
> + } else {
>
> + CmdArgs.push_back("--as-needed");
>
> + CmdArgs.push_back("-lstdc++");
>
> + CmdArgs.push_back("--no-as-needed");
>
> + }
>
> +
>
> + if (Args.hasArg(options::OPT_pthread)) {
>
> + if (Args.hasArg(options::OPT_pg))
>
> + CmdArgs.push_back("-lpthread_p");
>
> + else
>
> + CmdArgs.push_back("-lpthread");
>
> + }
>
> +
>
> + if (Args.hasArg(options::OPT_pg)) {
>
> + if (Args.hasArg(options::OPT_shared))
>
> + CmdArgs.push_back("-lc");
>
> + else {
>
> + if (Args.hasArg(options::OPT_static)) {
>
> + CmdArgs.push_back("--start-group");
>
> + CmdArgs.push_back("-lc_p");
>
> + CmdArgs.push_back("-lpthread_p");
>
> + CmdArgs.push_back("--end-group");
>
> + } else {
>
> + CmdArgs.push_back("-lc_p");
>
> + }
>
> + }
>
> + CmdArgs.push_back("-lgcc_p");
>
> + } else {
>
> + if (Args.hasArg(options::OPT_static)) {
>
> + CmdArgs.push_back("--start-group");
>
> + CmdArgs.push_back("-lc");
>
> + CmdArgs.push_back("-lpthread");
>
> + CmdArgs.push_back("--end-group");
>
> + } else {
>
> + CmdArgs.push_back("-lc");
>
> + }
>
> + CmdArgs.push_back("-lcompiler_rt");
>
> + }
>
> +
>
> + if (Args.hasArg(options::OPT_static)) {
>
> + CmdArgs.push_back("-lstdc++");
>
> + } else if (Args.hasArg(options::OPT_pg)) {
>
> + CmdArgs.push_back("-lgcc_eh_p");
>
> + } else {
>
> + CmdArgs.push_back("--as-needed");
>
> + CmdArgs.push_back("-lstdc++");
>
> + CmdArgs.push_back("--no-as-needed");
>
> + }
>
> + }
>
> +
>
> + if (!Args.hasArg(options::OPT_nostdlib) &&
>
> + !Args.hasArg(options::OPT_nostartfiles)) {
>
> + if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
>
> +
> CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtendS.o")));
>
> + else
>
> +
> CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
>
> +
>
> + CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")))
>
> + ;
>
> + }
>
> +
>
> + AddPS4ProfileRT(ToolChain, Args, CmdArgs);
>
> + AddPS4SanitizerArgs(ToolChain, CmdArgs);
>
> +
>
> + const char *Exec =
>
> +#ifdef LLVM_ON_WIN32
>
> + Args.MakeArgString(ToolChain.GetProgramPath("ps4-ld.gold.exe"));
>
> +#else
>
> + Args.MakeArgString(ToolChain.GetProgramPath("ps4-ld"));
>
> +#endif
>
> +
>
> + C.addCommand(llvm::make_unique<Command>(JA, T, Exec, CmdArgs,
>
> +Inputs)); }
>
> +
>
> +void PS4cpu::Link::ConstructJob(Compilation &C, const JobAction &JA,
>
> + const InputInfo &Output,
>
> + const InputInfoList &Inputs,
>
> + const ArgList &Args,
>
> + const char *LinkingOutput) const {
>
> + const toolchains::FreeBSD &ToolChain =
>
> + static_cast<const toolchains::FreeBSD &>(getToolChain());
>
> + const Driver &D = ToolChain.getDriver();
>
> + bool PS4Linker;
>
> + StringRef LinkerOptName;
>
> + if (const Arg *A = Args.getLastArg(options::OPT_fuse_ld_EQ)) {
>
> + LinkerOptName = A->getValue();
>
> + if (LinkerOptName != "ps4" && LinkerOptName != "gold")
>
> + D.Diag(diag::err_drv_unsupported_linker) << LinkerOptName;
>
> + }
>
> +
>
> + if (LinkerOptName == "gold")
>
> + PS4Linker = false;
>
> + else if (LinkerOptName == "ps4")
>
> + PS4Linker = true;
>
> + else
>
> + PS4Linker = !Args.hasArg(options::OPT_shared);
>
> +
>
> + if (PS4Linker)
>
> + ConstructPS4LinkJob(*this, C, JA, Output, Inputs, Args,
>
> +LinkingOutput);
>
> + else
>
> + ConstructGoldLinkJob(*this, C, JA, Output, Inputs, Args,
>
> +LinkingOutput); }
>
>
>
> Modified: cfe/trunk/lib/Driver/Tools.h
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/lib/Driver/Tools.h (original)
>
> +++ cfe/trunk/lib/Driver/Tools.h Thu Sep 24 17:06:52 2015
>
> @@ -827,6 +827,36 @@ public:
>
> };
>
> } // end namespace Myriad
>
> +namespace PS4cpu {
>
> +class LLVM_LIBRARY_VISIBILITY Assemble : public Tool {
>
> +public:
>
> + Assemble(const ToolChain &TC)
>
> + : Tool("PS4cpu::Assemble", "assembler", TC, RF_Full) {}
>
> +
>
> + virtual bool hasIntegratedCPP() const { return false; }
>
> +
>
> + virtual void ConstructJob(Compilation &C, const JobAction &JA,
>
> + const InputInfo &Output,
>
> + const InputInfoList &Inputs,
>
> + const llvm::opt::ArgList &TCArgs,
>
> + const char *LinkingOutput) const; };
>
> +
>
> +class LLVM_LIBRARY_VISIBILITY Link : public Tool {
>
> +public:
>
> + Link(const ToolChain &TC) : Tool("PS4cpu::Link", "linker", TC,
>
> +RF_Full) {}
>
> +
>
> + virtual bool hasIntegratedCPP() const { return false; } virtual bool
>
> + isLinkJob() const { return true; }
>
> +
>
> + virtual void ConstructJob(Compilation &C, const JobAction &JA,
>
> + const InputInfo &Output,
>
> + const InputInfoList &Inputs,
>
> + const llvm::opt::ArgList &TCArgs,
>
> + const char *LinkingOutput) const; }; } //
>
> +end namespace PS4cpu
>
> +
>
> } // end namespace tools
>
> } // end namespace driver
>
> } // end namespace clang
>
>
>
> Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
>
> +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Thu Sep 24 17:06:52 2015
>
> @@ -215,6 +215,7 @@ void InitHeaderSearch::AddDefaultCInclud
>
> case llvm::Triple::OpenBSD:
>
> case llvm::Triple::Bitrig:
>
> case llvm::Triple::NaCl:
>
> + case llvm::Triple::PS4:
>
> break;
>
> case llvm::Triple::Win32:
>
> if (triple.getEnvironment() != llvm::Triple::Cygnus) @@ -320,6
> +321,28 @@ void InitHeaderSearch::AddDefaultCInclud
>
> case llvm::Triple::RTEMS:
>
> case llvm::Triple::NaCl:
>
> break;
>
> + case llvm::Triple::PS4: {
>
> + // <isysroot> gets prepended later in AddPath().
>
> + std::string BaseSDKPath = "";
>
> + if (!HasSysroot) {
>
> + const char *envValue = getenv("SCE_PS4_SDK_DIR");
>
> + if (envValue)
>
> + BaseSDKPath = envValue;
>
> + else {
>
> + // HSOpts.ResourceDir variable contains the location of Clang's
>
> + // resource files.
>
> + // Assuming that Clang is configured for PS4 without
>
> + // --with-clang-resource-dir option, the location of Clang's
> resource
>
> + // files is <SDK_DIR>/host_tools/lib/clang
>
> + SmallString<128> P = StringRef(HSOpts.ResourceDir);
>
> + llvm::sys::path::append(P, "../../..");
>
> + BaseSDKPath = P.str();
>
> + }
>
> + }
>
> + AddPath(BaseSDKPath + "/target/include", System, false);
>
> + if (triple.isPS4CPU())
>
> + AddPath(BaseSDKPath + "/target/include_common", System, false);
>
> + }
>
> default:
>
> AddPath("/usr/include", ExternCSystem, false);
>
> break;
>
>
>
> Added: cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/include/.keep
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/include/.keep?rev=248546&view=auto
>
>
> ==============================================================================
>
> (empty)
>
>
>
> Added:
> cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/include_common/.keep
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/include_common/.keep?rev=248546&view=auto
>
>
> ==============================================================================
>
> --- cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/include_common/.keep
> (added)
>
> +++ cfe/trunk/test/Driver/Inputs/scei-ps4_tree/target/include_common/.ke
>
> +++ ep Thu Sep 24 17:06:52 2015
>
> @@ -0,0 +1 @@
>
> +
>
>
>
> Modified: cfe/trunk/test/Driver/debug-options.c
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/test/Driver/debug-options.c (original)
>
> +++ cfe/trunk/test/Driver/debug-options.c Thu Sep 24 17:06:52 2015
>
> @@ -27,6 +27,17 @@
>
> // RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin 2>&1 \
>
> // RUN: | FileCheck -check-prefix=G_DARWIN %s
>
> +// On the PS4, -g defaults to -gno-column-info, and we always generate
>
> +the // arange section.
>
> +// RUN: %clang -### -c %s -target x86_64-scei-ps4 2>&1 \
>
> +// RUN: | FileCheck -check-prefix=G_PS4 %s
>
> +// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
>
> +// RUN: | FileCheck -check-prefix=G_PS4 %s
>
> +// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
>
> +// RUN: | FileCheck -check-prefix=NOCI %s
>
> +// RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \
>
> +// RUN: | FileCheck -check-prefix=CI %s
>
> +
>
> // RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G_D2
> %s // // RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO
> %s @@ -86,6 +97,9 @@ // G_DARWIN: "-cc1"
>
> // G_DARWIN: "-gdwarf-2"
>
> //
>
> +// G_PS4: "-cc1"
>
> +// G_PS4: "-generate-arange-section"
>
> +//
>
> // G_D2: "-cc1"
>
> // G_D2: "-gdwarf-2"
>
> //
>
>
>
> Added: cfe/trunk/test/Driver/ps4-header-search.c
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ps4-header-search.c?rev=248546&view=auto
>
>
> ==============================================================================
>
> --- cfe/trunk/test/Driver/ps4-header-search.c (added)
>
> +++ cfe/trunk/test/Driver/ps4-header-search.c Thu Sep 24 17:06:52 2015
>
> @@ -0,0 +1,10 @@
>
> +// REQUIRES: x86-registered-target
>
> +
>
> +// RUN: env SCE_PS4_SDK_DIR=%S/Inputs/scei-ps4_tree %clang -target
>
> +x86_64-scei-ps4 -E -v %s 2>&1 | FileCheck %s --check-prefix=ENVPS4 //
>
> +ENVPS4: Inputs/scei-ps4_tree/target/include{{$}}
>
> +// ENVPS4: Inputs/scei-ps4_tree/target/include_common{{$}}
>
> +
>
> +// RUN: %clang -isysroot %S/Inputs/scei-ps4_tree -target
>
> +x86_64-scei-ps4 -E -v %s 2>&1 | FileCheck %s --check-prefix=SYSROOTPS4 //
> SYSROOTPS4: "{{[^"]*}}clang{{[^"]*}}"
>
> +// SYSROOTPS4: Inputs/scei-ps4_tree/target/include{{$}}
>
> +// SYSROOTPS4: Inputs/scei-ps4_tree/target/include_common{{$}}
>
>
>
> Added: cfe/trunk/test/Driver/ps4-linker-non-win.c
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ps4-linker-non-win.c?rev=248546&view=auto
>
>
> ==============================================================================
>
> --- cfe/trunk/test/Driver/ps4-linker-non-win.c (added)
>
> +++ cfe/trunk/test/Driver/ps4-linker-non-win.c Thu Sep 24 17:06:52 2015
>
> @@ -0,0 +1,18 @@
>
> +// UNSUPPORTED: system-windows
>
> +// REQUIRES: x86-registered-target
>
> +
>
> +// RUN: touch %T/ps4-ld
>
> +
>
> +// RUN: env "PATH=%T" %clang -### -target x86_64-scei-ps4 %s
> -linker=gold 2>&1 \
>
> +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
>
> +// RUN: env "PATH=%T" %clang -### -target x86_64-scei-ps4 %s -shared
> 2>&1 \
>
> +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
>
> +
>
> +// RUN: env "PATH=%T" %clang -### -target x86_64-scei-ps4 %s 2>&1 \
>
> +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
>
> +// RUN: env "PATH=%T" %clang -### -target x86_64-scei-ps4 %s -linker=ps4
> 2>&1 \
>
> +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
>
> +// RUN: env "PATH=%T" %clang -### -target x86_64-scei-ps4 %s -shared \
>
> +// RUN: -linker=ps4 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER
> %s
>
> +
>
> +// CHECK-PS4-LINKER: ps4-ld
>
>
>
> Added: cfe/trunk/test/Driver/ps4-linker-win.c
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ps4-linker-win.c?rev=248546&view=auto
>
>
> ==============================================================================
>
> --- cfe/trunk/test/Driver/ps4-linker-win.c (added)
>
> +++ cfe/trunk/test/Driver/ps4-linker-win.c Thu Sep 24 17:06:52 2015
>
> @@ -0,0 +1,26 @@
>
> +// The full path to the gold linker was not found on Windows because
>
> +the // driver fails to add an .exe extension to the name.
>
> +// We check that gold linker's full name (with an extension) is
>
> +specified // on the command line if -linker=gold, or -shared with no
>
> +-linker option // are passed. Otherwise, we check that the PS4's
>
> +linker's full name is // specified.
>
> +
>
> +// REQUIRES: system-windows, x86-registered-target
>
> +
>
> +// RUN: touch %T/ps4-ld.exe
>
> +// RUN: touch %T/ps4-ld.gold.exe
>
> +
>
> +// RUN: env "PATH=%T" %clang -target x86_64-scei-ps4 %s -linker=gold
> -### 2>&1 \
>
> +// RUN: | FileCheck --check-prefix=CHECK-PS4-GOLD %s
>
> +// RUN: env "PATH=%T" %clang -target x86_64-scei-ps4 %s -shared -###
> 2>&1 \
>
> +// RUN: | FileCheck --check-prefix=CHECK-PS4-GOLD %s
>
> +
>
> +// RUN: env "PATH=%T" %clang -target x86_64-scei-ps4 %s -### 2>&1 \
>
> +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
>
> +// RUN: env "PATH=%T" %clang -target x86_64-scei-ps4 %s -linker=ps4 -###
> 2>&1 \
>
> +// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
>
> +// RUN: env "PATH=%T" %clang -target x86_64-scei-ps4 %s -shared \
>
> +// RUN: -linker=ps4 -### 2>&1 | FileCheck
> --check-prefix=CHECK-PS4-LINKER %s
>
> +
>
> +// CHECK-PS4-GOLD: ps4-ld.gold.exe
>
> +// CHECK-PS4-LINKER: ps4-ld.exe
>
>
>
> Added: cfe/trunk/test/Driver/ps4-pic.c
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ps4-pic.c?rev=248546&view=auto
>
>
> ==============================================================================
>
> --- cfe/trunk/test/Driver/ps4-pic.c (added)
>
> +++ cfe/trunk/test/Driver/ps4-pic.c Thu Sep 24 17:06:52 2015
>
> @@ -0,0 +1,106 @@
>
> +// REQUIRES: x86-registered-target
>
> +
>
> +// Test the driver's control over the PIC behavior for PS4 compiler.
>
> +// These consist of tests of the relocation model flags and the // pic
>
> +level flags passed to CC1.
>
> +//
>
> +// CHECK-NO-PIC: "-mrelocation-model" "static"
>
> +// CHECK-NO-PIC-NOT: "-pic-level"
>
> +// CHECK-NO-PIC-NOT: "-pie-level"
>
> +//
>
> +// CHECK-DYNAMIC-NO-PIC2: unsupported option '-mdynamic-no-pic'
>
> +// CHECK-DYNAMIC-NO-PIC2: "-mrelocation-model" "dynamic-no-pic"
>
> +//
>
> +// CHECK-PIC2: "-mrelocation-model" "pic"
>
> +// CHECK-PIC2: "-pic-level" "2"
>
> +//
>
> +// CHECK-PIE2: "-mrelocation-model" "pic"
>
> +// CHECK-PIE2: "-pie-level" "2"
>
> +//
>
> +// CHECK-NOPIC-IGNORED: using '-fPIC'
>
> +// CHECK-NOPIC-IGNORED: "-mrelocation-model" "pic"
>
> +// CHECK-NOPIC-IGNORED: "-pic-level" "2"
>
> +//
>
> +// CHECK-DIAG-PIC: option '-fno-PIC' was ignored by the PS4 toolchain,
> using '-fPIC'
>
> +// CHECK-DIAG-PIE: option '-fno-PIE' was ignored by the PS4 toolchain,
> using '-fPIC'
>
> +// CHECK-DIAG-pic: option '-fno-pic' was ignored by the PS4 toolchain,
> using '-fPIC'
>
> +// CHECK-DIAG-pie: option '-fno-pie' was ignored by the PS4 toolchain,
> using '-fPIC'
>
> +//
>
> +// CHECK-STATIC-ERR: unsupported option '-static' for target 'PS4'
>
> +
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIE -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-pic -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -fno-PIC -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-PIC -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -fno-pic -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fno-pie -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIE -fno-PIE -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fno-PIE -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIE -fno-pie -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fno-pic -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fno-pie -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fPIC -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fPIC -fpic -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpic -fPIE -fpie -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fpie -fPIC -fPIE -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-PIE2
>
> +//
>
> +// Defaults change for PS4.
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pic -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIC -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NOPIC-IGNORED
>
> +//
>
> +// Disregard any of the PIC-specific flags if we have a trump-card flag.
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -mkernel -fPIC -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -mdynamic-no-pic -fPIC -###
> 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-DYNAMIC-NO-PIC2
>
> +//
>
> +// -static not supported at all.
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -static -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-STATIC-ERR
>
> +//
>
> +// -fno-PIC etc. is obeyed if -mcmodel=kernel is also present.
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIC
> -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-PIE
> -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-pic
> -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -mcmodel=kernel -fno-pie
> -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC
>
> +//
>
> +// Verify that we reflect the option the user specified, when we ignore
> it.
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIC -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-DIAG-PIC
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-PIE -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-DIAG-PIE
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pic -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-DIAG-pic
>
> +// RUN: %clang -c %s -target x86_64-scei-ps4 -fno-pie -### 2>&1 \
>
> +// RUN: | FileCheck %s --check-prefix=CHECK-DIAG-pie
>
>
>
> Added: cfe/trunk/test/Driver/ps4-sdk-root.c
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ps4-sdk-root.c?rev=248546&view=auto
>
>
> ==============================================================================
>
> --- cfe/trunk/test/Driver/ps4-sdk-root.c (added)
>
> +++ cfe/trunk/test/Driver/ps4-sdk-root.c Thu Sep 24 17:06:52 2015
>
> @@ -0,0 +1,48 @@
>
> +// REQUIRES: x86-registered-target
>
> +
>
> +// Check that ps4-clang doesn't report a warning message when locating
>
> +// system header files (either by looking at the value of
>
> +SCE_PS4_SDK_DIR // or relative to the location of the compiler driver),
>
> +if "-nostdinc", // "--sysroot" or "-isysroot" option is specified on the
> command line.
>
> +// Otherwise, check that ps4-clang reports a warning.
>
> +
>
> +// Check that clang doesn't report a warning message when locating //
>
> +system libraries (either by looking at the value of SCE_PS4_SDK_DIR //
>
> +or relative to the location of the compiler driver), if "-c", "-S",
>
> +"-E", // "--sysroot", "-nostdlib" or "-nodefaultlibs" option is
>
> +specified on // the command line.
>
> +// Otherwise, check that ps4-clang reports a warning.
>
> +
>
> +// setting up SCE_PS4_SDK_DIR to existing location, which is not a PS4
> SDK.
>
> +// RUN: env SCE_PS4_SDK_DIR=.. %clang -### -target x86_64-scei-ps4 %s
>
> +2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS
>
> +-check-prefix=WARN-SYS-LIBS -check-prefix=NO-WARN %s
>
> +
>
> +// RUN: env SCE_PS4_SDK_DIR=.. %clang -### -c -target x86_64-scei-ps4
>
> +%s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS
>
> +-check-prefix=NO-WARN %s // RUN: env SCE_PS4_SDK_DIR=.. %clang -### -S
>
> +-target x86_64-scei-ps4 %s 2>&1 | FileCheck
>
> +-check-prefix=WARN-SYS-HEADERS -check-prefix=NO-WARN %s // RUN: env
>
> +SCE_PS4_SDK_DIR=.. %clang -### -E -target x86_64-scei-ps4 %s 2>&1 |
>
> +FileCheck -check-prefix=WARN-SYS-HEADERS -check-prefix=NO-WARN %s //
>
> +RUN: env SCE_PS4_SDK_DIR=.. %clang -### -emit-ast -target
>
> +x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS
>
> +-check-prefix=NO-WARN %s // RUN: env SCE_PS4_SDK_DIR=.. %clang -###
>
> +-isysroot foo -target x86_64-scei-ps4 %s 2>&1 | FileCheck
>
> +-check-prefix=WARN-ISYSROOT -check-prefix=WARN-SYS-LIBS
>
> +-check-prefix=NO-WARN %s
>
> +
>
> +// RUN: env SCE_PS4_SDK_DIR=.. %clang -### -c -nostdinc -target
>
> +x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s // RUN:
>
> +env SCE_PS4_SDK_DIR=.. %clang -### -S -nostdinc -target x86_64-scei-ps4
>
> +%s 2>&1 | FileCheck -check-prefix=NO-WARN %s // RUN: env
>
> +SCE_PS4_SDK_DIR=.. %clang -### -E -nostdinc -target x86_64-scei-ps4 %s
>
> +2>&1 | FileCheck -check-prefix=NO-WARN %s // RUN: env
>
> +SCE_PS4_SDK_DIR=.. %clang -### -emit-ast -nostdinc -target
>
> +x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s
>
> +
>
> +// RUN: env SCE_PS4_SDK_DIR=.. %clang -### -c --sysroot=foo/ -target
>
> +x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s // RUN:
>
> +env SCE_PS4_SDK_DIR=.. %clang -### -S --sysroot=foo/ -target
>
> +x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s // RUN:
>
> +env SCE_PS4_SDK_DIR=.. %clang -### -E --sysroot=foo/ -target
>
> +x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s // RUN:
>
> +env SCE_PS4_SDK_DIR=.. %clang -### -emit-ast --sysroot=foo/ -target
>
> +x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=NO-WARN %s
>
> +
>
> +// RUN: env SCE_PS4_SDK_DIR=.. %clang -### -c -isysroot foo -target
>
> +x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-ISYSROOT
>
> +-check-prefix=NO-WARN %s // RUN: env SCE_PS4_SDK_DIR=.. %clang -### -S
>
> +-isysroot foo -target x86_64-scei-ps4 %s 2>&1 | FileCheck
>
> +-check-prefix=WARN-ISYSROOT -check-prefix=NO-WARN %s // RUN: env
>
> +SCE_PS4_SDK_DIR=.. %clang -### -E -isysroot foo -target x86_64-scei-ps4
>
> +%s 2>&1 | FileCheck -check-prefix=WARN-ISYSROOT -check-prefix=NO-WARN
>
> +%s // RUN: env SCE_PS4_SDK_DIR=.. %clang -### -emit-ast -isysroot foo
>
> +-target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-ISYSROOT
>
> +-check-prefix=NO-WARN %s // RUN: env SCE_PS4_SDK_DIR=.. %clang -###
>
> +--sysroot=foo/ -isysroot foo -target x86_64-scei-ps4 %s 2>&1 |
>
> +FileCheck -check-prefix=WARN-ISYSROOT -check-prefix=NO-WARN %s
>
> +
>
> +// RUN: env SCE_PS4_SDK_DIR=.. %clang -### -nostdlib -target
>
> +x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=WARN-SYS-HEADERS
>
> +-check-prefix=NO-WARN %s // RUN: env SCE_PS4_SDK_DIR=.. %clang -###
>
> +-nodefaultlibs -target x86_64-scei-ps4 %s 2>&1 | FileCheck
>
> +-check-prefix=WARN-SYS-HEADERS -check-prefix=NO-WARN %s
>
> +
>
> +// NO-WARN-NOT: {{warning:|error:}}
>
> +// WARN-SYS-HEADERS: warning: unable to find PS4 system headers
>
> +directory // WARN-ISYSROOT: warning: no such sysroot directory: 'foo'
>
> +// WARN-SYS-LIBS: warning: unable to find PS4 system libraries
>
> +directory // NO-WARN-NOT: {{warning:|error:}}
>
>
>
> Modified: cfe/trunk/test/Driver/rtti-options.cpp
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/rtti-options.cpp?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/test/Driver/rtti-options.cpp (original)
>
> +++ cfe/trunk/test/Driver/rtti-options.cpp Thu Sep 24 17:06:52 2015
>
> @@ -34,7 +34,8 @@
>
> // RUN: %clang -x c++ -### -c -target x86_64-unknown-unknown -fexceptions
> %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
>
> // -frtti + exceptions
>
> -// RUN: %clang -### -c -target x86_64-scei-ps4 -fcxx-exceptions -frtti %s
> 2>&1 | FileCheck -check-prefix=CHECK-OK %s
>
> +// ps4 needs -nostdinc due to having warnings if the SDK is not
>
> +installed // RUN: %clang -### -c -nostdinc -target x86_64-scei-ps4
>
> +-fcxx-exceptions -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
>
> // RUN: %clang -### -c -target x86_64-unknown-unknown -fcxx-exceptions
> -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
>
> // -f{no-,}rtti/default
>
>
>
> Modified: cfe/trunk/test/Driver/stack-protector.c
>
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/stack-protector.c?rev=248546&r1=248545&r2=248546&view=diff
>
>
> ==============================================================================
>
> --- cfe/trunk/test/Driver/stack-protector.c (original)
>
> +++ cfe/trunk/test/Driver/stack-protector.c Thu Sep 24 17:06:52 2015
>
> @@ -23,3 +23,12 @@
>
> // RUN: %clang -fstack-protector-all -### %s 2>&1 | FileCheck %s
> -check-prefix=SSP-ALL // SSP-ALL: "-stack-protector" "3"
>
> // SSP-ALL-NOT: "-stack-protector-buffer-size"
>
> +
>
> +// RUN: %clang -target x86_64-scei-ps4 -### %s 2>&1 | FileCheck %s
>
> +-check-prefix=SSP-PS4 // RUN: %clang -target x86_64-scei-ps4
>
> +-fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4 //
> SSP-PS4: "-stack-protector" "2"
>
> +// SSP-PS4-NOT: "-stack-protector-buffer-size"
>
> +
>
> +// RUN: %clang -target x86_64-scei-ps4 -fstack-protector --param
>
> +ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4-BUF
> // SSP-PS4-BUF: "-stack-protector" "2"
>
> +// SSP-PS4-BUF: "-stack-protector-buffer-size" "16"
>
>
>
>
>
> _______________________________________________
>
> cfe-commits mailing list
>
> cfe-commits at lists.llvm.org
>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150925/6e78e92e/attachment-0001.html>
More information about the cfe-commits
mailing list