Lines Matching +full:diag +full:- +full:version
1 //===--- WebAssembly.cpp - WebAssembly ToolChain Implementation -*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 #include "clang/Basic/Version.h"
34 return (TargetTriple.getArchName() + "-" + in getMultiarchTriple()
41 StringRef UseLinker = A->getValue(); in getLinkerPath()
47 // Interpret 'lld' as explicitly requesting `wasm-ld`, so look for that in getLinkerPath()
48 // linker. Note that for `wasm32-wasip2` this overrides the default linker in getLinkerPath()
49 // of `wasm-component-ld`. in getLinkerPath()
51 return ToolChain.GetProgramPath("wasm-ld"); in getLinkerPath()
56 ToolChain.getDriver().Diag(diag::err_drv_invalid_linker_name) in getLinkerPath()
57 << A->getAsString(Args); in getLinkerPath()
74 CmdArgs.push_back("-m"); in ConstructJob()
81 CmdArgs.push_back("--strip-all"); in ConstructJob()
83 // On `wasip2` the default linker is `wasm-component-ld` which wraps the in ConstructJob()
84 // execution of `wasm-ld`. Find `wasm-ld` and pass it as an argument of where in ConstructJob()
88 "wasm-component-ld")) { in ConstructJob()
89 CmdArgs.push_back("--wasm-ld-path"); in ConstructJob()
90 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetProgramPath("wasm-ld"))); in ConstructJob()
101 // When -shared is specified, use the reactor exec model unless in ConstructJob()
107 StringRef CM = A->getValue(); in ConstructJob()
113 ToolChain.getDriver().Diag(diag::err_drv_invalid_argument_to_option) in ConstructJob()
114 << CM << A->getOption().getName(); in ConstructJob()
119 // If crt1-command.o exists, it supports new-style commands, so use it. in ConstructJob()
122 // support for new-style command, it can make crt1.o the same as in ConstructJob()
123 // crt1-command.o. And once LLVM no longer needs to support WASI libc in ConstructJob()
124 // versions before that, it can switch to using crt1-command.o. in ConstructJob()
126 if (ToolChain.GetFilePath("crt1-command.o") != "crt1-command.o") in ConstructJob()
127 Crt1 = "crt1-command.o"; in ConstructJob()
129 Crt1 = "crt1-reactor.o"; in ConstructJob()
136 CmdArgs.push_back(Args.MakeArgString("--entry")); in ConstructJob()
141 CmdArgs.push_back(Args.MakeArgString("-shared")); in ConstructJob()
150 CmdArgs.push_back("-lpthread"); in ConstructJob()
151 CmdArgs.push_back("--shared-memory"); in ConstructJob()
154 CmdArgs.push_back("-lc"); in ConstructJob()
158 CmdArgs.push_back("-o"); in ConstructJob()
162 // When optimizing, if wasm-opt is available, run it. in ConstructJob()
165 WasmOptPath = ToolChain.GetProgramPath("wasm-opt"); in ConstructJob()
166 if (WasmOptPath == "wasm-opt") { in ConstructJob()
172 CmdArgs.push_back("--keep-section=target_features"); in ConstructJob()
182 if (A->getOption().matches(options::OPT_O4) || in ConstructJob()
183 A->getOption().matches(options::OPT_Ofast)) in ConstructJob()
185 else if (A->getOption().matches(options::OPT_O0)) in ConstructJob()
187 else if (A->getOption().matches(options::OPT_O)) in ConstructJob()
188 OOpt = A->getValue(); in ConstructJob()
194 OptArgs.push_back(Args.MakeArgString(llvm::Twine("-O") + OOpt)); in ConstructJob()
195 OptArgs.push_back("-o"); in ConstructJob()
209 // The version allows the path to be keyed to the specific version of in AppendLTOLibDir()
211 return Dir + "/llvm-lto/" LLVM_VERSION_STRING; in AppendLTOLibDir()
233 // For LTO, enable use of lto-enabled sysroot libraries too, if available. in WebAssembly()
245 return "wasm-component-ld"; in getDefaultLinker()
246 return "wasm-ld"; in getDefaultLinker()
275 CC1Args.push_back("-fno-use-init-array"); in addClangTargetOptions()
277 // '-pthread' implies atomics, bulk-memory, mutable-globals, and sign-ext in addClangTargetOptions()
282 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
283 << "-pthread" in addClangTargetOptions()
284 << "-mno-atomics"; in addClangTargetOptions()
287 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
288 << "-pthread" in addClangTargetOptions()
289 << "-mno-bulk-memory"; in addClangTargetOptions()
292 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
293 << "-pthread" in addClangTargetOptions()
294 << "-mno-mutable-globals"; in addClangTargetOptions()
297 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
298 << "-pthread" in addClangTargetOptions()
299 << "-mno-sign-ext"; in addClangTargetOptions()
300 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
302 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
303 CC1Args.push_back("+bulk-memory"); in addClangTargetOptions()
304 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
305 CC1Args.push_back("+mutable-globals"); in addClangTargetOptions()
306 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
307 CC1Args.push_back("+sign-ext"); in addClangTargetOptions()
312 // -fPIC implies +mutable-globals because the PIC ABI used by the linker in addClangTargetOptions()
322 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
323 << "-fPIC" in addClangTargetOptions()
324 << "-mno-mutable-globals"; in addClangTargetOptions()
326 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
327 CC1Args.push_back("+mutable-globals"); in addClangTargetOptions()
332 // '-fwasm-exceptions' is not compatible with '-mno-exception-handling' in addClangTargetOptions()
335 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
336 << "-fwasm-exceptions" in addClangTargetOptions()
337 << "-mno-exception-handling"; in addClangTargetOptions()
338 // '-fwasm-exceptions' is not compatible with in addClangTargetOptions()
339 // '-mllvm -enable-emscripten-cxx-exceptions' in addClangTargetOptions()
341 if (StringRef(A->getValue(0)) == "-enable-emscripten-cxx-exceptions") in addClangTargetOptions()
342 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
343 << "-fwasm-exceptions" in addClangTargetOptions()
344 << "-mllvm -enable-emscripten-cxx-exceptions"; in addClangTargetOptions()
346 // '-fwasm-exceptions' implies exception-handling feature in addClangTargetOptions()
347 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
348 CC1Args.push_back("+exception-handling"); in addClangTargetOptions()
349 // Backend needs -wasm-enable-eh to enable Wasm EH in addClangTargetOptions()
350 CC1Args.push_back("-mllvm"); in addClangTargetOptions()
351 CC1Args.push_back("-wasm-enable-eh"); in addClangTargetOptions()
354 // reference-types. in addClangTargetOptions()
357 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
358 << "-fwasm-exceptions" << "-mno-multivalue"; in addClangTargetOptions()
362 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
363 << "-fwasm-exceptions" << "-mno-reference-types"; in addClangTargetOptions()
365 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
367 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
368 CC1Args.push_back("+reference-types"); in addClangTargetOptions()
372 StringRef Opt = A->getValue(0); in addClangTargetOptions()
373 if (Opt.starts_with("-emscripten-cxx-exceptions-allowed")) { in addClangTargetOptions()
374 // '-mllvm -emscripten-cxx-exceptions-allowed' should be used with in addClangTargetOptions()
375 // '-mllvm -enable-emscripten-cxx-exceptions' in addClangTargetOptions()
378 if (StringRef(A->getValue(0)) == "-enable-emscripten-cxx-exceptions") { in addClangTargetOptions()
384 getDriver().Diag(diag::err_drv_argument_only_allowed_with) in addClangTargetOptions()
385 << "-mllvm -emscripten-cxx-exceptions-allowed" in addClangTargetOptions()
386 << "-mllvm -enable-emscripten-cxx-exceptions"; in addClangTargetOptions()
388 // Prevent functions specified in -emscripten-cxx-exceptions-allowed list in addClangTargetOptions()
394 CC1Args.push_back("-mllvm"); in addClangTargetOptions()
395 CC1Args.push_back(DriverArgs.MakeArgString("--force-attribute=" + Name + in addClangTargetOptions()
400 if (Opt.starts_with("-wasm-enable-sjlj")) { in addClangTargetOptions()
401 // '-mllvm -wasm-enable-sjlj' is not compatible with in addClangTargetOptions()
402 // '-mno-exception-handling' in addClangTargetOptions()
405 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
406 << "-mllvm -wasm-enable-sjlj" in addClangTargetOptions()
407 << "-mno-exception-handling"; in addClangTargetOptions()
408 // '-mllvm -wasm-enable-sjlj' is not compatible with in addClangTargetOptions()
409 // '-mllvm -enable-emscripten-cxx-exceptions' in addClangTargetOptions()
412 if (StringRef(A->getValue(0)) == "-enable-emscripten-cxx-exceptions") in addClangTargetOptions()
413 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
414 << "-mllvm -wasm-enable-sjlj" in addClangTargetOptions()
415 << "-mllvm -enable-emscripten-cxx-exceptions"; in addClangTargetOptions()
417 // '-mllvm -wasm-enable-sjlj' is not compatible with in addClangTargetOptions()
418 // '-mllvm -enable-emscripten-sjlj' in addClangTargetOptions()
420 if (StringRef(A->getValue(0)) == "-enable-emscripten-sjlj") in addClangTargetOptions()
421 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
422 << "-mllvm -wasm-enable-sjlj" in addClangTargetOptions()
423 << "-mllvm -enable-emscripten-sjlj"; in addClangTargetOptions()
425 // '-mllvm -wasm-enable-sjlj' implies exception-handling feature in addClangTargetOptions()
426 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
427 CC1Args.push_back("+exception-handling"); in addClangTargetOptions()
428 // Backend needs '-exception-model=wasm' to use Wasm EH instructions in addClangTargetOptions()
429 CC1Args.push_back("-exception-model=wasm"); in addClangTargetOptions()
432 // reference-types. in addClangTargetOptions()
435 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
436 << "-mllvm -wasm-enable-sjlj" << "-mno-multivalue"; in addClangTargetOptions()
440 getDriver().Diag(diag::err_drv_argument_not_allowed_with) in addClangTargetOptions()
441 << "-mllvm -wasm-enable-sjlj" << "-mno-reference-types"; in addClangTargetOptions()
443 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
445 CC1Args.push_back("-target-feature"); in addClangTargetOptions()
446 CC1Args.push_back("+reference-types"); in addClangTargetOptions()
458 StringRef Value = A->getValue(); in GetCXXStdlibType()
464 getDriver().Diag(diag::err_drv_invalid_stdlib_name) in GetCXXStdlibType()
465 << A->getAsString(Args); in GetCXXStdlibType()
486 // Check for configure-time C include directories. in AddClangSystemIncludeArgs()
529 CmdArgs.push_back("-lc++"); in AddCXXStdlibLibArgs()
531 CmdArgs.push_back("-lc++experimental"); in AddCXXStdlibLibArgs()
532 CmdArgs.push_back("-lc++abi"); in AddCXXStdlibLibArgs()
535 CmdArgs.push_back("-lstdc++"); in AddCXXStdlibLibArgs()
545 // -fsanitize=function places two words before the function label, which are in getSupportedSanitizers()
546 // -unsupported. in getSupportedSanitizers()
565 std::string Version = detectLibcxxVersion(LibPath); in addLibCxxIncludePaths() local
566 if (Version.empty()) in addLibCxxIncludePaths()
569 // First add the per-target include path if the OS is known. in addLibCxxIncludePaths()
571 std::string TargetDir = LibPath + "/" + MultiarchTriple + "/c++/" + Version; in addLibCxxIncludePaths()
576 addSystemInclude(DriverArgs, CC1Args, LibPath + "/c++/" + Version); in addLibCxxIncludePaths()
594 std::string Version; in addLibStdCXXIncludePaths() local
603 StringRef VersionText = llvm::sys::path::filename(LI->path()); in addLibStdCXXIncludePaths()
605 auto Version = Generic_GCC::GCCVersion::Parse(VersionText); in addLibStdCXXIncludePaths() local
606 if (Version > MaxVersion) in addLibStdCXXIncludePaths()
607 MaxVersion = Version; in addLibStdCXXIncludePaths()
611 Version = MaxVersion.Text; in addLibStdCXXIncludePaths()
614 if (Version.empty()) in addLibStdCXXIncludePaths()
617 // First add the per-target include path if the OS is known. in addLibStdCXXIncludePaths()
619 std::string TargetDir = LibPath + "/c++/" + Version + "/" + MultiarchTriple; in addLibStdCXXIncludePaths()
624 addSystemInclude(DriverArgs, CC1Args, LibPath + "/c++/" + Version); in addLibStdCXXIncludePaths()
626 addSystemInclude(DriverArgs, CC1Args, LibPath + "/c++/" + Version + "/backward"); in addLibStdCXXIncludePaths()