<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Rafael,<div class=""><br class=""></div><div class="">This commit is causing a lot of ASan Unit test failures on darwin:</div><div class=""><a href="http://lab.llvm.org:8080/green/view/All/job/clang-stage1-cmake-RA_check/1487/console" class="">http://lab.llvm.org:8080/green/view/All/job/clang-stage1-cmake-RA_check/1487/console</a></div><div class=""><br class=""></div><div class="">Some are failing with EXC_I386_GPFLT some with EXC_BAD_ACCESS.</div><div class=""><br class=""></div><div class="">Please, revert.</div><div class=""><br class=""></div><div class="">Thank you,</div><div class="">Anna.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 12, 2015, at 9:46 AM, Rafael Espindola <<a href="mailto:rafael.espindola@gmail.com" class="">rafael.espindola@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Author: rafael<br class="">Date: Thu Feb 12 11:46:49 2015<br class="">New Revision: 228939<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=228939&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=228939&view=rev</a><br class="">Log:<br class="">On ELF, put PIC jump tables in a non executable section.<br class=""><br class="">Fixes PR22558.<br class=""><br class="">Modified:<br class="">    llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h<br class="">    llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h<br class="">    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br class="">    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp<br class="">    llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp<br class="">    llvm/trunk/test/CodeGen/X86/global-sections.ll<br class=""><br class="">Modified: llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h?rev=228939&r1=228938&r2=228939&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h?rev=228939&r1=228938&r2=228939&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h (original)<br class="">+++ llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h Thu Feb 12 11:46:49 2015<br class="">@@ -60,6 +60,9 @@ public:<br class="">   getSectionForJumpTable(const Function &F, Mangler &Mang,<br class="">                          const TargetMachine &TM) const override;<br class=""><br class="">+  bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,<br class="">+                                           const Function &F) const override;<br class="">+<br class="">   /// Return an MCExpr to use for a reference to the specified type info global<br class="">   /// variable from exception handling information.<br class="">   const MCExpr *<br class=""><br class="">Modified: llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=228939&r1=228938&r2=228939&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h?rev=228939&r1=228938&r2=228939&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h (original)<br class="">+++ llvm/trunk/include/llvm/Target/TargetLoweringObjectFile.h Thu Feb 12 11:46:49 2015<br class="">@@ -98,6 +98,9 @@ public:<br class="">   getSectionForJumpTable(const Function &F, Mangler &Mang,<br class="">                          const TargetMachine &TM) const;<br class=""><br class="">+  virtual bool shouldPutJumpTableInFunctionSection(bool UsesLabelDifference,<br class="">+                                                   const Function &F) const;<br class="">+<br class="">   /// Targets should implement this method to assign a section to globals with<br class="">   /// an explicit section specfied. The implementation of this method can<br class="">   /// assume that GV->hasSection() is true.<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=228939&r1=228938&r2=228939&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=228939&r1=228938&r2=228939&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Thu Feb 12 11:46:49 2015<br class="">@@ -1178,23 +1178,14 @@ void AsmPrinter::EmitJumpTableInfo() {<br class="">   // the appropriate section.<br class="">   const Function *F = MF->getFunction();<br class="">   const TargetLoweringObjectFile &TLOF = getObjFileLowering();<br class="">-  bool JTInDiffSection = false;<br class="">-  if (// In PIC mode, we need to emit the jump table to the same section as the<br class="">-      // function body itself, otherwise the label differences won't make sense.<br class="">-      // FIXME: Need a better predicate for this: what about custom entries?<br class="">-      MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32 ||<br class="">-      // We should also do if the section name is NULL or function is declared<br class="">-      // in discardable section<br class="">-      // FIXME: this isn't the right predicate, should be based on the MCSection<br class="">-      // for the function.<br class="">-      F->isWeakForLinker()) {<br class="">-    OutStreamer.SwitchSection(TLOF.SectionForGlobal(F, *Mang, TM));<br class="">-  } else {<br class="">+  bool JTInDiffSection = !TLOF.shouldPutJumpTableInFunctionSection(<br class="">+      MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32,<br class="">+      *F);<br class="">+  if (JTInDiffSection) {<br class="">     // Otherwise, drop it in the readonly section.<br class="">     const MCSection *ReadOnlySection =<br class="">         TLOF.getSectionForJumpTable(*F, *Mang, TM);<br class="">     OutStreamer.SwitchSection(ReadOnlySection);<br class="">-    JTInDiffSection = true;<br class="">   }<br class=""><br class="">   EmitAlignment(Log2_32(<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=228939&r1=228938&r2=228939&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=228939&r1=228938&r2=228939&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Thu Feb 12 11:46:49 2015<br class="">@@ -356,6 +356,13 @@ const MCSection *TargetLoweringObjectFil<br class="">   return getContext().getELFSection(Name, ELF::SHT_PROGBITS, Flags, 0, Group);<br class=""> }<br class=""><br class="">+bool TargetLoweringObjectFileELF::shouldPutJumpTableInFunctionSection(<br class="">+    bool UsesLabelDifference, const Function &F) const {<br class="">+  // We can always create relative relocations, so use another section<br class="">+  // that can be marked non-executable.<br class="">+  return false;<br class="">+}<br class="">+<br class=""> /// getSectionForConstant - Given a mergeable constant with the<br class=""> /// specified size and relocation information, return a section that it<br class=""> /// should be placed in.<br class=""><br class="">Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=228939&r1=228938&r2=228939&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=228939&r1=228938&r2=228939&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)<br class="">+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Thu Feb 12 11:46:49 2015<br class="">@@ -275,6 +275,24 @@ const MCSection *TargetLoweringObjectFil<br class="">   return getSectionForConstant(SectionKind::getReadOnly(), /*C=*/nullptr);<br class=""> }<br class=""><br class="">+bool TargetLoweringObjectFile::shouldPutJumpTableInFunctionSection(<br class="">+    bool UsesLabelDifference, const Function &F) const {<br class="">+  // In PIC mode, we need to emit the jump table to the same section as the<br class="">+  // function body itself, otherwise the label differences won't make sense.<br class="">+  // FIXME: Need a better predicate for this: what about custom entries?<br class="">+  if (UsesLabelDifference)<br class="">+    return true;<br class="">+<br class="">+  // We should also do if the section name is NULL or function is declared<br class="">+  // in discardable section<br class="">+  // FIXME: this isn't the right predicate, should be based on the MCSection<br class="">+  // for the function.<br class="">+  if (F.isWeakForLinker())<br class="">+    return true;<br class="">+<br class="">+  return false;<br class="">+}<br class="">+<br class=""> /// getSectionForConstant - Given a mergable constant with the<br class=""> /// specified size and relocation information, return a section that it<br class=""> /// should be placed in.<br class=""><br class="">Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=228939&r1=228938&r2=228939&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=228939&r1=228938&r2=228939&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/CodeGen/X86/global-sections.ll (original)<br class="">+++ llvm/trunk/test/CodeGen/X86/global-sections.ll Thu Feb 12 11:46:49 2015<br class="">@@ -3,6 +3,7 @@<br class=""> ; RUN: llc < %s -mtriple=i386-apple-darwin10 -relocation-model=static | FileCheck %s -check-prefix=DARWIN-STATIC<br class=""> ; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=DARWIN64<br class=""> ; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -data-sections -function-sections | FileCheck %s -check-prefix=LINUX-SECTIONS<br class="">+; RUN: llc < %s -mtriple=x86_64-pc-linux -data-sections -function-sections -relocation-model=pic | FileCheck %s -check-prefix=LINUX-SECTIONS-PIC<br class=""> ; RUN: llc < %s -mtriple=i686-pc-win32 -data-sections -function-sections | FileCheck %s -check-prefix=WIN32-SECTIONS<br class=""><br class=""> define void @F1() {<br class="">@@ -41,6 +42,11 @@ bb5:<br class=""> ; LINUX-SECTIONS-NEXT: .cfi_endproc<br class=""> ; LINUX-SECTIONS-NEXT: .section        .rodata.F2,"a",@progbits<br class=""><br class="">+; LINUX-SECTIONS-PIC: .section        .text.F2,"ax",@progbits<br class="">+; LINUX-SECTIONS-PIC: .size   F2,<br class="">+; LINUX-SECTIONS-PIC-NEXT: .cfi_endproc<br class="">+; LINUX-SECTIONS-PIC-NEXT: .section        .rodata.F2,"a",@progbits<br class="">+<br class=""> ; int G1;<br class=""> @G1 = common global i32 0<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@cs.uiuc.edu" class="">llvm-commits@cs.uiuc.edu</a><br class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br class=""></div></blockquote></div><br class=""></div></body></html>