summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2007-02-01 17:12:54 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2007-02-01 17:12:54 +0000
commitdd924e4e95404571edf59250f7b59ba983b855fb (patch)
tree051a605040e8a76843e0becd60766e17b10c9afc /llvm/lib/Linker/LinkModules.cpp
parentc3de9b4b144eb19ff4b34e458d96cb9f18fff97e (diff)
downloadbcm5719-llvm-dd924e4e95404571edf59250f7b59ba983b855fb.tar.gz
bcm5719-llvm-dd924e4e95404571edf59250f7b59ba983b855fb.zip
preserve sections of globals
llvm-svn: 33756
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 44d90d24a39..8b1a06d4c69 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -478,7 +478,10 @@ static bool LinkGlobals(Module *Dest, Module *Src,
SGV->getName(), Dest);
// Propagate alignment info.
NewDGV->setAlignment(SGV->getAlignment());
-
+
+ // Propagate section info.
+ NewDGV->setSection(SGV->getSection());
+
// If the LLVM runtime renamed the global, but it is an externally visible
// symbol, DGV must be an existing global with internal linkage. Rename
// it.
@@ -503,6 +506,9 @@ static bool LinkGlobals(Module *Dest, Module *Src,
// Propagate alignment info.
NewDGV->setAlignment(std::max(DGV->getAlignment(), SGV->getAlignment()));
+ // Propagate section info.
+ NewDGV->setSection(SGV->getSection());
+
// Make sure to remember this mapping...
ValueMap.insert(std::make_pair(SGV, NewDGV));
@@ -512,6 +518,9 @@ static bool LinkGlobals(Module *Dest, Module *Src,
// Propagate alignment info.
DGV->setAlignment(std::max(DGV->getAlignment(), SGV->getAlignment()));
+ // Propagate section info.
+ DGV->setSection(SGV->getSection());
+
// Otherwise, perform the mapping as instructed by GetLinkageResult. If
// the types don't match, and if we are to link from the source, nuke DGV
// and create a new one of the appropriate type.
OpenPOWER on IntegriCloud