On 10/13/11 05:52 AM, Ben Gamari wrote:
On Thu, 13 Oct 2011 00:15:39 +0200, Karel Gardas<[email protected]>
wrote:
On 10/12/11 08:44 PM, Ben Gamari wrote:
On Wed, 12 Oct 2011 20:35:12 +0200, Karel Gardas<[email protected]>
wrote:
I'm also using this to make it compilable:
Yep, you are right. Merged.
FYI, relocation type 43 still unhandled:
I just pushed a new set of patches. I now handle the following
relocation types,
* R_ARM_CALL
* R_ARM_JUMP24
* R_ARM_MOVW_ABS_NC
* R_ARM_MOVT_ABS
* R_ARM_THM_CALL
* R_ARM_THM_JUMP24
* R_ARM_THM_MOVW_ABS_NC
* R_ARM_THM_MOVT_ABS
Moreover, I'm marginally more confident that the code is correct now
after finding a few mistakes. The source is again available at [1].
Great! It looks like few are still unhandled -- see my email with relocs
listings, for example ghc-prim load now fails on R_ARM_REL32 it seems:
Loading package ghc-prim ... linking ... ghc-stage2:
/export/home/karel/vcs/ghc-src/bgamari-ghc-arm-linker/libraries/ghc-prim/dist-install/build/HSghc-prim-0.2.0.0.o:
unhandled ELF relocation(Rel) type 3
ghc-stage2: unable to load package `ghc-prim'
make[1]: ***
[libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.o] Error
1
Also to get to this stage I needed to apply attached patch. However I'm
not sure I got `A' definition right hence just commenting out #ifdefs....
Thanks!
Karel
diff --git a/rts/Linker.c b/rts/Linker.c
index d9fb4a6..19d763f 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -4160,9 +4160,9 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC,
Elf_Addr P = ((Elf_Addr)targ) + offset;
Elf_Word* pP = (Elf_Word*)P;
-#if defined(i386_HOST_ARCH) || defined(DEBUG)
+ //#if defined(i386_HOST_ARCH) || defined(DEBUG)
Elf_Addr A = *pP;
-#endif
+ //#endif
Elf_Addr S;
void* S_tmp;
#ifdef i386_HOST_ARCH
@@ -4254,7 +4254,7 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC,
// although we could support the case of BL with cond=0xe by
// turning instruction into BLX
errorBelch("%s: ARM to Thumb transition unsupported\n",
- oc_fileName);
+ oc->fileName);
return 0;
}
@@ -4276,7 +4276,7 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC,
if (T) {
errorBelch("%s: ARM to Thumb transition unsupported\n",
- oc_fileName);
+ oc->fileName);
return 0;
}
@@ -4317,17 +4317,17 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC,
if (!T) {
errorBelch("%s: Thumb to ARM transition unsupported\n",
- oc_fileNmae);
+ oc->fileName);
return 0;
}
// Reencode instruction
i1 = ~(offset >> 23) & 1; j1 = sign ^ i1;
i2 = ~(offset >> 22) & 1; j2 = sign ^ i2;
- *upper = (Elf_Word16) ( (*upper & 0xf800)
+ *upper = (StgWord16) ( (*upper & 0xf800)
| (sign << 10)
| ((offset >> 12) & 0x03ff) );
- *lower = (Elf_Word16) ( (*lower & 0xd000)
+ *lower = (StgWord16) ( (*lower & 0xd000)
| (i1 << 13)
| (i2 << 11)
| ((offset >> 1) & 0x07ff) );
@@ -4352,14 +4352,14 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC,
if (!T) {
errorBelch("%s: Thumb to ARM transition unsupported\n",
- oc_fileName);
+ oc->fileName);
return 0;
}
- *upper = (Elf_Word16) ( (*upper & 0xfbf0)
+ *upper = (StgWord16) ( (*upper & 0xfbf0)
| ((offset & 0xf000) >> 12)
| ((offset & 0x0800) >> 1) );
- *lower = (Elf_Word16) ( (*lower & 0x8f00)
+ *lower = (StgWord16) ( (*lower & 0x8f00)
| ((offset & 0x0700) << 4)
| (offset & 0x00ff) );
break;
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc