[PRELIMINARY PATCH] rts/Linker.c for ARM

Karel Gardas karel.gardas at centrum.cz
Wed Oct 12 20:35:12 CEST 2011


On 10/12/11 07:57 PM, Ben Gamari wrote:
> On Wed, 12 Oct 2011 19:23:54 +0200, Karel Gardas<karel.gardas at centrum.cz>  wrote:
>> On 10/12/11 07:27 AM, Ben Gamari wrote:
>>> 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!
>>
>> Hi Ben,
>>
> [snip]
>>
>> the system is Ubuntu 11.04. Looking into /usr/include/elf.h reveals no
>> R_ARM_THM_MOVW_ABS_NC nor R_ARM_THM_MOVT_ABS relocations defined.
>>
> Oh my, it seems you are right. This is quite strange as these are
> defined in the "ELF for the ARM Architecture" specification. Moreover
> objdump seems to know about them. For now I've hacked around the issue
> by #defining them in Linker.c. I'll have to look into this futher,
> however.
>
>> Also the first issue is that T is not defined anywhere.
>>
> Oops, my apologies, it seems I forgot to define this. Fixed in the patch
> I just pushed to github.

I'm also using this to make it compilable:

$ git diff
diff --git a/rts/Linker.c b/rts/Linker.c
index e249264..c1947f2 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -4228,10 +4228,10 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* 
ehdrC,
              else
                     off >>= 16;

-            *upper = (StgInt16)( (upper & 0xfbf0) |
+            *upper = (StgInt16)( ((*upper) & 0xfbf0) |
                                  ((off & 0xf000) >> 12) |
                                  ((off & 0x0800) >> 1) );
-            *lower = (StgInt16)( (lower & 0x8f00) |
+            *lower = (StgInt16)( ((*lower) & 0x8f00) |
                                  ((off & 0x0700) << 4) |
                                   (off & 0x00ff) );
              break;

otherwise compiler is complaining about incompatible StgInt16* and int 
types...

Thanks,
Karel



More information about the Cvs-ghc mailing list