@@ -990,17 +990,19 @@ MCSection *TargetLoweringObjectFileELF::getUniqueSectionForFunction(
990990}
991991
992992MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable (
993- const Function &F, const TargetMachine &TM) const {
994- return getSectionForJumpTable (F, TM, /* JTE=*/ nullptr );
993+ const Function &F, const TargetMachine &TM,
994+ bool EmitUniqueSection) const {
995+ return getSectionForJumpTable (F, TM, /* JTE=*/ nullptr , EmitUniqueSection);
995996}
996997
997998MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable (
998999 const Function &F, const TargetMachine &TM,
999- const MachineJumpTableEntry *JTE) const {
1000+ const MachineJumpTableEntry *JTE, bool EmitUniqueSection ) const {
10001001 // If the function can be removed, produce a unique section so that
10011002 // the table doesn't prevent the removal.
10021003 const Comdat *C = F.getComdat ();
1003- bool EmitUniqueSection = TM.getFunctionSections () || C;
1004+ if (!EmitUniqueSection)
1005+ EmitUniqueSection = TM.getFunctionSections () || C;
10041006 if (!EmitUniqueSection && !TM.getEnableStaticDataPartitioning ())
10051007 return ReadOnlySection;
10061008
@@ -1878,11 +1880,13 @@ void TargetLoweringObjectFileCOFF::getNameWithPrefix(
18781880}
18791881
18801882MCSection *TargetLoweringObjectFileCOFF::getSectionForJumpTable (
1881- const Function &F, const TargetMachine &TM) const {
1883+ const Function &F, const TargetMachine &TM,
1884+ bool EmitUniqueSection) const {
18821885 // If the function can be removed, produce a unique section so that
18831886 // the table doesn't prevent the removal.
18841887 const Comdat *C = F.getComdat ();
1885- bool EmitUniqueSection = TM.getFunctionSections () || C;
1888+ if (!EmitUniqueSection)
1889+ EmitUniqueSection = TM.getFunctionSections () || C;
18861890 if (!EmitUniqueSection)
18871891 return ReadOnlySection;
18881892
@@ -2591,7 +2595,7 @@ MCSection *TargetLoweringObjectFileXCOFF::SelectSectionForGlobal(
25912595}
25922596
25932597MCSection *TargetLoweringObjectFileXCOFF::getSectionForJumpTable (
2594- const Function &F, const TargetMachine &TM) const {
2598+ const Function &F, const TargetMachine &TM, bool EmitUniqueSection ) const {
25952599 assert (!F.getComdat () && " Comdat not supported on XCOFF." );
25962600
25972601 if (!TM.getFunctionSections ())
0 commit comments