aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 334da3a..cb4f2d6 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1054,6 +1054,27 @@ static bool parseVScaleArgs(CompilerInvocation &invoc, llvm::opt::ArgList &args,
return true;
}
+static bool parseLinkerOptionsArgs(CompilerInvocation &invoc,
+ llvm::opt::ArgList &args,
+ clang::DiagnosticsEngine &diags) {
+ llvm::Triple triple = llvm::Triple(invoc.getTargetOpts().triple);
+
+ // TODO: support --dependent-lib on other platforms when MLIR supports
+ // !llvm.dependent.lib
+ if (args.hasArg(clang::driver::options::OPT_dependent_lib) &&
+ !triple.isOSWindows()) {
+ const unsigned diagID =
+ diags.getCustomDiagID(clang::DiagnosticsEngine::Error,
+ "--dependent-lib is only supported on Windows");
+ diags.Report(diagID);
+ return false;
+ }
+
+ invoc.getCodeGenOpts().DependentLibs =
+ args.getAllArgValues(clang::driver::options::OPT_dependent_lib);
+ return true;
+}
+
bool CompilerInvocation::createFromArgs(
CompilerInvocation &res, llvm::ArrayRef<const char *> commandLineArgs,
clang::DiagnosticsEngine &diags, const char *argv0) {
@@ -1163,6 +1184,8 @@ bool CompilerInvocation::createFromArgs(
success &= parseVScaleArgs(res, args, diags);
+ success &= parseLinkerOptionsArgs(res, args, diags);
+
// Set the string to be used as the return value of the COMPILER_OPTIONS
// intrinsic of iso_fortran_env. This is either passed in from the parent
// compiler driver invocation with an environment variable, or failing that