I've narrowed the demo DLL down to the minimal source I can trigger the
problem with. Doesn't need to compile with any of the runtime modules,
so the compile boils down to :

arm-mingw32ce-gcc -c lib7.c
arm-mingw32ce-ld --shared -Bdynamic -e DllMainCRTStartup -o lib7.dll
lib7.o -lcoredll

Note all the support libraries are effectively gone in the ld command
line.

Source is attached. By commenting the declaration of big_buf, Windows
Mobile sees a small executable, doesn't relocate it, so it works.
With big_buf, the new functionality in WM 6.1 kicks in to relocate, and
the DLL fails.

Well, it fails if you select the first of the three assigments - where
_image_base__ is used. The others do work.

The objdump now contains only one relocation, which causes the problem.

An objdump of the faulty dll is at
http://danny.backx.info/download/cegcc/lib7a.objdump , and of a working
one (another assignment selected) is at
http://danny.backx.info/download/cegcc/lib7b.objdump .

The test program that attempts to load this with LoadLibrary and then
executes doit and prints the result shows this result :

Started processing DLL(lib7.dll)
        lib7.dll implements doit (0x780F102C)
        Trying to call doit()
        doit -> 0x780f1000

or, for the faulty version :

LoadLibrary(lib7.dll) : cannot load DLL -> error 1114

Help ?

        Danny

-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
#include <windows.h>

BOOL WINAPI
DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
{
	return TRUE;
}

#if 0
    do_pseudo_reloc (&__RUNTIME_PSEUDO_RELOC_LIST__,
		     &__RUNTIME_PSEUDO_RELOC_LIST_END__,
		     &__U(_image_base__));
#endif

static char	big_buf[0x010000] = { '1' };

extern DWORD __U(__RUNTIME_PSEUDO_RELOC_LIST__);
extern DWORD __U(__RUNTIME_PSEUDO_RELOC_LIST_END__);
extern DWORD __U(_image_base__);

__declspec (dllexport)
int doit (void)
{
	void *p;

	p = &__U(_image_base__);
//	p = &__U(__RUNTIME_PSEUDO_RELOC_LIST__);
//	p = DllMainCRTStartup;

	return (int)p;
}
------------------------------------------------------------------------------
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