-ohi and -o don't behave consistently with -dynamic-too
-o has some special logic to also rename the dynamic output based on the argument to -o. There isn't the same logic for -ohi which leads to interface files getting overwritten.
The result if you use -ohi
is that the dynamic interface file clobbers the normal interface file, both get written to the same path.
> ghc -c -o A2.o -ohi A2.hi A.hs -dynamic-too -fforce-recomp
> [matt@nixos:~/ghc-clean/dyn-dyn-too]$ ls
A2.dyn_o A2.hi A2.o A.hs
> [matt@nixos:~/ghc-clean/dyn-dyn-too]$ ghc --show-iface A2.hi
Magic: Wanted 33214052,
got 33214052
Version: Wanted 8104,
got 8104
Way: Wanted [],
got [d, y, n]
With head there is the -dynohi
flag which should be used to be able to redirect the dynamic interface file (but that panics)
Proposal: Specifying -ohi
also sets -dynohi
if that's not set like -o
sets -dyno
.