I started looking at why the Gz module won't load on W*ndows with
dynamic modules, while most others (such as Regexp) do. DLDEBUG had
the following to say:
First the Regexp module (which works):
dlopen(z:/home/peter/hack/Pike/7.3/build/microsoft-windows-xp-5.1.2600-x86/lib/modules/___Regexp.so,0)
filesize(z:/home/peter/hack/Pike/7.3/build/microsoft-windows-xp-5.1.2600-x86/lib/modules/___Regexp.so)
filesize(z:/home/peter/hack/Pike/7.3/build/microsoft-windows-xp-5.1.2600-x86/lib/modules/___Regexp.so)
Opening file: z:/home/peter/hack/Pike/7.3/build/microsoft-windows-xp-5.1.2600-x86/lib/modules/___Regexp.so
Reading ... tmp=0 len=17764 x=17764 errno=2
Done reading
dl_load_file
dl_loadcoff
dl_load_coff_files(01325BE0,00EDBDBC,1)
DL: counting
DL: 16dcb28 20 0 40
DL: section[0,0], 1536 bytes, align=16 (0x60500020)
DL: section[0,1], 518 bytes, align=4 (0xc0300040)
DL: section[0,2], 6080 bytes, align=16 (0x60500020)
DL: section[0,3], 804 bytes, align=4 (0xc0300040)
DL: section[0,4], 36 bytes, align=4 (0xc0300080)
DLINFO(113): -defaultlib:uuid.lib -defaultlib:LIBCMT -defaultlib:OLDNAMES -export:_pike_module_exit -export:_pike_module_init
Parse link info ptr=0
Parse link info ptr=0 len=20 '-default'
Parse link info ptr=21
Parse link info ptr=21 len=18 '-default'
Parse link info ptr=40
Parse link info ptr=40 len=20 '-default'
Parse link info ptr=61
Parse link info ptr=61 len=25 '-export:'
Parse link info ptr=87
Parse link info ptr=87 len=25 '-export:'
Parse link info done.
DL: allocating 1360 bytes
DL: Got 1360 bytes RWX memory at 00380000
alloc_htable(29)
DL: moving code
DL: section[0]=00390000 { 260, 1536 }
DL: section[1]=00380000 { 2956, 518 }
DL: section[2]=00390600 { 3484, 6080 }
DL: section[3]=00380208 { 13254, 804 }
DL: section[4]=0038052C { 0, 36 }
DL: data->symbol_addresses=00391DC0
DL: exporting symbols (169)
DL: exporting _pike_module_exit -> 00390000
[...]
Ok, looks fine. Now Gz:
dlopen(z:/home/peter/hack/Pike/7.3/build/microsoft-windows-xp-5.1.2600-x86/test-install/pike/7.3.56/lib/modules/Gz.so,0)
filesize(z:/home/peter/hack/Pike/7.3/build/microsoft-windows-xp-5.1.2600-x86/test-install/pike/7.3.56/lib/modules/Gz.so)
filesize(z:/home/peter/hack/Pike/7.3/build/microsoft-windows-xp-5.1.2600-x86/test-install/pike/7.3.56/lib/modules/Gz.so)
Opening file: z:/home/peter/hack/Pike/7.3/build/microsoft-windows-xp-5.1.2600-x86/test-install/pike/7.3.56/lib/modules/Gz.so
Reading ... tmp=0 len=144 x=144 errno=0
Done reading
dl_load_file
dl_loadcoff
dl_load_coff_files(042945F0,00EDACBC,1)
DL: counting
DL: 42944d0 20 0 40
DLINFO(84): /DEFAULTLIB:"uuid.lib" -defaultlib:uuid.lib -defaultlib:LIBCMT -defaultlib:OLDNAMES
Parse link info ptr=0
Parse link info ptr=0 len=22 '/DEFAULT'
Parse link info ptr=23
Parse link info ptr=23 len=0 ' -defaul'
Parse link info ptr=24
Parse link info ptr=24 len=20 '-default'
Parse link info ptr=45
Parse link info ptr=45 len=18 '-default'
Parse link info ptr=64
Parse link info ptr=64 len=20 '-default'
Parse link info done.
DL: allocating 0 bytes
DL: Got 0 bytes RWX memory at 00000000
alloc_htable(1)
DL: moving code
DL: exporting symbols (0)
DL: resolving
[...]
Now, there are two things wrong with this picture. First, there is no
"-export:_pike_module_exit -export:_pike_module_init" in the DLINFO.
Second, and even more alarming: Not a single symbol is found in the
file.
Ok, now running strings on the Gz.so to see if the symbols are
actually missing or of it's only dlopen.c which fails to read them:
[marcus@danae modules]$ strings -a Gz/module.so |less
.drectve
/DEFAULTLIB:"uuid.lib" -defaultlib:uuid.lib -defaultlib:LIBCMT -defaultlib:OLDNAMES
[marcus@danae modules]$
Hm. That's it?? Suspicion starts to dawn.
[marcus@danae modules]$ ls -l Gz/module.so
-rw-rw-r-- 1 peter peter 144 Sep 24 16:33 Gz/module.so
[marcus@danae modules]$
Right. I think it's safe to say that not only are the symbols
missing, the actual code is too.
Runnings strings on Gz/zlibmod.o shows that the symbols are there at
least, so it's the linking that has failed.
The buildlog only says
Making Gz
make[5]: Entering directory `/mnt/aphraelraid/home/peter/hack/xenofarm/client/pike/vmwarexp.bortas.org/buildtmp/Pike7.3-20020924-135500/build/microsoft-windows-xp-5.1.2600-x86/modules/Gz'
Compiling /mnt/aphraelraid/home/peter/hack/xenofarm/client/pike/vmwarexp.bortas.org/buildtmp/Pike7.3-20020924-135500/src/modules/Gz/zlibmod.c
Linking Gz
Pike Win32 partial linker.
$Id: pntld,v 1.14 2002/09/12 17:11:40 peter Exp $
Written by Fredrik Hubinette 2000 - 2001
Creating module.so
make[5]: Leaving directory `/mnt/aphraelraid/home/peter/hack/xenofarm/client/pike/vmwarexp.bortas.org/buildtmp/Pike7.3-20020924-135500/build/microsoft-windows-xp-5.1.2600-x86/modules/Gz'
so no clues there. The only difference I can see in the Makefiles for
Regexp and Gz is that Gz has
MODULE_LDFLAGS= -R/lib -L/lib -R/usr/local/lib -L/usr/local/lib -R/usr/X11R6/lib -L/usr/X11R6/lib -lshell32 -lkernel32 -lws2_32 -ladvapi32 -lm
while Regexp just has
MODULE_LDFLAGS= -R/lib -L/lib -R/usr/local/lib -L/usr/local/lib -R/usr/X11R6/lib -L/usr/X11R6/lib
but I don't think that's the problem, since Gmp has virtually the same
MODULE_LDFLAGS as Gz (including all the -lshell32 etc) and that module
works.
What's going on here? Hubbe?