renamed GMP symbols in GHC
Axel.Simon at in.tum.de
Wed Jan 4 20:50:23 CET 2012
On 04.01.2012, at 17:50, Joachim Breitner wrote:
> BTW, Is there a way to get the linker to create two independent copies
> of a library in one program space? Maybe if it is compiled as PIC
> (random name dropping here)? That would seem to be an elegant solution,
> as it makes the distro packers happy and you would not have to maintain
> a code copy.
In the past, I've linked a C++ library that used gmpxx against a Haskell program by renaming all symbols starting with gmp to mygmp using objcopy. Unfortunately, this is not portable and completely broke down on Mac OS when Apple moved to fat binaries (Intel and PowerPC) since their objcopy version was crippled (there doesn't even seem to be an objcopy anymore on later OS X versions). Thus, renaming symbols after compilation is non-portable and sometimes not possible without writing your own tool.
So, I propose to revert to renaming the symbols in the source code which could probably be done automatically using a lot of CPP #defines, starting from some sort of source code tar ball of gmp. This would also allow to always use the latest gmp sources without too much hassle.
More information about the Glasgow-haskell-users