Skip to content

Commit

Permalink
Merge pull request #16 from well-typed/edsko/update-readme
Browse files Browse the repository at this point in the history
Describe how to use the plugin on the boot libs
  • Loading branch information
edsko authored Jan 12, 2025
2 parents 5b116d7 + c79bef1 commit e6b2dee
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ You should then be able to build or run your executable, rebuilding (almost)
all of its dependencies, with

```bash
$ cabal run --project-file cabal.project.plugin <your-exec>
cabal run --project-file cabal.project.plugin <your-exec>
```

### Upgrading the plugin
Expand All @@ -190,6 +190,44 @@ packages). So wipe your `cabal-plugin-store` as well as your `dist-newstyle`
directory each time you update your plugin (another good reason for using a
separate store for the plugin).

## Enabling the plugin on the GHC boot libraries

If you want to track time spent in foreign calls made in the GHC boot libraries,
you will need to recompile GHC. Checkout

```
git clone https://gitlab.haskell.org/edsko/ghc.git \
--branch edsko/trace-foreign-calls \
./ghc-trace-foreign-calls
```

Then in the `ghc-trace-foreign-calls` directory run

```
git submodule update --init --recursive
./boot && ./configure
hadrian/build -j
```

Use GHC 9.10 as your bootstrap compiler. See
[Building and Porting GHC](https://gitlab.haskell.org/ghc/ghc/-/wikis/building/#building-and-porting-ghc)
for all the nitty gritty details about building ghc.

Once built, use the compiler in `_build/stage1/bin` instead of your regular GHC.
In this case there is no need to separately enable the plugin; just compile with
this custom build of GHC, and all packages will have `trace-foreign-calls`
enabled; you might still want to use a custom cabal store, something like

```
import: cabal.project
package *
ghc-options:
-package-db=/tmp/cabal-plugin-store/ghc-9.13.20250112/package.db
store-dir: /tmp/cabal-plugin-store
```

## The generated wrappers

### IO function, no profiling
Expand Down

0 comments on commit e6b2dee

Please sign in to comment.