diff options
Diffstat (limited to 'lib/Target/ELFTargetAsmInfo.cpp')
-rw-r--r-- | lib/Target/ELFTargetAsmInfo.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Target/ELFTargetAsmInfo.cpp b/lib/Target/ELFTargetAsmInfo.cpp index fe006a3..cf4e3a2 100644 --- a/lib/Target/ELFTargetAsmInfo.cpp +++ b/lib/Target/ELFTargetAsmInfo.cpp @@ -121,8 +121,11 @@ ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { return getReadOnlySection(); case SectionKind::RODataMergeStr: return MergeableStringSection(GVar); - case SectionKind::RODataMergeConst: - return MergeableConstSection(GVar->getInitializer()->getType()); + case SectionKind::RODataMergeConst: { + const Type *Ty = GVar->getInitializer()->getType(); + const TargetData *TD = TM.getTargetData(); + return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0); + } case SectionKind::ThreadData: // ELF targets usually support TLS stuff return TLSDataSection; @@ -166,12 +169,6 @@ ELFTargetAsmInfo::getSectionForMergableConstant(uint64_t Size, const Section* -ELFTargetAsmInfo::MergeableConstSection(const Type *Ty) const { - const TargetData *TD = TM.getTargetData(); - return getSectionForMergableConstant(TD->getTypeAllocSize(Ty), 0); -} - -const Section* ELFTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const { const TargetData *TD = TM.getTargetData(); Constant *C = cast<GlobalVariable>(GV)->getInitializer(); |