summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2015-02-14 01:16:54 +0000
committerMatthias Braun <matze@braunis.de>2015-02-14 01:16:54 +0000
commit33cc10724d7d5ae3e6502fb8806cc02a1f821aef (patch)
treed5bcc32b4cd469a37d0e6a2baaa279340cca5ce3 /llvm/lib/CodeGen/AsmPrinter
parent2c79ad974c641dd799b04c656aa8c2fc96dfb3cd (diff)
downloadbcm5719-llvm-33cc10724d7d5ae3e6502fb8806cc02a1f821aef.tar.gz
bcm5719-llvm-33cc10724d7d5ae3e6502fb8806cc02a1f821aef.zip
Revert "On ELF, put PIC jump tables in a non executable section."
This reverts commit r228939. The commit broke something in the output of exception handling tables on darwin x86-64. llvm-svn: 229203
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 5a01e0e9b6f..aacc486aa14 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1178,14 +1178,23 @@ void AsmPrinter::EmitJumpTableInfo() {
// the appropriate section.
const Function *F = MF->getFunction();
const TargetLoweringObjectFile &TLOF = getObjFileLowering();
- bool JTInDiffSection = !TLOF.shouldPutJumpTableInFunctionSection(
- MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32,
- *F);
- if (JTInDiffSection) {
+ 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()) {
+ 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(
OpenPOWER on IntegriCloud