[PATCH] D40990: [WebAssembly] Add check to ensure symbol VA is only set once. NFC
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 7 16:13:57 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD320118: [WebAssembly] Add check to ensure symbol VA is only set once. NFC. (authored by sbc).
Changed prior to commit:
https://reviews.llvm.org/D40990?vs=126070&id=126073#toc
Repository:
rL LLVM
https://reviews.llvm.org/D40990
Files:
wasm/Driver.cpp
wasm/Symbols.cpp
Index: wasm/Driver.cpp
===================================================================
--- wasm/Driver.cpp
+++ wasm/Driver.cpp
@@ -134,17 +134,6 @@
return None;
}
-// Inject a new wasm global into the output binary with the given value.
-// Wasm global are used in relocatable object files to model symbol imports
-// and exports. In the final executable the only use of wasm globals is
-// for the exlicit stack pointer (__stack_pointer).
-static Symbol* addSyntheticGlobal(StringRef Name, int32_t Value) {
- log("injecting global: " + Name);
- Symbol *S = Symtab->addDefinedGlobal(Name);
- S->setVirtualAddress(Value);
- return S;
-}
-
// Inject a new undefined symbol into the link. This will cause the link to
// fail unless this symbol can be found.
static void addSyntheticUndefinedFunction(StringRef Name,
@@ -285,7 +274,7 @@
for (StringRef S : args::getStrings(Args, OPT_undefined))
addSyntheticUndefinedFunction(S, nullptr);
- Config->StackPointerSymbol = addSyntheticGlobal("__stack_pointer", 0);
+ Config->StackPointerSymbol = Symtab->addDefinedGlobal("__stack_pointer");
}
createFiles(Args);
Index: wasm/Symbols.cpp
===================================================================
--- wasm/Symbols.cpp
+++ wasm/Symbols.cpp
@@ -61,6 +61,7 @@
void Symbol::setVirtualAddress(uint32_t Value) {
DEBUG(dbgs() << "setVirtualAddress " << Name << " -> " << Value << "\n");
+ assert(!VirtualAddress.hasValue());
VirtualAddress = Value;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40990.126073.patch
Type: text/x-patch
Size: 1503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171208/14d5b604/attachment.bin>
More information about the llvm-commits
mailing list