renamed GMP symbols in GHC

Joachim Breitner nomeata at
Wed Jan 4 22:00:04 CET 2012


Am Mittwoch, den 04.01.2012, 20:50 +0100 schrieb Axel Simon:
> 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.

Just to more random ideas that can probably easily dismissed by more
knowledgeable people:

Would linking gmp statically help? E.g. is there a way to link libgmp
into the RTS that the symbols are not visible to the linker any more?

And would dlopen make a difference? RTLD_LOCAL sounds interesting...


Joachim "nomeata" Breitner
Debian Developer
  nomeata at | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nomeata at |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the Glasgow-haskell-users mailing list