diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2007-02-01 17:12:54 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2007-02-01 17:12:54 +0000 |
commit | 5dfbaf1fe3fa6914095cc55cde20b1ed25187b56 (patch) | |
tree | ce873bea2420b90c9309abf36c5c2e096c7fbbb1 /lib/Linker/LinkModules.cpp | |
parent | b82313fdc21e8190768addf0f16710b94f0e1441 (diff) |
preserve sections of globals
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33756 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 44d90d24a3..8b1a06d4c6 100644 --- a/lib/Linker/LinkModules.cpp +++ b/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. |