[PRELIMINARY PATCH] rts/Linker.c for ARM
Simon Marlow
marlowsd at gmail.com
Wed Oct 12 12:42:29 CEST 2011
On 12/10/2011 06:27, Ben Gamari wrote:
> Seeing as GHC has been building registerised binaries for ARM for some
> time now[1], I thought it might be about time that the GHC port was
> finished (especially considering bug #4268[2] makes the lack of GHCi
> quite painful). The one remaining task that I have found is the lack of GHCi
> support. The porting documentation[2] claims that GHCi requires porting
> of rts/Linker.c.
>
> After a cursory look at this, it seems that only the following are
> necessary (assuming Mach-O support can be neglected),
>
> * Add EM_ARM case to ELF machine type handling (quite trivial)
> * Add ARM support to do_Elf_Rela_relocations and do_Elf_Rel_relocations
>
> Concerning the relocations, it appears that the x86 code only implements
> two relocation types. Looking at my installed GHC-compiled libraries, it
> seems these are the only two relocation types which GHC produces. The
> non-Haskell libraries, however, tell a much different story. Am I correct
> in assuming that rts/Linker.c works exclusively with GHC-compiled
> objects?
Not necessarily - Haskell packages often contain fragments of compiled C
code, and in general it is possible to give GHCi any .o or .a file on
the command line and the linker will try to link it.
Also, if you want to support -fPIC and -dynamic then you may have to
implement the other kinds of relocations that those generate.
> Moreover, in reviewing my GHC-compiled ARM libraries, I have yet to see
> a .rela. Is it safe to say these won't appear in the wild?
I don't remember what they are, sorry :)
> I have finished a first cut of a patch doing the above and it is
> available at [4]. Be aware that this is entirely untested (hopefully
> this will change tomorrow after some sleep). Does anyone see anything
> missing or blatantly wrong? Given my limited knowledge of the
> intricacies of the linking process and the ARM architecture, I'd
> appreciate any advice folks could offer. Thanks!
I don't see anything obviously bogus. But you should test it before we
pull it in - I'd be willing to bet a large sum of money that it doesn't
just work.
Cheers,
Simon
>
> Cheers,
>
> - Ben
>
>
> [1] http://hackage.haskell.org/trac/ghc/wiki/Building/ARMLinuxGnuEABI
> [2] http://hackage.haskell.org/trac/ghc/ticket/4268
> [3] http://hackage.haskell.org/trac/ghc/wiki/Building/Porting
> [4] https://github.com/bgamari/ghc/commit/045500ddb0fbc92807ec97523f5ba2412d671ec6
>
> _______________________________________________
> Cvs-ghc mailing list
> Cvs-ghc at haskell.org
> http://www.haskell.org/mailman/listinfo/cvs-ghc
More information about the Cvs-ghc
mailing list