@@ -35,6 +35,7 @@ module Distribution.Simple.GHC.Internal
35
35
, substTopDir
36
36
, checkPackageDbEnvVar
37
37
, profDetailLevelFlag
38
+ , allGhcOptExtra
38
39
39
40
-- * GHC platform and version strings
40
41
, ghcArchString
@@ -377,6 +378,15 @@ includePaths lbi bi clbi odir =
377
378
| dir <- mapMaybe (symbolicPathRelative_maybe . unsafeCoerceSymbolicPath) $ includeDirs bi
378
379
]
379
380
381
+ allGhcOptExtra :: BuildInfo -> [String ]
382
+ allGhcOptExtra bi =
383
+ [" -optP" ++ opt | opt <- cppOptions bi]
384
+ ++ [" -optc" ++ opt | opt <- ccOptions bi]
385
+ ++ [" -optcxx" ++ opt | opt <- cxxOptions bi]
386
+ ++ [" -opta" ++ opt | opt <- asmOptions bi]
387
+ ++ [" -optl" ++ opt | opt <- ldOptions bi]
388
+ ++ [" -optJSP" ++ opt | opt <- jsppOptions bi]
389
+
380
390
componentCcGhcOptions
381
391
:: Verbosity
382
392
-> LocalBuildInfo
@@ -413,7 +423,7 @@ componentCcGhcOptions verbosity lbi bi clbi odir filename =
413
423
programPath
414
424
<$> lookupProgram gccProgram (withPrograms lbi)
415
425
, ghcOptObjDir = toFlag odir
416
- , ghcOptExtra = hcOptions GHC bi
426
+ , ghcOptExtra = allGhcOptExtra bi <> hcOptions GHC bi
417
427
}
418
428
419
429
componentCxxGhcOptions
@@ -452,7 +462,7 @@ componentCxxGhcOptions verbosity lbi bi clbi odir filename =
452
462
programPath
453
463
<$> lookupProgram gccProgram (withPrograms lbi)
454
464
, ghcOptObjDir = toFlag odir
455
- , ghcOptExtra = hcOptions GHC bi
465
+ , ghcOptExtra = allGhcOptExtra bi <> hcOptions GHC bi
456
466
}
457
467
458
468
componentAsmGhcOptions
@@ -487,7 +497,7 @@ componentAsmGhcOptions verbosity lbi bi clbi odir filename =
487
497
)
488
498
++ asmOptions bi
489
499
, ghcOptObjDir = toFlag odir
490
- , ghcOptExtra = hcOptions GHC bi
500
+ , ghcOptExtra = allGhcOptExtra bi <> hcOptions GHC bi
491
501
}
492
502
493
503
componentJsGhcOptions
@@ -511,7 +521,7 @@ componentJsGhcOptions verbosity lbi bi clbi odir filename =
511
521
, ghcOptPackageDBs = withPackageDB lbi
512
522
, ghcOptPackages = toNubListR $ mkGhcOptPackages (promisedPkgs lbi) clbi
513
523
, ghcOptObjDir = toFlag odir
514
- , ghcOptExtra = hcOptions GHC bi
524
+ , ghcOptExtra = allGhcOptExtra bi <> hcOptions GHC bi
515
525
}
516
526
517
527
componentGhcOptions
@@ -581,7 +591,7 @@ componentGhcOptions verbosity lbi bi clbi odir =
581
591
, ghcOptOutputDir = toFlag $ coerceSymbolicPath odir
582
592
, ghcOptOptimisation = toGhcOptimisation (withOptimization lbi)
583
593
, ghcOptDebugInfo = toFlag (withDebugInfo lbi)
584
- , ghcOptExtra = hcOptions GHC bi
594
+ , ghcOptExtra = allGhcOptExtra bi <> hcOptions GHC bi
585
595
, ghcOptExtraPath = toNubListR exe_paths
586
596
, ghcOptLanguage = toFlag (fromMaybe Haskell98 (defaultLanguage bi))
587
597
, -- Unsupported extensions have already been checked by configure
@@ -626,7 +636,7 @@ componentCmmGhcOptions verbosity lbi bi clbi odir filename =
626
636
, ghcOptPackages = toNubListR $ mkGhcOptPackages (promisedPkgs lbi) clbi
627
637
, ghcOptOptimisation = toGhcOptimisation (withOptimization lbi)
628
638
, ghcOptDebugInfo = toFlag (withDebugInfo lbi)
629
- , ghcOptExtra = hcOptions GHC bi <> cmmOptions bi
639
+ , ghcOptExtra = allGhcOptExtra bi <> hcOptions GHC bi <> cmmOptions bi
630
640
, ghcOptObjDir = toFlag odir
631
641
}
632
642
0 commit comments