summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Symbols.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-06-28 17:04:58 +0000
committerSam Clegg <sbc@chromium.org>2018-06-28 17:04:58 +0000
commitce004bfe35c20d227865605427a11ff90ccb23b3 (patch)
tree3860ac0f4012651820b01211552863326a4e5968 /lld/wasm/Symbols.cpp
parentda5e7e11d1072ea13460f0b4ca77b7de35bf2bb8 (diff)
downloadbcm5719-llvm-ce004bfe35c20d227865605427a11ff90ccb23b3.tar.gz
bcm5719-llvm-ce004bfe35c20d227865605427a11ff90ccb23b3.zip
[WebAssembly] Add support for bitcode archive members
This change effects the behavior of --export-all. Previously --export-all would only effect symbols that survived GC. Now --export-all will prevent any non-local symbols from being GCed. Differential Revision: https://reviews.llvm.org/D48673 llvm-svn: 335878
Diffstat (limited to 'lld/wasm/Symbols.cpp')
-rw-r--r--lld/wasm/Symbols.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp
index 6b43eb36341..ef135b35b1a 100644
--- a/lld/wasm/Symbols.cpp
+++ b/lld/wasm/Symbols.cpp
@@ -98,6 +98,16 @@ void Symbol::setHidden(bool IsHidden) {
Flags |= WASM_SYMBOL_VISIBILITY_DEFAULT;
}
+bool Symbol::isExported() const {
+ if (!isDefined() || isLocal())
+ return false;
+
+ if (Config->ExportAll)
+ return true;
+
+ return !isHidden();
+}
+
uint32_t FunctionSymbol::getFunctionIndex() const {
if (auto *F = dyn_cast<DefinedFunction>(this))
return F->Function->getFunctionIndex();
OpenPOWER on IntegriCloud