diff options
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 2a77a68..81f3864 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -733,15 +733,20 @@ calcUniqueIDUpdateFlagsAndSize(const GlobalObject *GO, StringRef SectionName, Ctx.isELFGenericMergeableSection(SectionName); // If this is the first ocurrence of this section name, treat it as the // generic section - if (!SymbolMergeable && !SeenSectionNameBefore) - return MCContext::GenericSectionID; + if (!SymbolMergeable && !SeenSectionNameBefore) { + if (TM.getSeparateNamedSections()) + return NextUniqueID++; + else + return MCContext::GenericSectionID; + } // Symbols must be placed into sections with compatible entry sizes. Generate // unique sections for symbols that have not been assigned to compatible // sections. const auto PreviousID = Ctx.getELFUniqueIDForEntsize(SectionName, Flags, EntrySize); - if (PreviousID) + if (PreviousID && (!TM.getSeparateNamedSections() || + *PreviousID == MCContext::GenericSectionID)) return *PreviousID; // If the user has specified the same section name as would be created |