diff options
Diffstat (limited to 'lib/Driver/Tools.cpp')
| -rw-r--r-- | lib/Driver/Tools.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index af70017edb056..31d4360184508 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -3258,7 +3258,7 @@ static bool shouldUseFramePointerForTarget(const ArgList &Args, break; } - if (Triple.isOSLinux()) { + if (Triple.isOSLinux() || Triple.getOS() == llvm::Triple::CloudABI) { switch (Triple.getArch()) { // Don't use a frame pointer on linux if optimizing for certain targets. case llvm::Triple::mips64: @@ -4568,8 +4568,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_gdwarf_4, options::OPT_gdwarf_5)) DwarfVersion = DwarfVersionNum(A->getSpelling()); - // Forward -gcodeview. - // 'EmitCodeView might have been set by CL-compatibility argument parsing. + // Forward -gcodeview. EmitCodeView might have been set by CL-compatibility + // argument parsing. if (Args.hasArg(options::OPT_gcodeview) || EmitCodeView) { // DwarfVersion remains at 0 if no explicit choice was made. CmdArgs.push_back("-gcodeview"); @@ -5020,9 +5020,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_show_template_tree); Args.AddLastArg(CmdArgs, options::OPT_fno_elide_type); - // Forward flags for OpenMP + // Forward flags for OpenMP. We don't do this if the current action is an + // device offloading action. + // + // TODO: Allow OpenMP offload actions when they become available. if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ, - options::OPT_fno_openmp, false)) { + options::OPT_fno_openmp, false) && + JA.isDeviceOffloading(Action::OFK_None)) { switch (getOpenMPRuntime(getToolChain(), Args)) { case OMPRT_OMP: case OMPRT_IOMP5: @@ -6354,9 +6358,10 @@ void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType, CmdArgs.push_back(Args.MakeArgString(Twine(LangOptions::SSPStrong))); } - // Emit CodeView if -Z7 or -Zd are present. + // Emit CodeView if -Z7, -Zd, or -gline-tables-only are present. if (Arg *DebugInfoArg = - Args.getLastArg(options::OPT__SLASH_Z7, options::OPT__SLASH_Zd)) { + Args.getLastArg(options::OPT__SLASH_Z7, options::OPT__SLASH_Zd, + options::OPT_gline_tables_only)) { *EmitCodeView = true; if (DebugInfoArg->getOption().matches(options::OPT__SLASH_Z7)) *DebugInfoKind = codegenoptions::LimitedDebugInfo; @@ -7453,11 +7458,13 @@ void cloudabi::Linker::ConstructJob(Compilation &C, const JobAction &JA, // CloudABI only supports static linkage. CmdArgs.push_back("-Bstatic"); - - // CloudABI uses Position Independent Executables exclusively. - CmdArgs.push_back("-pie"); CmdArgs.push_back("--no-dynamic-linker"); - CmdArgs.push_back("-zrelro"); + + // Provide PIE linker flags in case PIE is default for the architecture. + if (ToolChain.isPIEDefault()) { + CmdArgs.push_back("-pie"); + CmdArgs.push_back("-zrelro"); + } CmdArgs.push_back("--eh-frame-hdr"); CmdArgs.push_back("--gc-sections"); |
