diff --git a/ghc/Main.hs b/ghc/Main.hs index 730a614839b4321a6ca0f13742f10009a6bf77a0..5f17f24cc853968e7873cc92974c3d56fbed0af2 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -224,9 +224,26 @@ main' postLoadMode units dflags0 args flagWarnings = do -- The rest of the arguments are "dynamic" -- Leftover ones are presumably files - (dflags3, fileish_args, dynamicFlagWarnings) <- + (dflags3', fileish_args, dynamicFlagWarnings) <- GHC.parseDynamicFlags logger2 dflags2 args' + -- When we do ghci, force using dyn ways if the target RTS linker + -- only supports dynamic code + let dflags3 + | LinkInMemory <- link, + sTargetRTSLinkerOnlySupportsSharedLibs $ settings dflags3' + = setDynamicNow $ + -- See checkOptions below, -fexternal-interpreter is + -- required when using --interactive with a non-standard + -- way (-prof, -static, or -dynamic). + setGeneralFlag' Opt_ExternalInterpreter $ + -- Use .o for dynamic object, otherwise it gets dropped + -- with "Warning: ignoring unrecognised input", see + -- objish_suffixes + dflags3' { dynObjectSuf_ = objectSuf dflags3' } + | otherwise + = dflags3' + let dflags4 = if backendNeedsFullWays bcknd && not (gopt Opt_ExternalInterpreter dflags3) then