summaryrefslogtreecommitdiff
path: root/lib/Linker
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-11-07 20:14:51 +0000
committerBill Wendling <isanbard@gmail.com>2013-11-07 20:14:51 +0000
commit5d5f2c37d57276c9320dd2677d355d47fa4bc5c4 (patch)
treec4c7a106e12d0d23238c5450cb84ec511c914fd5 /lib/Linker
parent9f471750fa6f34120d4758d5d14f54f899e34a54 (diff)
downloadllvm-5d5f2c37d57276c9320dd2677d355d47fa4bc5c4.tar.gz
llvm-5d5f2c37d57276c9320dd2677d355d47fa4bc5c4.tar.bz2
llvm-5d5f2c37d57276c9320dd2677d355d47fa4bc5c4.tar.xz
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194218 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r--lib/Linker/LinkModules.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 8f2200e4ea..00c2ed144d 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -1251,10 +1251,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) {
@@ -1336,6 +1332,10 @@ bool ModuleLinker::run() {
}
} while (LinkedInAnyFunctions);
+ // Update the initializers in the DstM module now that all globals that may
+ // be referenced are in DstM.
+ linkGlobalInits();
+
// Now that all of the types from the source are used, resolve any structs
// copied over to the dest that didn't exist there.
TypeMap.linkDefinedTypeBodies();