ghc builds cbits with -fPIC even when -fPIC is not passed to ghc on linux
ghc assumes that on linux, C compiler (e.g. gcc) will build non-PIC object code when no -fPIC
is passed. But this is no longer true for recent gcc version on some distributions. e.g.
$ 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
We need pass -fno-PIC
explicitly just like we have done for -no-pie
(See #12759 (closed))
In particular, this results in 300+ ext-interp related tests to fail on i386 when built with a gcc that has -fPIC
on by default, as we don't support loading non-PIC .o built from .c on i386. (See #15847, fix this bug will mitigate #15847)