Skip to content

feat(Cabal): Always pass -pgml to GHC so that linking uses the toolchain Cabal resolved - #12322

Closed
zlonast wants to merge 8 commits into
haskell:masterfrom
zlonast:zlonast/pgml-option
Closed

feat(Cabal): Always pass -pgml to GHC so that linking uses the toolchain Cabal resolved#12322
zlonast wants to merge 8 commits into
haskell:masterfrom
zlonast:zlonast/pgml-option

Conversation

@zlonast

@zlonast zlonast commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Main idea #9801 (comment)

IMHO, cc-options (and ld-options and cpp-options and ...) should be always passed when invoking GHC, similarly as ghc-options should be always used when invoking ghc - regardless of what is the intention of a particular GHC-call. GHC might use or not use the options, Cabal cannot know and should not guess.

  $ cabal build -v3 --with-gcc=$PWD/my-cc-wrapper.sh
  Running: ghc ... -pgmc $PWD/my-cc-wrapper.sh -pgmcxx /usr/bin/g++ ...
- ... link driven by the C compiler from GHC's settings ...
+ Running: ghc ... -pgmc $PWD/my-cc-wrapper.sh -pgmcxx /usr/bin/g++
+          -pgml $PWD/my-cc-wrapper.sh -pgml-supports-no-pie ...

Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

@zlonast
zlonast force-pushed the zlonast/pgml-option branch from 98a6035 to 9a079d9 Compare September 6, 2026 10:47
@zlonast zlonast added attention: needs-review re: ghc-options Concerning passing options to GHC labels Sep 6, 2026
@TeofilC

TeofilC commented Sep 7, 2026

Copy link
Copy Markdown
Member

Perhaps @MangoIV has an opinion since he's been working on the linker selection stuff in GHC recently

@MangoIV

MangoIV commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

In my opinion, this is not the correct way to do it. GHC bindists should be configured to use a specific C toolchain. A user will inevitably make subtly wrong choices here, that's why we have the configure script.

@MangoIV

MangoIV commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

In my opinion, cabal should ask GHC what toolchain it was configured with and then use that, instead of the other way around.

@MangoIV

MangoIV commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

This already makes sense if you consider that GHC compiled for some specific backend will not even be able to respect toolchain options found by cabal, e.g. a ghc targeting the JS backend will need the emscripten toolchain.

@zlonast

zlonast commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

@MangoIV As I understand it, we first need to decide how to interact correctly after configuration: #12332

@zlonast

zlonast commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

Also, as I understand it, the -pgml flag should be deprecated, since it has no meaning after configuration?

@zlonast

zlonast commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

I'm closing in favor #12333

@zlonast zlonast closed this Sep 8, 2026
@zlonast
zlonast deleted the zlonast/pgml-option branch September 8, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attention: needs-review re: ghc-options Concerning passing options to GHC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants