Skip to content

Draft: Adding -rpath to GHC

Rodrigo Mesquita requested to merge wip/romes/rpath-flag into master
Introduces a list flag `-rpath` for users to specify runtime library
search paths where GHC's linker invocations will look for libraries at
load time.

Previously, clients (notably Cabal) would add specify runtime search
paths directly to the linker via @-optl-Wl,-rpath,/actual/path@,
bypassing the compiler abstraction and the special logic GHC has to
handle runtime search paths -- that is especially important on macOS (4ff9329224).

Additionally, this enables a better solution for cabal#7339, for the
above reasons.

@bgamari I'd appreciate if you could double check I'm doing the right thing in loadCmdLineLibs''. I've also added a TODO:QUESTION for something I don't know. Missing a test case and release notes.

  • if your MR may break existing programs (e.g. touches base or causes the compiler to reject programs), please describe the expected breakage and add the user-facing label. This will run ghc/head.hackage> to characterise the effect of your change on Hackage.
  • ensure that your commits are either individually buildable or squashed
  • ensure that your commit messages describe what they do (referring to tickets using #NNNN syntax when appropriate)
  • have added source comments describing your change. For larger changes you likely should add a [Note][notes] and cross-reference it from the relevant places.
  • add a [testcase to the testsuite][adding test].
  • updates the users guide if applicable
  • mentions new features in the release notes for the next release
Edited by Rodrigo Mesquita

Merge request reports