diff options
| author | Thomas Lively <tlively@google.com> | 2019-03-22 20:43:06 +0000 |
|---|---|---|
| committer | Thomas Lively <tlively@google.com> | 2019-03-22 20:43:06 +0000 |
| commit | 5991328c96b6146999cfa74ede42901f8c01f2fa (patch) | |
| tree | 98ab96840053518493f2e8310d18d6cbf98a298c /lld/wasm/Driver.cpp | |
| parent | c48e223309c36d482107b86b97c91d4a231f7322 (diff) | |
| download | bcm5719-llvm-5991328c96b6146999cfa74ede42901f8c01f2fa.tar.gz bcm5719-llvm-5991328c96b6146999cfa74ede42901f8c01f2fa.zip | |
[WebAssembly] Add linker options to control feature checking
Summary:
Adds --check-features and --no-check-features. The default for now is
to enable the checking, but this might change in the future.
Also adds --features=foo,bar for precisely controlling the features
used in the output binary.
Depends on D59173.
Reviewers: sbc100, aheejin
Subscribers: dschuff, jgravelle-google, sunfish, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D59274
llvm-svn: 356805
Diffstat (limited to 'lld/wasm/Driver.cpp')
| -rw-r--r-- | lld/wasm/Driver.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp index 19ea38c1d94..f9dfd5ce464 100644 --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -21,6 +21,7 @@ #include "lld/Common/Version.h" #include "llvm/ADT/Twine.h" #include "llvm/Object/Wasm.h" +#include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Path.h" @@ -292,6 +293,8 @@ static StringRef getEntry(opt::InputArgList &Args, StringRef Default) { // of these values. static void setConfigs(opt::InputArgList &Args) { Config->AllowUndefined = Args.hasArg(OPT_allow_undefined); + Config->CheckFeatures = + Args.hasFlag(OPT_check_features, OPT_no_check_features, true); Config->CompressRelocations = Args.hasArg(OPT_compress_relocations); Config->Demangle = Args.hasFlag(OPT_demangle, OPT_no_demangle, true); Config->DisableVerify = Args.hasArg(OPT_disable_verify); @@ -339,6 +342,13 @@ static void setConfigs(opt::InputArgList &Args) { Config->MaxMemory = args::getInteger(Args, OPT_max_memory, 0); Config->ZStackSize = args::getZOptionValue(Args, OPT_z, "stack-size", WasmPageSize); + + if (auto *Arg = Args.getLastArg(OPT_features)) { + Config->Features = + llvm::Optional<std::vector<std::string>>(std::vector<std::string>()); + for (StringRef S : Arg->getValues()) + Config->Features->push_back(S); + } } // Some command line options or some combinations of them are not allowed. |

