davidgiven / ack

The Amsterdam Compiler Kit
http://tack.sf.net
Other
421 stars 60 forks source link

Assembler doesn't export symbols properly on windows #300

Closed davidgiven closed 7 months ago

davidgiven commented 7 months ago

The mingw build doesn't work --- symbol tables don't get generate properly by the assembler on Windows.

Example from Linux:

$ anm /tmp/ack-build/obj/mach/powerpc/libem/lib_linuxppc/aar4/aar4.o 
       0  0  E .aar4
       0  0  S .text
      3c  0  - .trap_earray
       0  U  E .trp

Example from Windows:

$ /tmp/ack-build/staging/bin/anm /tmp/ack-build/obj/mach/powerpc/libem/lib_linuxppc/aar4/aar4.o
       0  0  S .text
       0  U  E .trp
davidgiven commented 7 months ago

This is because tmpfile() on mingw with msvcrt doesn't work. It tries to create a file under C:\ which you don't have access to. Also, the assembler doesn't check whether it worked or not, which is bad.

davidgiven commented 7 months ago

The solution is to use ucrt64 rather than mingw32 --- that links against ucrt rather than msvcrt. If we want to make 32-bit binaries, we'll need to emulate our own tmpfile() which creates temporaries in the right place.