diff options
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
| -rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 6548f56f25..366b8b398f 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -293,13 +293,16 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI, // the appropriate section. TargetLowering *LoweringInfo = TM.getTargetLowering(); - const char* JumpTableDataSection = TAI->getJumpTableDataSection(); + const char* JumpTableDataSection = TAI->getJumpTableDataSection(); + const Function *F = MF.getFunction(); + unsigned SectionFlags = TAI->SectionFlagsForGlobal(F); if ((IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) || - !JumpTableDataSection) { + !JumpTableDataSection || + SectionFlags & SectionFlags::Linkonce) { // In PIC mode, we need to emit the jump table to the same section as the // function body itself, otherwise the label differences won't make sense. - // We should also do if the section name is NULL. - const Function *F = MF.getFunction(); + // We should also do if the section name is NULL or function is declared in + // discardable section. SwitchToTextSection(getSectionForFunction(*F).c_str(), F); } else { SwitchToDataSection(JumpTableDataSection); |
