summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Driver/Main.hs')
-rw-r--r--compiler/GHC/Driver/Main.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs
index 175a78962e..5f22840395 100644
--- a/compiler/GHC/Driver/Main.hs
+++ b/compiler/GHC/Driver/Main.hs
@@ -1970,7 +1970,7 @@ hscCompileCmmFile hsc_env original_filename filename output_filename = runHsc hs
mod_name = mkModuleName $ "Cmm$" ++ original_filename
cmm_mod = mkHomeModule home_unit mod_name
cmmpConfig = initCmmParserConfig dflags
- (cmm, ents) <- ioMsgMaybe
+ (cmm, ipe_ents) <- ioMsgMaybe
$ do
(warns,errs,cmm) <- withTiming logger (text "ParseCmm"<+>brackets (text filename)) (\_ -> ())
$ parseCmmFile cmmpConfig cmm_mod home_unit filename
@@ -1996,10 +1996,11 @@ hscCompileCmmFile hsc_env original_filename filename output_filename = runHsc hs
Nothing -> cmmToRawCmm logger profile (Stream.yield cmmgroup)
Just h -> h dflags Nothing (Stream.yield cmmgroup)
- let foreign_stubs _ =
- let ip_init = ipInitCode do_info_table platform cmm_mod ents
- in NoStubs `appendStubC` ip_init
-
+ let foreign_stubs _
+ | not $ null ipe_ents =
+ let ip_init = ipInitCode do_info_table platform cmm_mod
+ in NoStubs `appendStubC` ip_init
+ | otherwise = NoStubs
(_output_filename, (_stub_h_exists, stub_c_exists), _foreign_fps, _caf_infos)
<- codeOutput logger tmpfs llvm_config dflags (hsc_units hsc_env) cmm_mod output_filename no_loc foreign_stubs [] S.empty
rawCmms