================ @@ -2764,10 +2771,59 @@ void AsmPrinter::emitJumpTableInfo() { for (const MachineBasicBlock *MBB : JTBBs) emitJumpTableEntry(MJTI, MBB, JTI); } + + if (EmitJumpTableSizesSection) + emitJumpTableSizesSection(MJTI, F); + if (!JTInDiffSection) OutStreamer->emitDataRegion(MCDR_DataRegionEnd); } +void AsmPrinter::emitJumpTableSizesSection(const MachineJumpTableInfo *MJTI, + const Function &F) const { + const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables(); + + if (JT.empty()) + return; + + StringRef GroupName = F.hasComdat() ? F.getComdat()->getName() : ""; + MCSection *JumpTableSizesSection = nullptr; + StringRef sectionName = ".llvm_jump_table_sizes"; + + if (TM.getTargetTriple().isOSBinFormatELF()) { + MCSymbolELF *LinkedToSym = dyn_cast<MCSymbolELF>(CurrentFnSym); + int Flags = F.hasComdat() ? ELF::SHF_GROUP : 0; + + JumpTableSizesSection = OutContext.getELFSection( + sectionName, ELF::SHT_LLVM_JT_SIZES, Flags, 0, GroupName, F.hasComdat(), + MCSection::NonUniqueID, LinkedToSym); + } else if (TM.getTargetTriple().isOSBinFormatCOFF()) { + if (F.hasComdat()) { + MCSymbolCOFF *LinkedToSym = dyn_cast<MCSymbolCOFF>(CurrentFnSym); + + JumpTableSizesSection = OutContext.getCOFFSection( + sectionName, + COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ | + COFF::IMAGE_SCN_LNK_COMDAT | COFF::IMAGE_SCN_MEM_DISCARDABLE, + F.getComdat()->getName(), COFF::IMAGE_COMDAT_SELECT_ASSOCIATIVE); + } else + JumpTableSizesSection = OutContext.getCOFFSection( + sectionName, COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | + COFF::IMAGE_SCN_MEM_READ | + COFF::IMAGE_SCN_MEM_DISCARDABLE); + } else { + return; ---------------- compnerd wrote:
Can you change this to an early return please? https://github.com/llvm/llvm-project/pull/101962 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits