summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2014-01-16 06:29:36 +0000
committerBill Wendling <isanbard@gmail.com>2014-01-16 06:29:36 +0000
commit91686d6dee735c7bce085c81e9cdc3f1e633a19f (patch)
treeb574963345608a141a0672068be403db40775d5e /llvm/lib/Linker/LinkModules.cpp
parent8a60fff26016ea25b3af477d4945397c4242b42e (diff)
downloadbcm5719-llvm-91686d6dee735c7bce085c81e9cdc3f1e633a19f.tar.gz
bcm5719-llvm-91686d6dee735c7bce085c81e9cdc3f1e633a19f.zip
Reapply r194218 with fix:
Move copying of global initializers below the cloning of functions. The BlockAddress doesn't have access to the correct basic blocks until the functions have been cloned. This causes the BlockAddress to point to the old values. Just wait until the functions have been cloned before copying the initializers. PR13163 llvm-svn: 199354
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 4d039eb2c6d..4c86a825c89 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -1249,10 +1249,6 @@ bool ModuleLinker::run() {
for (unsigned i = 0, e = AppendingVars.size(); i != e; ++i)
linkAppendingVarInit(AppendingVars[i]);
- // Update the initializers in the DstM module now that all globals that may
- // be referenced are in DstM.
- linkGlobalInits();
-
// Link in the function bodies that are defined in the source module into
// DstM.
for (Module::iterator SF = SrcM->begin(), E = SrcM->end(); SF != E; ++SF) {
@@ -1290,6 +1286,10 @@ bool ModuleLinker::run() {
if (linkModuleFlagsMetadata())
return true;
+ // Update the initializers in the DstM module now that all globals that may
+ // be referenced are in DstM.
+ linkGlobalInits();
+
// Process vector of lazily linked in functions.
bool LinkedInAnyFunctions;
do {
OpenPOWER on IntegriCloud