I know that on Mac OS X, you can combine multiple binaries that target different architectures into a single binary using lipo. I am wondering if there is a similar solution on the Windows side. Thank you.
3 Answers
Unfortunately all the Windows architectures use the same structures in the PE header, so no. It is possible to fuse a Windows executable and a DOS executable though, since DOS uses the MZ header instead.

- 776,304
- 153
- 1,341
- 1,358
-
-
1But you could make an installer that would install different versions, based on architecture? Not the same, but maybe good enough? – Neeme Praks Oct 24 '10 at 16:49
-
Yes, I can create an installer that would install different versions. I was just looking for a better solution, so that it'll be on par with the Mac OS X version. – rwb Oct 24 '10 at 17:40
There's a real fat PE format in Windows 11 on ARM called Arm64X which contains both Arm64 code and Arm64EC code
Fundamentally, an Arm64X binary contains all of the content that would be in separate x64/Arm64EC and Arm64 binaries, but merged into one more efficient file on disk. The built Arm64X binary has two sets of code, entry points, etc., while eliminating redundant parts to save space on disk.
How do Arm64X binaries work?
Arm64EC is a completely new ABI that's incompatible with ARM64, designed for mixing x86-64 and ARM64 code

- 37,963
- 15
- 156
- 475
I think you are reffering to the ADS, that has been added to the NTFS to provide similar functionality as on Mac. Although NTFS supports multiple streams, the PE loader should choose the right one, and I'm not sure if it's implemented.

- 14,714
- 1
- 39
- 40
-
1This doesn't sound right at all. Can you please point me to some MSDN links that support this? – mrduclaw Oct 24 '10 at 16:56
-
@mrduclaw Try this one: http://msdn.microsoft.com/en-us/library/bb540537%28v=VS.85%29.aspx – ruslik Oct 24 '10 at 17:07
-
2Sorry, maybe I wasn't explicit; English is not my first language. I understand what Alternate Data Streams are and how to use them. I've just never read anything about the Windows loader using them to choose which binary to load. Wouldn't the IMAGE_NT_HEADERS need to have this field somewhere in it so that the IMAGE_OPTIONAL_HEADER points to the correct AddressOfEntry? So MSDN links discussing the Windows loader using them is what I'm looking for. – mrduclaw Oct 24 '10 at 17:23
-
@mrduclaw On Mac, the common way to store resources of an executable is to put them in its ADS. This also could include different versions for the executable. NTFS supports this way of storing files, but I'm not sure if PE loader is able to choose the right binary from ADS (if any) for the current architecture. COFF header has a field `Machine` that specifies the architecture for which the binary is built. There is no need to have several optional headers, because we are speaking of different files here. – ruslik Oct 24 '10 at 18:16
-
[Fat binary](https://en.wikipedia.org/wiki/Fat_binary) means a binary containing code for multiple platforms. In macOS that's a binary containing both x86 and PowerPC code, or x86 and ARM code. This has nothing to do with ADS – phuclv Aug 27 '22 at 06:27