[GHC] #12755: Build from source fails on Ubuntu 16.10: ld: -r and -pie may not be used together
GHC
ghc-devs at haskell.org
Thu Nov 10 20:57:55 UTC 2016
#12755: Build from source fails on Ubuntu 16.10: ld: -r and -pie may not be used
together
-------------------------------------+-------------------------------------
Reporter: SamuelMarks | Owner:
Type: bug | Status: closed
Priority: high | Milestone: 8.0.2
Component: Build System | Version: 8.0.1
Resolution: duplicate | Keywords:
Operating System: Linux | Architecture: x86_64
Type of failure: Building GHC | (amd64)
failed | Test Case:
Blocked By: | Blocking:
Related Tickets: #12759 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by bgamari):
* status: new => closed
* resolution: => duplicate
* related: => #12759
* milestone: => 8.0.2
Comment:
The problem here is that we pass `-Wl,-r` to `gcc` when joining object
files and linking libraries. This is incompatible with the implicit `-pie`
which the affected gcc versions assume. It turns out that GCC 6 has a `-r`
flag which we could use in place of `-Wl,-r` and would do the right thing.
Unfortunately it is undocumented so I'm rather reluctant to depend upon
it.
Really I suspect the correct solution here is to simply use `ld` directly
for everything except for the final link (since linking an executable will
likely require linking against `libgcc`). However, this is out of scope
for 8.0.2.
Consequently, I think the next best solution is to simply ensure we pass
`-no-pie` to `gcc` when we do not intend on linking an executable. I have
done exactly this in Phab:D2691 which has been merged to `master`
(bae4a55b1fb403f610b4b55a1b6fb3f03e9c2026) and `ghc-8.0` ().
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12755#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list