Skip to content

Remove LLVM/-fPIC check in DynFlags

When the LLVM backend was first implemented the implementation did not support -fPIC or -dynamic. Support for this was added in 60873542, which merely added the appropriate -relocation-model flag to the opt command line when compiling with -fPIC. However, the error message in DynFlags.makeDynFlagsConsistent remains for all but a select few platforms,

 | hscTarget dflags == HscLlvm &&
   not ((arch == ArchX86_64) && (os == OSLinux || os == OSDarwin || os == OSFreeBSD)) &&
   not ((isARM arch) && (os == OSLinux)) &&
   (gopt Opt_PIC dflags || WayDyn `elem` ways dflags)
    = if cGhcWithNativeCodeGen == "YES"
      then let dflags' = dflags { hscTarget = HscAsm }
               warn = "Using native code generator rather than LLVM, as LLVM is incompatible with -fPIC and -dynamic on this platform"
           in loop dflags' warn
      else throwGhcException $ CmdLineError "Can't use -fPIC or -dynamic on this platform"

Is this still necessary? If so, why? If not, we should remove it.

Trac metadata
Trac field Value
Version 8.0.1
Type Task
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (LLVM)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information