On Monday 15 April 2024 10:49:43 Martin Storsjö wrote:
> Or just compiling a test C file with the corresponding
> MSVC version and looking at the generated object file to see what symbol
> reference it generated.

So... now I did an experiment with VC4.2 CL.EXE (first version which
generate code for msvcrt.dll) and VC4.1 CL.EXE (last version which
generate code for msvcr40.dll).

Source code:

    float __cdecl fdiv(float a, float b) { return a / b; }

Compiled with:

    CL.EXE /c /QIfdiv /O2

Both 4.1 and 4.2 versions of CL.EXE generated same obj file which under
objdump -dr looks like:

    Disassembly of section .text:

    00000000 <_fdiv>:
       0:   d9 44 24 04             flds   0x4(%esp)
       4:   83 3d 00 00 00 00 00    cmpl   $0x0,0x0
                            6: dir32        __adjust_fdiv
       b:   75 06                   jne    13 <_fdiv+0x13>
       d:   d8 74 24 08             fdivs  0x8(%esp)
      11:   eb 09                   jmp    1c <_fdiv+0x1c>
      13:   ff 74 24 08             pushl  0x8(%esp)
      17:   e8 00 00 00 00          call   1c <_fdiv+0x1c>
                            18: DISP32      __adj_fdiv_m32
      1c:   c3                      ret


So what does it say about __adjust_fdiv and __adj_fdiv_m32 symbols?
If my understanding is correct then __adjust_fdiv is global variable
and __adj_fdiv_m32 is a function which takes first float argument in x87
ST(0) register, second float argument on the stack and function itself
pops the stack (the second float argument).

Now I checked all versions of msvcrt40.dll libraries which I found
(including OS system versions) and all have symbol name "_adj_fdiv_m32"
in their import tables.

So does it mean that "_adj_fdiv_m32" (and possibly also all other _adj_*
symbols) use stdcall calling convention, and should be defined with
@SIZE suffix in the .def file?


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to