git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] compat/bswap.h: detect ARM64 when using MSVC

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Nov 10, 2020, 23:38 UTC
Message-ID
<20201110233850.GJ6252@camp.crustytoothpaste.net>
In-Reply-To
<nycvar.QRO.7.76.6.2011101418550.18437@tvgsbejvaqbjf.bet>
On 2020-11-10 at 13:58:21, Johannes Schindelin wrote:
> The biggest question now is: are we certain that `_M_ARM64` implies
> little-endian?

For Windows? Yes. I'm almost certain Windows has only supported little-endian architectures, possibly with the exception of gaming consoles.

Show 14 quoted lines
> I remember that ARM (the 32-bit variety, that is) has support for
> switching endianness on the fly. Happily, MSVC talks specifically about
> _not_ supporting that:
> https://docs.microsoft.com/en-us/cpp/build/overview-of-arm-abi-conventions
> 
> Likewise, it says the same about ARM64 (mentioning that it would be much
> harder to switch endianness there to begin with):
> https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions
> 
> So does that make us confident that we can just add that `_M_ARM64` part?
> Yes. Does it make me confident that we can just drop all of the
> architecture-dependent conditions? No, it does not. There _were_ versions
> of MSVC that could compile code for PowerPC, for example, which _is_
> big-endian.

PowerPC can actually be either. Most 64-bit PowerPC machines these days are run as little endian, and Windows has always run it in little-endian mode. Macs ran it in big-endian mode.

Show 5 quoted lines
> > As far as I know, Windows has always run on little-endian hardware.
> 
> I think that depends on your point of view... IIRC an early version of
> Windows NT (or was it still VMS Plus?) ran on DEC Alpha, which I seem to
> _vaguely_ remember was big-endian.

Alpha appears to have supported both, but as far as I know, both Windows and Linux used it in little-endian mode.

Show 6 quoted lines
> > [0] Wikipedia does not specify the endiannesses supported by the MIPS
> > edition.
> 
> I have another vague memory about MIPS (a wonderful SGI machine I had the
> pleasure of banging my head against, for lack of Python support and Git
> requiring Python back then) being big-endian, too.

Another architecture that supports both endiannesses. Debian supports both, but I believe Windows only supported the little-endian version. I have a small MIPS board that uses the little endian port for Debian.

> Short version: while I managed to convince myself that _currently_ there
> are no big-endian platforms that we can support via MSVC, I would like to
> stay within the boundaries of caution and _not_ drop those `defined(_M_*)`
> parts.

While I'm confident in my statements, you're the relevant subsystem maintainer here, so I'm happy to defer to your judgment. I think Junio can just pick up the earlier patch version and we should be good to go, since that patch seemed to meet everyone's needs.

-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Sebastian Schuberth
Message 6 of 6 in “compat/bswap.h: detect ARM64 when using MSVC”
  1. compat/bswap.h: detect ARM64 when using MSVCDaniel Gurney, Nov 7, 2020
  2. brian m. carlsonNov 7, 2020
  3. Daniel GurneyNov 7, 2020
  4. Johannes SchindelinNov 10, 2020
  5. Sebastian SchuberthNov 10, 2020
  6. brian m. carlsonNov 10, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.