| Summary: | libs built by >=dev-lang/ghc-6.10 are built pie-enabled under hardened gentoo. | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Hongjiu Zhang <voidprayer> |
| Component: | Current packages | Assignee: | Gentoo's Haskell Language team <haskell> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | High | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Attachments: |
fixed ebuild
new ebuild 6.12's edition. |
||
|
Description
Hongjiu Zhang
2009-11-11 10:47:56 UTC
Upstream bug: http://hackage.haskell.org/trac/ghc/ticket/3668 Created attachment 211342 [details]
fixed ebuild
Add a sed to fix ghc.wrapper in order to enable buildin-time cflags and ldflags for finally ghc. The trick is in ghc-6.6 and ghc-6.8, but not in 6.10.
diff to show the change:
@@ -1,6 +1,6 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-6.10.4.ebuild,v 1.4 2009/09/16 06:50:28 kolmodin Exp $
+# $Header: $
# Brief explanation of the bootstrap logic:
#
@@ -171,6 +171,10 @@
|| die "Relocating ghc from /usr to workdir failed"
fi
+ # Modify the ghc driver script to use GHC_CFLAGS
+ sed -i -e "s|wrapped|wrapped ${GHC_CFLAGS}|" \
+ "${S}/ghc/ghc.wrapper"
+
# Hack to prevent haddock being installed, remove when ./configure
# supports something better to not build docs or haddock.
sed -i -e 's/DO_NOT_INSTALL =/DO_NOT_INSTALL = haddock/' \
New ebuild should fixed the problem. Already tested on Hardened and build yi correctly. I think it won't break other packages but I am not sure. At least my system is okay. Thanks to ivanm, trofi^w, dcoutts and igloo for help. Hope this bug solved. Created attachment 211394 [details]
new ebuild
Sorry, remove the ppc64 patch as the parameter is already in GHC_FLAGS.
Created attachment 211406 [details]
6.12's edition.
So GHC was able to build itself successfully, but then you had trouble to actually use it to compile things. I see we had a similar solution earlier, in ghc 6.6.1 and 6.8.3, sorry for your troubles. I'll get it tested on my machine too, and then get it committed. I'm sure you fixed a lot of other issues as well with your patch, thanks! I don't know whether it is posibble to add a new variable in make.conf called HSFLAGS for Haskell. Imho flags about arches should be portage-only settings and never affect users' compiling.
Since the wrapper script works like gcc's specs to set up the default behaviour of ghc, while specs have many things to do with hardened stuff, we can put some flags like "-optl-nopie" in it; however, maybe we should not add things like "-optc-march" or "-optc-pipe" in the script, which is not set in gcc's specs but CFLAGS. This might be hard, and associated with Portage devs.
Or maybe we can add some functions to haskell.eclass. They can dynamically create a list of flags according to the current portage settings. While building haskell packages, these flags are applied, while users' own compiling won't use it.
Some suggestions. :)
Thanks.
Fixed and committed to portage. Please reopen if it did not fix the issue. (In reply to comment #7) > Or maybe we can add some functions to haskell.eclass. They can dynamically > create a list of flags according to the current portage settings. While > building haskell packages, these flags are applied, while users' own compiling > won't use it. Usually you set the flags once and don't change them. Most of the flags are dropped anyway, we just want the arch and ABI flags. Those remain constant with your system. Many other flags makes ghc break in various ways. Thanks again! |