Rolling your own dynamic linker

Manuel M T Chakravarty chak at cse.unsw.edu.au
Sun Nov 15 23:54:33 EST 2009


Simon Marlow:
> On 13/11/2009 04:42, Manuel M T Chakravarty wrote:
>>> * What about other platforms - are we adding a dependency on
>>>   PIC/dynamic support in the code generator in order to use GHCi?
>> 
>> Would the existing dynamic linker be likely to support a platform that does not have PIC/dynamic support?  In other words, I am not sure whether that would change the limitations in practice.
> 
> I'm thinking of a couple of situations here:
> 
> * We have platforms that build unregisterised and have GHCi support
>   using the existing ELF dynamic linker.  I don't know whether it's
>   possible to use -fPIC with unregisterised via-C compilation; in
>   theory it ought to be but we need to check, and support for
>   unregisterised dynamic libs would have to be added.
> 
> * A new NCG port would need to implement -fPIC/-dynamic
>   in order to get GHCi support.  e.g.  Sparc currently has
>   no -fPIC support in its NCG.
> 
> Does LLVM support PIC and dynamic calls?  That would be another option to replace the unregisterised ports.

Yes, the following relocation models are supported by LLVM:

  -relocation-model                   - Choose relocation model
    =default                          -   Target default relocation model
    =static                           -   Non-relocatable code
    =pic                              -   Fully relocatable, position independent code
    =dynamic-no-pic                   -   Relocatable external references, non-relocatable code

Manuel



More information about the Cvs-ghc mailing list