ps2dev / ps2toolchain

This program will automatically build and install a compiler and other tools used in the creation of homebrew software for the Sony PlayStation® 2 videogame system.
BSD 2-Clause "Simplified" License
239 stars 73 forks source link

Add native 64-bit windows host build support #56

Closed luisdallos closed 5 years ago

luisdallos commented 5 years ago

By default, configure scripts of binutils-2.14, gcc-3.2.3 and newlib-1.10.0 are unable to autodetect the host triplet when run from 64-bit mingw shell (mingw64.exe) of 64-bit msys2 installation, so, it is required to pass the host triplet (x86_64-w64-mingw32) to configure script invocation, i.e.:

./configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32

And gcc-3.2.3 requires some modifications related with the size of integral data types, as in its source code is assumed that:

  1. The long integral data type is wide enough to do pointer or scalar type casting with no precision loss.
  2. At host level, pointers have the same size as long integral data type.

So this explains why on 64-bit linux (data model: LP64) and 32-bit windows (data model: ILP32) platforms, GCC 3.2.3 can be built with no issues, while on 64-bit windows (data model: IL32P64) platform, GCC 3.2.3 can not be built (intermediate binaries such as xgcc keep throwing segfault), as the latter platform does not comply with the two premises mentioned above.