Skip to content

Investigate removing libGCC symbols from RtsSymbols.c

The RTS is currently re-exporting symbols from the C compiler runtime in RtsSymbols.c.

How this works is that the Runtime linker is declaring that it can provide these symbols because it's been linked against the C compiler library itself. In essence it's providing pointers to it's own symbol table.

This Is fine but has two downsides:

  1. We have to keep adding symbols to export anytime the underlying C compiler changes things or someone needs a new symbol from the library.

  2. User code that is linking explicitly against these libraries will probably generate a duplicate symbols error if it needs a symbol we have not yet exported but is in the same object file or dependency of a symbol we have exported.

One solution would be to add libgcc_s to the dependencies of ghc-prim which is the package that seems to require them.

This has two issues with it: GCC_S doesn't exist for llvm, so we need to somehow know which compiler we're compiling for.

Secondly on Windows GCC_S is an import library with a non-standard name. (.a instead of .dll.a) and we currently cannot recognize it as such. We'd try to load it as a normal archive and end up trying to execute ascii as code.

This task is to find a way to remove the need to export these symbols yet still work with both GCC and LLVM.

Trac metadata
Trac field Value
Version 8.0.1
Type Task
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System (Linker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information