From 7afbf3192dc5690285edbfb336c061a9d43e247e Mon Sep 17 00:00:00 2001 From: Greg McGary Date: Mon, 21 Sep 2020 13:21:45 -0700 Subject: [lld-macho] minimally handle option -dynamic Stifle the warning for unimplemented option `-dyamic`, since it is already the default. Add `Config::staticLink` and skeletal support for altering the flag, but otherwise leave the option `-static` as hidden and its warning in place. Differential Revision: https://reviews.llvm.org/D88045 --- lld/MachO/Config.h | 1 + lld/MachO/Driver.cpp | 4 ++++ lld/MachO/Options.td | 1 - 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'lld') diff --git a/lld/MachO/Config.h b/lld/MachO/Config.h index 5fbb477..47b4cb67 100644 --- a/lld/MachO/Config.h +++ b/lld/MachO/Config.h @@ -35,6 +35,7 @@ struct Configuration { bool hasReexports = false; bool allLoad = false; bool forceLoadObjC = false; + bool staticLink = false; uint32_t headerPad; llvm::StringRef installName; llvm::StringRef outputFile; diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index cda82ec..71af294 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -525,6 +525,9 @@ bool macho::link(llvm::ArrayRef argsArr, bool canExitEarly, config->runtimePaths = args::getStrings(args, OPT_rpath); config->allLoad = args.hasArg(OPT_all_load); + if (const opt::Arg *arg = args.getLastArg(OPT_static, OPT_dynamic)) + config->staticLink = (arg->getOption().getID() == OPT_static); + std::vector &roots = config->systemLibraryRoots; for (const Arg *arg : args.filtered(OPT_syslibroot)) roots.push_back(arg->getValue()); @@ -603,6 +606,7 @@ bool macho::link(llvm::ArrayRef argsArr, bool canExitEarly, case OPT_arch: case OPT_syslibroot: case OPT_sectcreate: + case OPT_dynamic: // handled elsewhere break; default: diff --git a/lld/MachO/Options.td b/lld/MachO/Options.td index e53c1bd..73e3ae8 100644 --- a/lld/MachO/Options.td +++ b/lld/MachO/Options.td @@ -37,7 +37,6 @@ def dylinker : Flag<["-"], "dylinker">, Group; def dynamic : Flag<["-"], "dynamic">, HelpText<"Link dynamically (default)">, - Flags<[HelpHidden]>, Group; def static : Flag<["-"], "static">, HelpText<"Link statically">, -- cgit v1.1