mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add r228939 back with a fix.
The problem in the original patch was not switching back to .text after printing an eh table. Original message: On ELF, put PIC jump tables in a non executable section. Fixes PR22558. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229586 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1178,23 +1178,16 @@ void AsmPrinter::EmitJumpTableInfo() {
|
||||
// the appropriate section.
|
||||
const Function *F = MF->getFunction();
|
||||
const TargetLoweringObjectFile &TLOF = getObjFileLowering();
|
||||
bool JTInDiffSection = false;
|
||||
if (// 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.
|
||||
// FIXME: Need a better predicate for this: what about custom entries?
|
||||
MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 ||
|
||||
// We should also do if the section name is NULL or function is declared
|
||||
// in discardable section
|
||||
// FIXME: this isn't the right predicate, should be based on the MCSection
|
||||
// for the function.
|
||||
F->isWeakForLinker()) {
|
||||
bool JTInDiffSection = !TLOF.shouldPutJumpTableInFunctionSection(
|
||||
MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32,
|
||||
*F);
|
||||
if (!JTInDiffSection) {
|
||||
OutStreamer.SwitchSection(TLOF.SectionForGlobal(F, *Mang, TM));
|
||||
} else {
|
||||
// Otherwise, drop it in the readonly section.
|
||||
const MCSection *ReadOnlySection =
|
||||
TLOF.getSectionForJumpTable(*F, *Mang, TM);
|
||||
OutStreamer.SwitchSection(ReadOnlySection);
|
||||
JTInDiffSection = true;
|
||||
}
|
||||
|
||||
EmitAlignment(Log2_32(
|
||||
|
Reference in New Issue
Block a user