TH segmentation fault on Linux when calling function from another package
The bug was hit when using Buck (buckbuild.com) to build. I had two packages, A containing a
single module with a TH function of type TH.Q [TH.Dec]
and module B importing A it and calling that function at top-level. I've attached a tarball that reproduces the problem using just 'ghc', 'ghc-pkg' and 'ar'.
I've verified that the problem occurs with 7.10.3, 8.0.2 and a semi-recent GHC HEAD from @bitonic. The issue doesn't occur on macOS and does not occur when the modules are in a single package or if the package is compiled as a shared library. The problem also does not occur when using stack, so this is likely related to how buck creates packages.