Skip to content

Adding an explicit pgmc flag for interaction with GHC#11713

Open
zlonast wants to merge 1 commit intohaskell:masterfrom
zlonast:zlonast/pgmc-option
Open

Adding an explicit pgmc flag for interaction with GHC#11713
zlonast wants to merge 1 commit intohaskell:masterfrom
zlonast:zlonast/pgmc-option

Conversation

@zlonast
Copy link
Copy Markdown
Collaborator

@zlonast zlonast commented Apr 7, 2026

Issue #11712
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.

Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

@zlonast zlonast force-pushed the zlonast/pgmc-option branch from d777763 to ea2ac23 Compare April 7, 2026 15:45
@zlonast zlonast force-pushed the zlonast/pgmc-option branch 6 times, most recently from f101073 to 7e400d4 Compare April 8, 2026 07:07
@zlonast zlonast changed the title GHC 9.2.x: Linking error when using -pgmc (PIE/relocation failure) Adding an explicit pgmc flag for interaction with GHC Apr 8, 2026
@zlonast zlonast force-pushed the zlonast/pgmc-option branch 2 times, most recently from fbec784 to 250c39d Compare April 9, 2026 15:43
@zlonast
Copy link
Copy Markdown
Collaborator Author

zlonast commented Apr 9, 2026

I found out why it started working and why it didn't work before.

Since 9.4 it works like this:
https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6949

  , make_ord_flag defFlag "pgmc"
      $ hasArg $ \f -> alterToolSettings $ \s -> s { toolSettings_pgm_c   = f }

From 8.8 to 9.2 it worked like this:
https://gitlab.haskell.org/ghc/ghc/-/issues/17919

  , make_ord_flag defFlag "pgmc"
      $ hasArg $ \f -> alterToolSettings $ \s -> s
         { toolSettings_pgm_c   = f
         , -- Don't pass -no-pie with -pgmc
           -- (see #15319)
           toolSettings_ccSupportsNoPie = False
         }

This didn't work before 8.8:
https://gitlab.haskell.org/ghc/ghc/-/issues/17919

@zlonast zlonast force-pushed the zlonast/pgmc-option branch from 250c39d to e929e22 Compare April 9, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant