summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Writer.cpp
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2019-03-25 18:10:26 +0000
committerThomas Lively <tlively@google.com>2019-03-25 18:10:26 +0000
commit84c8652fc3085155d0f9c355455e5a797c6d9db6 (patch)
treed35da286bedb82ea701b691e94eb3e3e8ea3b4ff /lld/wasm/Writer.cpp
parenta199a9ba40c722a78f6e76a91c1a2263468c48cb (diff)
downloadbcm5719-llvm-84c8652fc3085155d0f9c355455e5a797c6d9db6.tar.gz
bcm5719-llvm-84c8652fc3085155d0f9c355455e5a797c6d9db6.zip
Revert "[WebAssembly] Add linker options to control feature checking"
This reverts commit 5991328c96b6146999cfa74ede42901f8c01f2fa. llvm-svn: 356932
Diffstat (limited to 'lld/wasm/Writer.cpp')
-rw-r--r--lld/wasm/Writer.cpp36
1 files changed, 4 insertions, 32 deletions
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp
index 5f12ce73922..897908a5ad0 100644
--- a/lld/wasm/Writer.cpp
+++ b/lld/wasm/Writer.cpp
@@ -878,30 +878,18 @@ void Writer::createSections() {
}
void Writer::calculateTargetFeatures() {
- SmallSet<std::string, 8> Used;
SmallSet<std::string, 8> Required;
SmallSet<std::string, 8> Disallowed;
- // Only infer used features if user did not specify features
- bool InferFeatures = !Config->Features.hasValue();
-
- if (!InferFeatures) {
- for (auto &Feature : Config->Features.getValue())
- TargetFeatures.insert(Feature);
- // No need to read or check features
- if (!Config->CheckFeatures)
- return;
- }
-
// Find the sets of used, required, and disallowed features
for (ObjFile *File : Symtab->ObjectFiles) {
for (auto &Feature : File->getWasmObj()->getTargetFeatures()) {
switch (Feature.Prefix) {
case WASM_FEATURE_PREFIX_USED:
- Used.insert(Feature.Name);
+ TargetFeatures.insert(Feature.Name);
break;
case WASM_FEATURE_PREFIX_REQUIRED:
- Used.insert(Feature.Name);
+ TargetFeatures.insert(Feature.Name);
Required.insert(Feature.Name);
break;
case WASM_FEATURE_PREFIX_DISALLOWED:
@@ -914,20 +902,6 @@ void Writer::calculateTargetFeatures() {
}
}
- if (InferFeatures)
- TargetFeatures.insert(Used.begin(), Used.end());
-
- if (!Config->CheckFeatures)
- return;
-
- // Validate that used features are allowed in output
- if (!InferFeatures) {
- for (auto &Feature : Used) {
- if (!TargetFeatures.count(Feature))
- error(Twine("Target feature '") + Feature + "' is not allowed.");
- }
- }
-
// Validate the required and disallowed constraints for each file
for (ObjFile *File : Symtab->ObjectFiles) {
SmallSet<std::string, 8> ObjectFeatures;
@@ -936,13 +910,11 @@ void Writer::calculateTargetFeatures() {
continue;
ObjectFeatures.insert(Feature.Name);
if (Disallowed.count(Feature.Name))
- error(Twine("Target feature '") + Feature.Name +
- "' is disallowed. Use --no-check-features to suppress.");
+ error("Target feature \"" + Feature.Name + "\" is disallowed");
}
for (auto &Feature : Required) {
if (!ObjectFeatures.count(Feature))
- error(Twine("Missing required target feature '") + Feature +
- "'. Use --no-check-features to suppress.");
+ error(Twine("Missing required target feature \"") + Feature + "\"");
}
}
}
OpenPOWER on IntegriCloud