On Sat, 2009-11-14 at 09:24 +0100, Danny Backx wrote: > On Sun, 2009-11-01 at 17:17 +0100, Vincent R. wrote: > > 1) Put section .edata and .idata inside .rdata > > 2) Put .bss data inside .data instead of emitting a .bss section > > 3) Fix IAT because value is NULL > > 4) Fix Pointer To Symbol Table because value is NULL > > As I wrote earlier, #3 is changed but the DLL doesn't start working on > WM 6.1 (emulator) yet. > > I've looked at #1 and #2. They involve moving around stuff in the linker > script. Not very hard at first sight. But, when you do that, you affect > data on which the code relies. Moving .edata inside .rdata makes ld > crash (when creating an application that uses the DLL : in line 3051 in > pe-dll.c "Skip unwanted symbols, which are > exported in buggy auto-import releases"). > > So I can create a DLL that has fewer sections and that has the IAT > pointer non-NULL. I've been staring at what it points to, I'm not > convinced that this is right. > > But now for the surprise. > > When loading the DLL with testapi, it successfully loads, and appears to > know the function it exports : > Started processing DLL(testDll.dll) > testDll.dll doesn't know about open > testDll.dll implements getDLLValue (0x017C108C) > > Don't worry about the line about "open", I put that in the > testapi.in.txt intentionally. > > When trying to run this with a test application, still no success but a > different error message. Now the application appears to crash. > > So I may be getting somewhere. Not sure why though.
Part of the above was not entirely right, the compiler didn't create working executables (even for a simple example). Also the format of the exe seems to confuse gdb. Anyway, I played with the linker script a bit and suddenly the test application started to work in the emulator. Current situation : the BSS section is gone but .idata and .edata are not changed. Also the pe-dll.c fix by Kai is required (I think). That's what causes the IAT to be non-NULL. Grab a couple of test programs at http://danny.backx.info/download/cegcc/test20091115.tar.gz . The gdb issue is still there, but the useDll.exe should display a dialog saying "DLL ok" in the header, and "value 0xdeadbeef" in the content. The loadDll.exe shows one more dialog before a similar message. I get to see this on the 6.1 emulator, I'd appreciate feedback from someone with a real device. Also a more elaborate test would be welcome. I've also uploaded my changed pe.sc file : http://danny.backx.info/download/cegcc/pe.sc . This needs to be in src/binutils/ld/scripttempl/pe.sc . Note that this only gets picked up decently by the build system after a "make clean" in at least the src/build-mingw32ce/binutils/ld directory . Danny -- Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel