Skip to content

-optcxx does not allow passing -fno-rtti (required for working with LLVM)

Summary

I'm one of the maintainers of llvm-hs and we are preparing the llvm-hs-12.0.0 release. We had been using GHC 8.8.X to test but recently tried to move to GHC 8.10 since this is now in Stackage LTS. However, it seems that GHC 8.10 does not understand '-fno-rtti' passed to the backend compiler via -optcxx. This is problematic because LLVM is built without RTTI, and we end up with unresolved symbols for typeinfo for everything.

Can GHC be amended to accept -fno-rtti to -optcxx? It seems a little bizarre that GHC takes it upon itself to whitelist passthrough options to a backend compiler in the first place, but that's a different issue.

Steps to reproduce

Attempt to compile any FFI module which links against C++ shared libraries compiled with -fno-rtti

Expected behavior

Link is successful

Environment

  • GHC version used: 8.10.4

Optional:

  • Operating System: Linux
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information