Skip to content

Some Makefile enhancements#1

Open
Fierelier wants to merge 5 commits intoAlex313031:masterfrom
Fierelier:master
Open

Some Makefile enhancements#1
Fierelier wants to merge 5 commits intoAlex313031:masterfrom
Fierelier:master

Conversation

@Fierelier
Copy link
Copy Markdown

@Fierelier Fierelier commented Apr 10, 2026

Adds HOST for choosing cross-compilation toolchain, removes requirement for SSE and SSE2 (+i486 compatibility - more about this below), optimize for size and strip binary (Release only). Stripping the binary makes it almost half the size.

The reason for i486 feature level is this: The vast majority of binaries in XP actually work on i486 class processors. So much so, that people were able to make a custom version of XP that runs on such processors.

Officially, XP functions on i586 processors. It also still features the FPU emulator of older Windows versions, which to my knowledge is there to mainly mitigate the Pentium FDIV bug, but can also be used to run the OS on niche i586 processors without an FPU.

XP certainly does not require SSE and neither should this tool.

Fierelier added 5 commits April 10, 2026 23:58
Most binaries in XP are still built for i486 class processors, so much so that people were able to get XP to run on an i486 with just a few modifications
@Fierelier
Copy link
Copy Markdown
Author

@Alex313031 What do you think?

@Alex313031
Copy link
Copy Markdown
Owner

@Fierelier The problem is that MinGW/GCC are compiled with SSE2, so even if you don't specify it, the binary will still not run on non-SSE2 CPUs due to the C stdlib.

For MSVC, this is possible in x86 mode by /arch:IA32 which omits SSE/SSE2 instructions in favor of x87 only.

But in Visual Studio 2026 this also seems to have been removed.

I mostly build this with MinGW anyway (the releases are built with that).

I actually use my own MinGW build for this > https://github.com/Alex313031/mingw-linux-build and maybe I can tweak that to get it to build without SSE/SSE2 instructions.

Otherwise, these changes look good.

@Fierelier
Copy link
Copy Markdown
Author

@Alex313031

The problem is that MinGW/GCC are compiled with SSE2, so even if you don't specify it, the binary will still not run on non-SSE2 CPUs due to the C stdlib.

I've ran into a similar issue as well with Debian's precompiled MinGW toolchain, but I've solved it by using a Gentoo i486 chroot. There, the MinGW C library actually has the appropriate CPU feature level for this. I suspect you'd be able to adjust your MinGW to do the same.

Here is how MinGW was compiled, according to i686-w64-mingw32-gcc -v:

Using built-in specs.
COLLECT_GCC=/usr/bin/i686-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/mingw64-toolchain/libexec/gcc/i686-w64-mingw32/15/lto-wrapper
Target: i686-w64-mingw32
Configured with: /var/tmp/portage/dev-util/mingw64-toolchain-13.0.0_p1/work/gcc/configure --build=i486-pc-linux-gnu --target=i686-w64-mingw32 --docdir=/.skip --infodir=/.skip --mandir=/.skip MAKEINFO=: --prefix=/usr/lib/mingw64-toolchain --host=i486-pc-linux-gnu --disable-bootstrap --disable-cet --disable-gcov --disable-gomp --disable-libquadmath --disable-libsanitizer --disable-libssp --disable-libvtv --disable-shared --disable-werror --with-gcc-major-version-only --with-system-zlib --without-isl --without-zstd CXX='i486-pc-linux-gnu-g++ -std=c++14' --disable-multilib --enable-languages=c,c++ --enable-threads=posix --with-sysroot=/usr/lib/mingw64-toolchain --with-build-sysroot=/var/tmp/portage/dev-util/mingw64-toolchain-13.0.0_p1/temp/root/usr/lib/mingw64-toolchain
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.2.0 (GCC)

This doesn't look very helpful though, if working on an x64 Linux env I think. I suspect another flag is required, if not using an i486 compiler. Maybe you need to compile the CRT specifically with -march=i486?

I appreciate that you're putting work into making compilers easier to attain, by the way. That stuff has always been black magic to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants