Skip to content

Commit f647502

Browse files
authored
Merge pull request #10994 from mpickering/wip/profDyn
cabal-install: dynExe+profExe requires prof+dyn
2 parents f257979 + cffc0a1 commit f647502

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

Cabal/src/Distribution/Simple/Compiler.hs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,13 @@ profilingVanillaSupported comp = waySupported "p" comp
509509

510510
-- | Is the compiler distributed with profiling dynamic libraries
511511
profilingDynamicSupported :: Compiler -> Maybe Bool
512-
profilingDynamicSupported comp =
513-
-- Certainly not before this version, as it was not implemented yet.
514-
if compilerVersion comp <= mkVersion [9, 11, 0]
515-
then Just False
516-
else waySupported "p_dyn" comp
512+
profilingDynamicSupported comp
513+
| GHC <- compilerFlavor comp
514+
, -- Certainly not before 9.11, as prof+dyn was not implemented yet.
515+
compilerVersion comp <= mkVersion [9, 11, 0] =
516+
Just False
517+
| otherwise =
518+
waySupported "p_dyn" comp
517519

518520
-- | Either profiling dynamic is definitely supported or we don't know (so assume
519521
-- it is)

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,10 +2316,15 @@ elaborateInstallPlan
23162316
{ withVanillaLib = perPkgOptionFlag pkgid True packageConfigVanillaLib -- TODO: [required feature]: also needs to be handled recursively
23172317
, withSharedLib = canBuildSharedLibs && pkgid `Set.member` pkgsUseSharedLibrary
23182318
, withStaticLib = perPkgOptionFlag pkgid False packageConfigStaticLib
2319-
, withDynExe = perPkgOptionFlag pkgid False packageConfigDynExe
2319+
, withDynExe =
2320+
perPkgOptionFlag pkgid False packageConfigDynExe
2321+
-- We can't produce a dynamic executable if the user
2322+
-- wants to enable executable profiling but the
2323+
-- compiler doesn't support prof+dyn.
2324+
&& (okProfDyn || not profExe)
23202325
, withFullyStaticExe = perPkgOptionFlag pkgid False packageConfigFullyStaticExe
23212326
, withGHCiLib = perPkgOptionFlag pkgid False packageConfigGHCiLib -- TODO: [required feature] needs to default to enabled on windows still
2322-
, withProfExe = perPkgOptionFlag pkgid False packageConfigProf
2327+
, withProfExe = profExe
23232328
, withProfLib = canBuildProfilingLibs && pkgid `Set.member` pkgsUseProfilingLibrary
23242329
, withProfLibShared = canBuildProfilingSharedLibs && pkgid `Set.member` pkgsUseProfilingLibraryShared
23252330
, exeCoverage = perPkgOptionFlag pkgid False packageConfigCoverage
@@ -2334,6 +2339,8 @@ elaborateInstallPlan
23342339
, withProfLibDetail = elabProfExeDetail
23352340
, withProfExeDetail = elabProfLibDetail
23362341
}
2342+
okProfDyn = profilingDynamicSupportedOrUnknown compiler
2343+
profExe = perPkgOptionFlag pkgid False packageConfigProf
23372344

23382345
( elabProfExeDetail
23392346
, elabProfLibDetail

0 commit comments

Comments
 (0)