summaryrefslogtreecommitdiff
path: root/lib/Linker
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
commita950ad4eec1b0ff3c1a83e9d8ccba9dc36995352 (patch)
tree270aa747069de45c560c0d1e6dd3d81f25808db6 /lib/Linker
parentfab01c190883724f92111e5bdb4d4d82748284eb (diff)
downloadllvm-a950ad4eec1b0ff3c1a83e9d8ccba9dc36995352.tar.gz
llvm-a950ad4eec1b0ff3c1a83e9d8ccba9dc36995352.tar.bz2
llvm-a950ad4eec1b0ff3c1a83e9d8ccba9dc36995352.tar.xz
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199354 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 4d039eb2c6..4c86a825c8 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/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 {