aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-24 19:37:11 +0000
committerDan Gohman <gohman@apple.com>2010-08-24 19:37:11 +0000
commite422d1b16238ad4d9d7ef3b074715e795ab3ddc0 (patch)
tree260070806b30b9abec1c35ff7e58b0bf0286478d
parente5835fbe7fb3d87b8cd110b24f0f9772384a5212 (diff)
downloadexternal_llvm-e422d1b16238ad4d9d7ef3b074715e795ab3ddc0.zip
external_llvm-e422d1b16238ad4d9d7ef3b074715e795ab3ddc0.tar.gz
external_llvm-e422d1b16238ad4d9d7ef3b074715e795ab3ddc0.tar.bz2
Link NamedMDNodes after linking GlobalValues, so that MDNodes
which reference GlobalValues are properly remapped. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111949 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Linker/LinkModules.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 016c82c..1ab35e0 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -1244,9 +1244,6 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) {
AppendingVars.insert(std::make_pair(I->getName(), I));
}
- // Insert all of the named mdnoes in Src into the Dest module.
- LinkNamedMDNodes(Dest, Src, ValueMap);
-
// Insert all of the globals in src into the Dest module... without linking
// initializers (which could refer to functions not yet mapped over).
if (LinkGlobals(Dest, Src, ValueMap, AppendingVars, ErrorMsg))
@@ -1280,6 +1277,11 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) {
// Resolve all uses of aliases with aliasees
if (ResolveAliases(Dest)) return true;
+ // Remap all of the named mdnoes in Src into the Dest module. We do this
+ // after linking GlobalValues so that MDNodes that reference GlobalValues
+ // are properly remapped.
+ LinkNamedMDNodes(Dest, Src, ValueMap);
+
// If the source library's module id is in the dependent library list of the
// destination library, remove it since that module is now linked in.
sys::Path modId;