<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p><br>
</p>
<meta content="text/html; charset=UTF-8">
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black">Hi Eric,</span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black"> </span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black">You recently commited:</span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black">[llvm] r306927 - Rewrite ARM execute only support to avoid the use of a command line flag and unqualified ARMSubtarget lookup.</span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black"> </span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black">This is breaking some of our testing as it changes the attributes of the default .text section, namely the section is no longer execute only. This causes two .text sections to be created (one that is execute only and
 one that is not); some tools may have issues with this. For example, a linker may merge the two .text sections into one segment and remove the PURECODE flag in conformance with section 4.3.3 of <a href="http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdf" target="_blank" rel="noopener noreferrer" style="outline: none; font-family: Calibri, sans-serif, serif, EmojiFont; font-size: 14.6667px;"><font size="3" color="black" style="font-family: Arial, sans-serif, serif, EmojiFont;"><span style="font-size: 12pt;">http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdf</span></font></a><font size="3" style="font-family: Arial, sans-serif, serif, EmojiFont;"><span style="font-size: 12pt;"> .</span></font></span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
 </p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt">Furthermore, in your patch you made similar changes that were initially proposed by Prakhar (namely implementing execute only as a feature flag) but were discussed and decided against. See </span><a href="https://reviews.llvm.org/D27449?id=80748#inline-237468" target="_blank" rel="noopener noreferrer"><span style="font-size:12pt">https://reviews.llvm.org/D27449?id=80748#inline-237468</span></a><span style="font-size:12pt"> . </span></p>
<p class="x_x_MsoNormal" style="margin:0in 0in 0.0001pt 0.5in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black"> </span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black">Take the following example (part of the regression test suite):</span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
 </p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; font-family:"Courier New",serif,serif,EmojiFont; color:black">$ cat test/CodeGen/ARM/execute-only-section.ll</span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; font-family:"Courier New",serif,serif,EmojiFont; color:black">...</span></p>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">; CHECK:     .section .text,"axy",%progbits,unique,0</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">; CHECK-NOT: .section</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">; CHECK-NOT: .text</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">; CHECK:     .globl test_SectionForGlobal</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">; CHECK:     .type test_SectionForGlobal,%function</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">define void @test_SectionForGlobal() {</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">entry:</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">  ret void</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">}</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">...</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">$ llc test/CodeGen/ARM/execute-only-section.ll -mtriple=thumbv7m -mattr=+execute-only  -o -</span></p>
</div>
<div style="color:rgb(33,33,33); font-size:15px">
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.text</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.syntax unified</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.eabi_attribute</span></p>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">67, "2.09"<span class="x_x_xapple-tab-span"> </span>@ Tag_conformance</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">....</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">"test/CodeGen/ARM/execute-only-section.ll"</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.section</span></p>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.text,"axy",%progbits,unique,0</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.globl</span></p>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">test_SectionForGlobal   @ -- Begin function test_SectionForGlobal</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.p2align</span></p>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">2</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.type</span></p>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">test_SectionForGlobal,%function</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.code</span></p>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">16                      @ @test_SectionForGlobal</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.thumb_func</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">test_SectionForGlobal:</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">.fnstart</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">@ BB#0:                                 @ %entry</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black">...</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt; color:black"> </span></p>
</div>
</div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black">There are now two .text sections, one which is execute only and one which is not. This test still passes however as file check finds the execute only .text section.</span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black"> </span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black">This is due to this part of the commit:</span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:10pt; font-family:Tahoma,sans-serif,serif,EmojiFont">--- llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp (original)<br>
+++ llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp Fri Jun 30 19:55:22 2017<br>
@@ -32,7 +32,7 @@ void ARMElfTargetObjectFile::Initialize(<br>
                                         const TargetMachine &TM) {<br>
   const ARMBaseTargetMachine &ARM_TM = static_cast<const ARMBaseTargetMachine &>(TM);<br>
   bool isAAPCS_ABI = ARM_TM.TargetABI == ARMBaseTargetMachine::ARMABI::ARM_ABI_AAPCS;<br>
-  genExecuteOnly = ARM_TM.getSubtargetImpl()->genExecuteOnly();<br>
+  //  genExecuteOnly = ARM_TM.getSubtargetImpl()->genExecuteOnly();<br>
 <br>
   TargetLoweringObjectFileELF::Initialize(Ctx, TM);<br>
   InitializeELF(isAAPCS_ABI);<br>
@@ -43,16 +43,6 @@ void ARMElfTargetObjectFile::Initialize(<br>
 <br>
   AttributesSection =<br>
       getContext().getELFSection(".ARM.attributes", ELF::SHT_ARM_ATTRIBUTES, 0);<br>
-<br>
-  // Make code section unreadable when in execute-only mode<br>
-  if (genExecuteOnly) {<br>
-    unsigned  Type = ELF::SHT_PROGBITS;<br>
-    unsigned Flags = ELF::SHF_EXECINSTR | ELF::SHF_ALLOC | ELF::SHF_ARM_PURECODE;<br>
-    // Since we cannot modify flags for an existing section, we create a new<br>
-    // section with the right flags, and use 0 as the unique ID for<br>
-    // execute-only text<br>
-    TextSection = Ctx.getELFSection(".text", Type, Flags, 0, "", 0U);<br>
-  }<br>
 }</span></p>
<p style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33)">
<span style="font-size:12pt; color:black"> </span></p>
<div style="color:rgb(33,33,33); font-size:15px">
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt">Kind Regards,</span></p>
</div>
<div>
<p class="x_x_xmsonormal" style="margin:0in 0in 0.0001pt 1in; font-size:11pt; font-family:Calibri,sans-serif">
<span style="font-size:12pt">Luke</span></p>
</div>
</div>
<br>
<p></p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> llvm-commits <llvm-commits-bounces@lists.llvm.org> on behalf of Eric Christopher via llvm-commits <llvm-commits@lists.llvm.org><br>
<b>Sent:</b> 01 July 2017 03:55:22<br>
<b>To:</b> llvm-commits@lists.llvm.org<br>
<b>Subject:</b> [llvm] r306927 - Rewrite ARM execute only support to avoid the use of a command line flag and unqualified ARMSubtarget lookup.</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Author: echristo<br>
Date: Fri Jun 30 19:55:22 2017<br>
New Revision: 306927<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=306927&view=rev">http://llvm.org/viewvc/llvm-project?rev=306927&view=rev</a><br>
Log:<br>
Rewrite ARM execute only support to avoid the use of a command line flag and unqualified ARMSubtarget lookup.<br>
<br>
Paired with a clang commit to use the new behavior.<br>
<br>
Modified:<br>
    llvm/trunk/lib/Target/ARM/ARM.td<br>
    llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp<br>
    llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp<br>
    llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h<br>
    llvm/trunk/test/CodeGen/ARM/constantfp.ll<br>
    llvm/trunk/test/CodeGen/ARM/execute-only-big-stack-frame.ll<br>
    llvm/trunk/test/CodeGen/ARM/execute-only-section.ll<br>
    llvm/trunk/test/CodeGen/ARM/execute-only.ll<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/ARM.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.td?rev=306927&r1=306926&r2=306927&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.td?rev=306927&r1=306926&r2=306927&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/ARM.td (original)<br>
+++ llvm/trunk/lib/Target/ARM/ARM.td Fri Jun 30 19:55:22 2017<br>
@@ -269,6 +269,10 @@ def FeatureLongCalls : SubtargetFeature<<br>
                                         "Generate calls via indirect call "<br>
                                         "instructions">;<br>
 <br>
+def FeatureExecuteOnly<br>
+    : SubtargetFeature<"execute-only", "GenExecuteOnly", "true",<br>
+                       "Enable the generation of execute only code.">;<br>
+<br>
 def FeatureReserveR9 : SubtargetFeature<"reserve-r9", "ReserveR9", "true",<br>
                                         "Reserve R9, making it unavailable as "<br>
                                         "GPR">;<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=306927&r1=306926&r2=306927&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=306927&r1=306926&r2=306927&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original)<br>
+++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Fri Jun 30 19:55:22 2017<br>
@@ -92,11 +92,6 @@ ARMSubtarget &ARMSubtarget::initializeSu<br>
   return *this;<br>
 }<br>
 <br>
-/// EnableExecuteOnly - Enables the generation of execute-only code on supported<br>
-/// targets<br>
-static cl::opt<bool><br>
-EnableExecuteOnly("arm-execute-only");<br>
-<br>
 ARMFrameLowering *ARMSubtarget::initializeFrameLowering(StringRef CPU,<br>
                                                         StringRef FS) {<br>
   ARMSubtarget &STI = initializeSubtargetDependencies(CPU, FS);<br>
@@ -139,9 +134,8 @@ ARMSubtarget::ARMSubtarget(const Triple<br>
                            const std::string &FS,<br>
                            const ARMBaseTargetMachine &TM, bool IsLittle)<br>
     : ARMGenSubtargetInfo(TT, CPU, FS), UseMulOps(UseFusedMulOps),<br>
-      GenExecuteOnly(EnableExecuteOnly), CPUString(CPU), IsLittle(IsLittle),<br>
-      TargetTriple(TT), Options(TM.Options), TM(TM),<br>
-      FrameLowering(initializeFrameLowering(CPU, FS)),<br>
+      CPUString(CPU), IsLittle(IsLittle), TargetTriple(TT), Options(TM.Options),<br>
+      TM(TM), FrameLowering(initializeFrameLowering(CPU, FS)),<br>
       // At this point initializeSubtargetDependencies has been called so<br>
       // we can query directly.<br>
       InstrInfo(isThumb1Only()<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp?rev=306927&r1=306926&r2=306927&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp?rev=306927&r1=306926&r2=306927&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp (original)<br>
+++ llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp Fri Jun 30 19:55:22 2017<br>
@@ -32,7 +32,7 @@ void ARMElfTargetObjectFile::Initialize(<br>
                                         const TargetMachine &TM) {<br>
   const ARMBaseTargetMachine &ARM_TM = static_cast<const ARMBaseTargetMachine &>(TM);<br>
   bool isAAPCS_ABI = ARM_TM.TargetABI == ARMBaseTargetMachine::ARMABI::ARM_ABI_AAPCS;<br>
-  genExecuteOnly = ARM_TM.getSubtargetImpl()->genExecuteOnly();<br>
+  //  genExecuteOnly = ARM_TM.getSubtargetImpl()->genExecuteOnly();<br>
 <br>
   TargetLoweringObjectFileELF::Initialize(Ctx, TM);<br>
   InitializeELF(isAAPCS_ABI);<br>
@@ -43,16 +43,6 @@ void ARMElfTargetObjectFile::Initialize(<br>
 <br>
   AttributesSection =<br>
       getContext().getELFSection(".ARM.attributes", ELF::SHT_ARM_ATTRIBUTES, 0);<br>
-<br>
-  // Make code section unreadable when in execute-only mode<br>
-  if (genExecuteOnly) {<br>
-    unsigned  Type = ELF::SHT_PROGBITS;<br>
-    unsigned Flags = ELF::SHF_EXECINSTR | ELF::SHF_ALLOC | ELF::SHF_ARM_PURECODE;<br>
-    // Since we cannot modify flags for an existing section, we create a new<br>
-    // section with the right flags, and use 0 as the unique ID for<br>
-    // execute-only text<br>
-    TextSection = Ctx.getELFSection(".text", Type, Flags, 0, "", 0U);<br>
-  }<br>
 }<br>
 <br>
 const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(<br>
@@ -74,21 +64,27 @@ getDebugThreadLocalSymbol(const MCSymbol<br>
                                  getContext());<br>
 }<br>
 <br>
-MCSection *<br>
-ARMElfTargetObjectFile::getExplicitSectionGlobal(const GlobalObject *GO,<br>
-                                                 SectionKind SK, const TargetMachine &TM) const {<br>
+static bool isExecuteOnlyFunction(const GlobalObject *GO, SectionKind SK,<br>
+                                  const TargetMachine &TM) {<br>
+  if (const Function *F = dyn_cast<Function>(GO))<br>
+    if (TM.getSubtarget<ARMSubtarget>(*F).genExecuteOnly() && SK.isText())<br>
+      return true;<br>
+  return false;<br>
+}<br>
+<br>
+MCSection *ARMElfTargetObjectFile::getExplicitSectionGlobal(<br>
+    const GlobalObject *GO, SectionKind SK, const TargetMachine &TM) const {<br>
   // Set execute-only access for the explicit section<br>
-  if (genExecuteOnly && SK.isText())<br>
+  if (isExecuteOnlyFunction(GO, SK, TM))<br>
     SK = SectionKind::getExecuteOnly();<br>
 <br>
   return TargetLoweringObjectFileELF::getExplicitSectionGlobal(GO, SK, TM);<br>
 }<br>
 <br>
-MCSection *<br>
-ARMElfTargetObjectFile::SelectSectionForGlobal(const GlobalObject *GO,<br>
-                                               SectionKind SK, const TargetMachine &TM) const {<br>
+MCSection *ARMElfTargetObjectFile::SelectSectionForGlobal(<br>
+    const GlobalObject *GO, SectionKind SK, const TargetMachine &TM) const {<br>
   // Place the global in the execute-only text section<br>
-  if (genExecuteOnly && SK.isText())<br>
+  if (isExecuteOnlyFunction(GO, SK, TM))<br>
     SK = SectionKind::getExecuteOnly();<br>
 <br>
   return TargetLoweringObjectFileELF::SelectSectionForGlobal(GO, SK, TM);<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h?rev=306927&r1=306926&r2=306927&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h?rev=306927&r1=306926&r2=306927&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h (original)<br>
+++ llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.h Fri Jun 30 19:55:22 2017<br>
@@ -16,8 +16,6 @@<br>
 namespace llvm {<br>
 <br>
 class ARMElfTargetObjectFile : public TargetLoweringObjectFileELF {<br>
-  mutable bool genExecuteOnly = false;<br>
-<br>
 protected:<br>
   const MCSection *AttributesSection = nullptr;<br>
 <br>
<br>
Modified: llvm/trunk/test/CodeGen/ARM/constantfp.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/constantfp.ll?rev=306927&r1=306926&r2=306927&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/constantfp.ll?rev=306927&r1=306926&r2=306927&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/ARM/constantfp.ll (original)<br>
+++ llvm/trunk/test/CodeGen/ARM/constantfp.ll Fri Jun 30 19:55:22 2017<br>
@@ -5,25 +5,25 @@<br>
 ; RUN: llc -mtriple=thumbv7m -mcpu=cortex-m4 %s -o - \<br>
 ; RUN: | FileCheck --check-prefix=CHECK-NO-XO %s<br>
 <br>
-; RUN: llc -mtriple=thumbv7m -arm-execute-only -mcpu=cortex-m4 %s -o - \<br>
+; RUN: llc -mtriple=thumbv7m -mattr=+execute-only -mcpu=cortex-m4 %s -o - \<br>
 ; RUN: | FileCheck --check-prefix=CHECK-XO-FLOAT --check-prefix=CHECK-XO-DOUBLE %s<br>
 <br>
-; RUN: llc -mtriple=thumbv7meb -arm-execute-only -mcpu=cortex-m4 %s -o - \<br>
+; RUN: llc -mtriple=thumbv7meb -mattr=+execute-only -mcpu=cortex-m4 %s -o - \<br>
 ; RUN: | FileCheck --check-prefix=CHECK-XO-FLOAT --check-prefix=CHECK-XO-DOUBLE-BE %s<br>
 <br>
-; RUN: llc -mtriple=thumbv7m -arm-execute-only -mcpu=cortex-m4 -relocation-model=ropi %s -o - \<br>
+; RUN: llc -mtriple=thumbv7m -mattr=+execute-only -mcpu=cortex-m4 -relocation-model=ropi %s -o - \<br>
 ; RUN: | FileCheck --check-prefix=CHECK-XO-ROPI %s<br>
 <br>
 ; RUN: llc -mtriple=thumbv8m.main -mattr=fp-armv8 %s -o - \<br>
 ; RUN: | FileCheck --check-prefix=CHECK-NO-XO %s<br>
 <br>
-; RUN: llc -mtriple=thumbv8m.main -arm-execute-only -mattr=fp-armv8 %s -o - \<br>
+; RUN: llc -mtriple=thumbv8m.main -mattr=+execute-only -mattr=fp-armv8 %s -o - \<br>
 ; RUN: | FileCheck --check-prefix=CHECK-XO-FLOAT --check-prefix=CHECK-XO-DOUBLE %s<br>
 <br>
-; RUN: llc -mtriple=thumbv8m.maineb -arm-execute-only -mattr=fp-armv8 %s -o - \<br>
+; RUN: llc -mtriple=thumbv8m.maineb -mattr=+execute-only -mattr=fp-armv8 %s -o - \<br>
 ; RUN: | FileCheck --check-prefix=CHECK-XO-FLOAT --check-prefix=CHECK-XO-DOUBLE-BE %s<br>
 <br>
-; RUN: llc -mtriple=thumbv8m.main -arm-execute-only -mattr=fp-armv8 -relocation-model=ropi %s -o - \<br>
+; RUN: llc -mtriple=thumbv8m.main -mattr=+execute-only -mattr=fp-armv8 -relocation-model=ropi %s -o - \<br>
 ; RUN: | FileCheck --check-prefix=CHECK-XO-ROPI %s<br>
 <br>
 define arm_aapcs_vfpcc float @test_vmov_f32() {<br>
<br>
Modified: llvm/trunk/test/CodeGen/ARM/execute-only-big-stack-frame.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/execute-only-big-stack-frame.ll?rev=306927&r1=306926&r2=306927&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/execute-only-big-stack-frame.ll?rev=306927&r1=306926&r2=306927&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/ARM/execute-only-big-stack-frame.ll (original)<br>
+++ llvm/trunk/test/CodeGen/ARM/execute-only-big-stack-frame.ll Fri Jun 30 19:55:22 2017<br>
@@ -1,8 +1,8 @@<br>
-; RUN: llc < %s -mtriple=thumbv7m -arm-execute-only -O0 %s -o - \<br>
+; RUN: llc < %s -mtriple=thumbv7m -mattr=+execute-only -O0 %s -o - \<br>
 ; RUN:  | FileCheck --check-prefix=CHECK-SUBW-ADDW %s<br>
-; RUN: llc < %s -mtriple=thumbv8m.base -arm-execute-only -O0 %s -o - \<br>
+; RUN: llc < %s -mtriple=thumbv8m.base -mattr=+execute-only -O0 %s -o - \<br>
 ; RUN:  | FileCheck --check-prefix=CHECK-MOVW-MOVT-ADD %s<br>
-; RUN: llc < %s -mtriple=thumbv8m.main -arm-execute-only -O0 %s -o - \<br>
+; RUN: llc < %s -mtriple=thumbv8m.main -mattr=+execute-only -O0 %s -o - \<br>
 ; RUN:  | FileCheck --check-prefix=CHECK-SUBW-ADDW %s<br>
 <br>
 define i8 @test_big_stack_frame() {<br>
<br>
Modified: llvm/trunk/test/CodeGen/ARM/execute-only-section.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/execute-only-section.ll?rev=306927&r1=306926&r2=306927&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/execute-only-section.ll?rev=306927&r1=306926&r2=306927&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/ARM/execute-only-section.ll (original)<br>
+++ llvm/trunk/test/CodeGen/ARM/execute-only-section.ll Fri Jun 30 19:55:22 2017<br>
@@ -1,6 +1,6 @@<br>
-; RUN: llc < %s -mtriple=thumbv7m -arm-execute-only %s -o - | FileCheck %s<br>
-; RUN: llc < %s -mtriple=thumbv8m.base -arm-execute-only %s -o - | FileCheck %s<br>
-; RUN: llc < %s -mtriple=thumbv8m.main -arm-execute-only %s -o - | FileCheck %s<br>
+; RUN: llc < %s -mtriple=thumbv7m -mattr=+execute-only %s -o - | FileCheck %s<br>
+; RUN: llc < %s -mtriple=thumbv8m.base -mattr=+execute-only %s -o - | FileCheck %s<br>
+; RUN: llc < %s -mtriple=thumbv8m.main -mattr=+execute-only %s -o - | FileCheck %s<br>
 <br>
 ; CHECK:     .section .text,"axy",%progbits,unique,0<br>
 ; CHECK-NOT: .section<br>
<br>
Modified: llvm/trunk/test/CodeGen/ARM/execute-only.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/execute-only.ll?rev=306927&r1=306926&r2=306927&view=diff">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/execute-only.ll?rev=306927&r1=306926&r2=306927&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/ARM/execute-only.ll (original)<br>
+++ llvm/trunk/test/CodeGen/ARM/execute-only.ll Fri Jun 30 19:55:22 2017<br>
@@ -1,6 +1,6 @@<br>
-; RUN: llc -mtriple=thumbv8m.base-eabi -arm-execute-only %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-T2BASE %s<br>
-; RUN: llc -mtriple=thumbv7m-eabi      -arm-execute-only %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-T2 %s<br>
-; RUN: llc -mtriple=thumbv8m.main-eabi -arm-execute-only %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-T2 %s<br>
+; RUN: llc -mtriple=thumbv8m.base-eabi -mattr=+execute-only %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-T2BASE %s<br>
+; RUN: llc -mtriple=thumbv7m-eabi      -mattr=+execute-only %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-T2 %s<br>
+; RUN: llc -mtriple=thumbv8m.main-eabi -mattr=+execute-only %s -o - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-T2 %s<br>
 <br>
 @var = global i32 0<br>
 <br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
llvm-commits@lists.llvm.org<br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div>
</span></font></div>
</body>
</html>