[GHC] #15848: ghc builds cbits with -fPIC even when -fPIC is not passed to ghc on linux
GHC
ghc-devs at haskell.org
Tue Dec 11 23:21:06 UTC 2018
#15848: ghc builds cbits with -fPIC even when -fPIC is not passed to ghc on linux
-------------------------------------+-------------------------------------
Reporter: watashi | Owner: watashi
Type: bug | Status: new
Priority: normal | Milestone:
Component: Driver | Version: 8.7
Resolution: | Keywords:
Operating System: Linux | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #15847, #12759 | Differential Rev(s): Phab:D5288
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari <ben@…>):
In [changeset:"c98e25a4de88f12c6ded0a97fcf3ed8f4996b9ea/ghc"
c98e25a4/ghc]:
{{{
#!CommitTicketReference repository="ghc"
revision="c98e25a4de88f12c6ded0a97fcf3ed8f4996b9ea"
Explicitly pass -fno-PIC to C compiler on linux
Recent gcc on some linux ditributions may have -fPIC on by default
```
$ uname -a
Linux watashi-arch32 4.18.5-arch1-1.0-ARCH #1 SMP PREEMPT Tue Aug 28
20:45:30 CEST 2018 i686 GNU/Linux
$ gcc --version
gcc (GCC) 7.3.1 20180312
$ touch dummy.c
$ gcc -Q -v dummy.c 2>&1 | grep PIC
options enabled: -fPIC -fPIE -faggressive-loop-optimizations
```
This results in following error for i686:
```
$ TEST=T13366 make test
...
c-iserv.bin:
/home/watashi/github/ghc/libraries/ghc-prim/dist-install/build/HSghc-pri
m-0.5.3.o:
unknown symbol `_GLOBAL_OFFSET_TABLE_'
ghc-stage2: unable to load package `ghc-prim-0.5.3'
...
```
As our runtime linker doesn't support R_386_GOTPC relocations at all
(#15847).
Also while we don't have such problem on x86_64, it's not desired to
build PIC objects either.
Test Plan: `TEST=T13366 make test` passed on
{rGHC82a716431cc680392e332bc2b1a1fd0d7faa4cd8}
Reviewers: simonmar, bgamari, austin
Reviewed By: simonmar
Subscribers: rwbarton, carter
GHC Trac Issues: #15848
Differential Revision: https://phabricator.haskell.org/D5288
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15848#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list