idata allegedly missing (Win32)
Jan Beulich
jbeulich@suse.com
Fri May 2 06:20:08 GMT 2025
On 01.05.2025 09:06, Paul Edwards wrote:
> On Thu, May 1, 2025 at 4:58 PM Paul Edwards <mutazilah@gmail.com> wrote:
>> So using this:
>>
>> https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdpclib/makefile.std
>>
>> and the tools provided by http://pdos.org/pdos.zip
>>
>> I am able to produce Win32 executables successfully
>> using pdld (ie not related to binutils):
>>
>>
>> Here it is running on my Windows 2000 system:
>>
>> D:\devel\pdos\pdpclib>pdmake -f makefile.std
>>
>> ...
>>
>> pdas --oformat coff -o dllcrt.obj dllcrt.s
>> rm -f dllcrt.s
>> as86 -o winsupa.obj -f coff winsupa.asm
>> rm -f temp.lib
>> xar r temp.lib stdio.obj string.obj stdlib.obj winsupa.obj
>> xar r temp.lib start.obj time.obj errno.obj assert.obj signal.obj
>> xar r temp.lib locale.obj ctype.obj setjmp.obj math.obj
>> xar s temp.lib
>> pdld -s --no-insert-timestamp -o msvcrt.dll --shared --out-implib
>> msvcrt.lib dllcrt.obj temp.lib
>> ../src/kernel32.lib
>> rm -f temp.lib
>> pdld -s -nostdlib --no-insert-timestamp -o pdptest.exe w32start.obj
>> pdptest.obj msvcrt.lib winsupa.obj setjmp.obj
>>
>> D:\devel\pdos\pdpclib>pdptest abc def
>> welcome to pdptest
>> main function is at 00401234
>> allocating 10 bytes
>> m1 is 003F2C80
>> allocating 20 bytes
>> m2 is 003F2C98
>> stack is around 0022FF80
>> printing arguments
>> argc = 3
>> arg 0 is <pdptest>
>> arg 1 is <abc>
>> arg 2 is <def>
>>
>> D:\devel\pdos\pdpclib>
>>
>>
>> And that does everything I want, so I'm fine.
>>
>> However, someone substituted this final link:
>>
>> pdld -s -nostdlib --no-insert-timestamp -o pdptest.exe w32start.obj
>> pdptest.obj msvcrt.lib winsupa.obj setjmp.obj
>>
>> with ld (ie binutils) from mingw - versions 2.38 and 2.42 were tried,
>> and that produced an executable that didn't work (no output
>> produced).
>>
>> A bug report was made to the pdld author in case they had
>> produced an invalid library (either kernel32.lib or msvcrt.lib)
>> that was causing binutils to choke.
>>
>> The pdld author insists that his archives are fine, and he
>> took a guess at what was wrong with binutils. So I am
>> reporting that guess in case anyone is interested.
Hmm, after a quick look at that msvcrt.lib: All _present_ archive members
indeed look to be fine, but there are ones missing. I expect this library
also wouldn't work with MS'es link.exe (at least older ones; it's been a
while since I last used any version thereof). In particular, the members
providing
__IMPORT_DESCRIPTOR_<dllname>
__NULL_IMPORT_DESCRIPTOR
\x7f<dllname>_NULL_THUNK_DATA
are all absent, yet GNU ld's instantiation of an import directory depends
on their presence.
Jan
More information about the Binutils
mailing list