-fPIC without -dynamic silently ignored
$ ghc -fPIC -c -o TestF.o TestF.hs
$ ghc -shared -dynamic TestF.so TestF.o
/usr/bin/ld: TestF.o: relocation R_X86_64_PC32 against undefined symbol `stg_CAF_BLACKHOLE_info'
can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
$ ghc -fPIC -dynamic -c -o TestF.o TestF.hs
$ ghc -shared -dynamic TestF.so TestF.o
$
If you attempt to use -fPIC without -dynamic, then you get non-PIC code in the .o file. This behaviour is surprising and quite useless.
Trac metadata
| Trac field | Value |
|---|---|
| Version | |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |