import UniqFM ( eltsUFM )
import ErrUtils
import DynFlags
-import StaticFlags ( v_Ld_inputs, opt_Static, WayName(..) )
+import StaticFlags ( v_Ld_inputs, opt_PIC, opt_Static, WayName(..) )
import Config
import Panic
import Util
#else
let nphase = As
#endif
+ let rmodel | opt_PIC = "pic"
+ | not opt_Static = "dynamic-no-pic"
+ | otherwise = "static"
output_fn <- get_output_fn dflags nphase maybe_loc
SysTools.runLlvmLlc dflags
([ SysTools.Option (llvmOpts !! opt_lvl),
+ SysTools.Option $ "-relocation-model=" ++ rmodel,
SysTools.FileOption "" input_fn,
SysTools.Option "-o", SysTools.FileOption "" output_fn]
++ map SysTools.Option lc_opts)
-- unless there is no NCG on this platform. The latter case is
-- checked when the -fPIC flag is parsed.
--
- let (pic_warns, dflags2) =
- if opt_PIC && hscTarget dflags1 == HscC && cGhcUnregisterised == "NO"
- then ([L noSrcSpan $ "Warning: -fvia-C is incompatible with -fPIC; ignoring -fvia-C"],
+ let (pic_warns, dflags2)
+ | opt_PIC && hscTarget dflags1 == HscC && cGhcUnregisterised == "NO"
+ = ([L noSrcSpan $ "Warning: -fvia-C is incompatible with -fPIC; ignoring -fvia-C"],
dflags1{ hscTarget = HscAsm })
- else ([], dflags1)
+#if !(x86_64_TARGET_ARCH && linux_TARGET_OS)
+ | (not opt_Static || opt_PIC) && hscTarget dflags1 == HscLlvm
+ = ([L noSrcSpan $ "Warning: -fllvm is incompatible with -fPIC and -dynamic on this"
+ ++ "platform; ignoring -fllvm"], dflags1{ hscTarget = HscAsm })
+#endif
+ | otherwise = ([], dflags1)
return (dflags2, leftover, pic_warns ++ warns)