On ELF, put PIC jump tables in a non executable section.

Fixes PR22558.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228939 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-02-12 17:46:49 +00:00
parent 8eeedf74d3
commit c3c5d7c2d6
6 changed files with 41 additions and 13 deletions

View File

@ -356,6 +356,13 @@ const MCSection *TargetLoweringObjectFileELF::getSectionForJumpTable(
return getContext().getELFSection(Name, ELF::SHT_PROGBITS, Flags, 0, Group);
}
bool TargetLoweringObjectFileELF::shouldPutJumpTableInFunctionSection(
bool UsesLabelDifference, const Function &F) const {
// We can always create relative relocations, so use another section
// that can be marked non-executable.
return false;
}
/// getSectionForConstant - Given a mergeable constant with the
/// specified size and relocation information, return a section that it
/// should be placed in.