1086f85
From 08a38628f29df63ac842f4d083efb414f42d7bff Mon Sep 17 00:00:00 2001
1086f85
From: "Edward Z. Yang" <ezyang@mit.edu>
1086f85
Date: Tue, 9 Jul 2013 00:01:43 -0700
1086f85
Subject: [PATCH] Disable executable stack for the linker note, fixing #703
1086f85
 (again)
1086f85
1086f85
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
1086f85
---
1086f85
 compiler/main/DriverPipeline.hs | 12 +++++++++++-
1086f85
 1 file changed, 11 insertions(+), 1 deletion(-)
1086f85
1086f85
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
1086f85
index 67377e6..26425ae 100644
1086f85
--- a/compiler/main/DriverPipeline.hs
1086f85
+++ b/compiler/main/DriverPipeline.hs
1086f85
@@ -1640,7 +1640,17 @@ mkNoteObjsToLinkIntoBinary dflags dep_packages = do
1086f85
                                    text elfSectionNote,
1086f85
                                    text "\n",
1086f85
 
1086f85
-          text "\t.ascii \"", info', text "\"\n" ]
1086f85
+          text "\t.ascii \"", info', text "\"\n",
1086f85
+
1086f85
+          -- ALL generated assembly must have this section to disable
1086f85
+          -- executable stacks.  See also
1086f85
+          -- compiler/nativeGen/AsmCodeGen.lhs for another instance
1086f85
+          -- where we need to do this.
1086f85
+          (if platformHasGnuNonexecStack (targetPlatform dflags)
1086f85
+           then text ".section .note.GNU-stack,\"\",@progbits\n"
1086f85
+           else empty)
1086f85
+
1086f85
+           ]
1086f85
           where
1086f85
             info' = text $ escape info
1086f85
 
1086f85
-- 
1086f85
1.8.1.2
1086f85