[GHC] #12759: Latest Debian GCC breaks GHC

GHC ghc-devs at haskell.org
Sun Oct 30 04:27:39 UTC 2016


#12759: Latest Debian GCC breaks GHC
-----------------------------+----------------------------------------
        Reporter:  erikd     |                Owner:
            Type:  bug       |               Status:  new
        Priority:  normal    |            Milestone:  8.0.2
       Component:  Compiler  |              Version:  8.0.1
      Resolution:            |             Keywords:
Operating System:  Linux     |         Architecture:  Unknown/Multiple
 Type of failure:  Other     |            Test Case:
      Blocked By:            |             Blocking:
 Related Tickets:            |  Differential Rev(s):
       Wiki Page:            |
-----------------------------+----------------------------------------

Comment (by erikd):

 The Debian package for GHC 8.0 now carries two patches:
 {{{
 --- a/compiler/main/DynFlags.hs
 +++ b/compiler/main/DynFlags.hs
 @@ -3631,14 +3631,8 @@
  default_PIC :: Platform -> [GeneralFlag]
  default_PIC platform =
    case (platformOS platform, platformArch platform) of
 -    (OSDarwin, ArchX86_64) -> [Opt_PIC]
 -    (OSOpenBSD, ArchX86_64) -> [Opt_PIC] -- Due to PIE support in
 -                                         -- OpenBSD since 5.3 release
 -                                         -- (1 May 2013) we need to
 -                                         -- always generate PIC. See
 -                                         -- #10597 for more
 -                                         -- information.
 -    _                      -> []
 +    (OSLinux, ArchPPC)     -> []
 +    _                      -> [Opt_PIC]

  -- General flags that are switched on/off when other general flags are
 switched
  -- on
 }}}
 and
 {{{
 Description: Pass -no-pie along with -Wl,-r
  GHC uncoditionally passes `-Wl,-r' to gcc in
 `compiler/main/DriverPipeline.hs'.
  This fails in cases where PIE is enabled by default with the following
 error:
  .
    /usr/bin/ld: -r and -pie may not be used together
  .
  Fix the above error by passing `-no-pie' along with `-Wl,-r' to the
 compiler.
 Author: Ilias Tsitsimpis <i.tsitsimpis at gmail.com>
 Bug: https://ghc.haskell.org/trac/ghc/ticket/11834
 Bug-Debian: https://bugs.debian.org/712228
 Forwarded: no

 Index: b/compiler/main/DriverPipeline.hs
 ===================================================================
 --- a/compiler/main/DriverPipeline.hs
 +++ b/compiler/main/DriverPipeline.hs
 @@ -2145,7 +2145,8 @@ joinObjectFiles dflags o_files output_fn
        osInfo = platformOS (targetPlatform dflags)
        ld_r args cc = SysTools.runLink dflags ([
                         SysTools.Option "-nostdlib",
 -                       SysTools.Option "-Wl,-r"
 +                       SysTools.Option "-Wl,-r",
 +                       SysTools.Option "-no-pie"
                       ]
                       ++ (if any (cc ==) [Clang, AppleClang, AppleClang51]
                            then []

 }}}
 Obviously these patches, in their current state, are not suitable for
 inclusion in GHC. It looks like the use of PIC and PIE needs to be
 detected at configure/compile time.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12759#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list