From df19519800168690eeb5fc92f366820019c62217 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 17 Feb 2015 23:34:51 +0000 Subject: 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. llvm-svn: 229586 --- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp') diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 07d9576222e..0ef10bfa440 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -359,6 +359,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. -- cgit v1.2.3