ghc/ghc-NCG-no-execstack.patch

33 lines
1.2 KiB
Diff

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