turn off executable stack flag in executables (#973512)

- reported by Dhiru Kholia
- upstream patch by Edward Zhang:
  see http://ghc.haskell.org/trac/ghc/ticket/703 and
  08a38628f2
- this affects both ghc 7.4 and 7.6
This commit is contained in:
Jens Petersen 2013-07-10 11:07:23 +09:00
parent 3c760a9a18
commit 4e3e8f4b7c
2 changed files with 41 additions and 4 deletions

View File

@ -0,0 +1,32 @@
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

View File

@ -29,7 +29,7 @@ Version: 7.6.3
# - release can only be reset if *all* library versions get bumped simultaneously
# (sometimes after a major release)
# - minor release numbers for a branch should be incremented monotonically
Release: 14%{?dist}
Release: 15%{?dist}
Summary: Glasgow Haskell Compiler
License: %BSDHaskellReport
@ -52,6 +52,8 @@ Patch10: ghc-wrapper-libffi-include.patch
Patch12: ghc-7.4.2-Cabal-disable-ghci-libs.patch
# fix compilation with llvm-3.3
Patch13: ghc-llvmCodeGen-empty-array.patch
# disable executable stack
Patch14: ghc-NCG-no-execstack.patch
# fedora ghc has been bootstrapped on
# %{ix86} x86_64 ppc alpha sparcv9 ppc64 armv7hl armv5tel s390 s390x
@ -224,8 +226,8 @@ ln -s $(pkg-config --variable=includedir libffi)/*.h rts/dist/build
%endif
%patch12 -p1 -b .orig
%patch13 -p1 -b .orig
%patch14 -p1 -b .orig
%build
@ -439,6 +441,10 @@ fi
%changelog
* Wed Jul 10 2013 Jens Petersen <petersen@redhat.com> - 7.6.3-15
- turn off executable stack flag in executables (#973512)
(thanks Edward Zhang for upstream patch and Dhiru Kholia for report)
* Tue Jun 25 2013 Jens Petersen <petersen@redhat.com> - 7.6.3-14
- fix compilation with llvm-3.3 (#977652)
see http://hackage.haskell.org/trac/ghc/ticket/7996
@ -453,8 +459,7 @@ fi
* Thu Jun 20 2013 Jens Petersen <petersen@redhat.com> - 7.6.3-12
- bootstrap 7.6.3
- all library versions bumped except pretty
- Cabal-fix-dynamic-exec-for-TH.patch,
ghc-7.4-add-support-for-ARM-hard-float-ABI-fixes-5914.patch, and
- ghc-7.4-add-support-for-ARM-hard-float-ABI-fixes-5914.patch, and
ghc-7.4-silence-gen_contents_index.patch are no longer needed
- build with ghc-rpm-macros-extra
- no longer filter type-level package from haddock index