On Wed, 2009-12-30 at 20:05 +0100, Danny Backx wrote:
> I checked all the relocations : the table vs. the assembler. They all
> appear to make sense. They're usually a couple of words between two
> functions (in the .text segment) that are pointers to something in
> another segment. A string literal for instance.
[..]
> void
> _pei386_runtime_relocator ()
> {
>   static int was_init = 0;
> 
>   if (was_init)
>     return;
>   ++was_init;
> 
>   {
>     wchar_t msg[64] = L"Yow";
>     MessageBoxW(0, msg, L"_pei386_runtime_relocator", 0);
>   }
>     do_pseudo_reloc (&__RUNTIME_PSEUDO_RELOC_LIST__,
>                      &__RUNTIME_PSEUDO_RELOC_LIST_END__,
>                      &__U(_image_base__));
> }

I may have found the issue.

If I replace the __image_base__ in the assembly file by the value that I
know the linker is supplying it with, the DLL works just fine.

So I created two versions of this DLL, and compared their objdump
outputs. The main difference is an extra relocation at 14a0 :

0100144c <_pei386_runtime_relocator>:
 100144c:       e92d4800        push    {fp, lr}
 1001450:       e28db004        add     fp, sp, #4
 1001454:       e59f3038        ldr     r3, [pc, #56]   ; 1001494
<_pei386_runtime_relocator+0x48>
 1001458:       e5933000        ldr     r3, [r3]
 100145c:       e3530000        cmp     r3, #0
 1001460:       1a000009        bne     100148c
<_pei386_runtime_relocator+0x40>
 1001464:       e59f3028        ldr     r3, [pc, #40]   ; 1001494
<_pei386_runtime_relocator+0x48>
 1001468:       e5933000        ldr     r3, [r3]
 100146c:       e2832001        add     r2, r3, #1
 1001470:       e59f301c        ldr     r3, [pc, #28]   ; 1001494
<_pei386_runtime_relocator+0x48>
 1001474:       e5832000        str     r2, [r3]
 1001478:       e59f0018        ldr     r0, [pc, #24]   ; 1001498
<_pei386_runtime_relocator+0x4c>
 100147c:       e59f1018        ldr     r1, [pc, #24]   ; 100149c
<_pei386_runtime_relocator+0x50>
 1001480:       e59f2018        ldr     r2, [pc, #24]   ; 10014a0
<_pei386_runtime_relocator+0x54>
 1001484:       ebffff35        bl      1001160 <do_pseudo_reloc>
 1001488:       ea000000        b       1001490
<_pei386_runtime_relocator+0x44>
 100148c:       e1a00000        nop                     ; (mov r0, r0)
 1001490:       e8bd8800        pop     {fp, pc}
 1001494:       0101200c        tsteq   r1, ip
 1001498:       01013000        tsteq   r1, r0
 100149c:       01013000        tsteq   r1, r0
 10014a0:       01000000        tsteq   r0, r0

Note that this contains the value of __image_base__ .

This means, I think, that Windows is choking on relocating the value of
__image_base__ itself.

Not sure how to solve this problem though. If I understand well what
do_pseudo_reloc is about, then we *need* the relocated value. Right ?

        Danny

-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to