summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 581e8217dee..55654ac25d6 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -495,10 +495,16 @@ static void forceRenaming(GlobalValue *GV, StringRef Name) {
/// a GlobalValue) from the SrcGV to the DestGV.
static void copyGVAttributes(GlobalValue *DestGV, const GlobalValue *SrcGV) {
// Use the maximum alignment, rather than just copying the alignment of SrcGV.
- unsigned Alignment = std::max(DestGV->getAlignment(), SrcGV->getAlignment());
+ unsigned Alignment;
+ bool IsAlias = isa<GlobalAlias>(DestGV);
+ if (!IsAlias)
+ Alignment = std::max(DestGV->getAlignment(), SrcGV->getAlignment());
+
DestGV->copyAttributesFrom(SrcGV);
- DestGV->setAlignment(Alignment);
-
+
+ if (!IsAlias)
+ DestGV->setAlignment(Alignment);
+
forceRenaming(DestGV, SrcGV->getName());
}
OpenPOWER on IntegriCloud