Using `-pgmc` drops the `-no-pie` flag causing link failure
Summary
Using -pgmc
drops the -no-pie
flag causing link failure
Steps to reproduce
$ echo 'main = putStrLn "Hello world!"' > test.hs
$ ghc --make -pgmc gcc test.hs
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...
/usr/bin/ld: test.o: relocation R_X86_64_32S against symbol `stg_bh_upd_frame_info' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /tmp/ghc58_0/ghc_5.o: relocation R_X86_64_32 against symbol `ZCMain_main_closure' can not be used when making a PIE object; recompile with -fPIC
[...]
Expected behavior
Since gcc is the default C compiler I'd expect -pgmc gcc
to change nothing and just work.
Environment
- GHC versions used: 8.8.1-8.8.3 (from hvr's PPA)
- Operating System: Ubuntu 18.04
- System Architecture: x86-64
More details
This example of a simplification of a real built failure with bsc at: https://github.com/B-Lang-org/bsc/issues/109#issuecomment-597215464
Seems I've stumbled into the opposite of #15319 (closed)
My compiler needs the -no-pie
for ghc to work correctly.