Future of 32-bit platform support in FreeBSD
lists.freebsd.org
lists.freebsd.org
There's still some 32 bit software (usually proprietary stuff, and/or libraries used by Wine). Removing 32 bit libraries especially just breaks this software and you don't really have any option except to get the vendor to fix it.
But more importantly I sometimes find 64 bit assumptions in code. One recent example was in this new package that we're trying to add to Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=2263333 It doesn't compile on i686 with some obvious compile issues. Upstream isn't particularly interested in fixing them.
Typically the issues are incorrect assumptions about the size of 'long' and 'size_t'. And incorrect casts from pointers to longs (instead of using uintptr_t).
Does any of this matter still or should we embrace this 64 bit only world? Will CPU makers remove i686 support? I guess we're going to find out.
No code should cast a pointer to a `long`, ever. Trying to excuse it it with "we don't support 32-bit" is deeply wrong.
EDIT: Apparently this position is unpopular. I am curious why people feel differently.
Also, you can't reasonably remove all undefined behaviour. In C++ you basically can't do file IO without undefined behaviour.
“ The behavior is undefined if the calls to functions in this library introduce a file system race, that is, when multiple threads, processes, or computers interleave access and modification to the same object in a file system.”
No, that's not a portable behaviour but I can see that it's valid if you're targeting Linux.
uintptr_t is more polite, though.
Hell I still try to make sure stuff works on both big and little endian.
It's deeply wrong as an excuse but for a different reason: casting a pointer to long also works on 32-bit. The only mainstream architecture in which it doesn't work is 64-bit Windows.
More generally, I disagree with absolutist takes on programming. There's no right or wrong in programming. There's just requirements and choices.
It is also likely that general purpose CPUs will use 64-bit integer registers and address spaces for the rest of our lifetimes. Computing has already (for the most part) converged on a standard: Von Neumann architecture, 8-bit bytes, two's complement integers, IEEE floating point, little-endian. The number of oddballs has dramatically decreased over the past few decades and the non-conforming CPUs manufactured every year are already a rounding error.
FWIW If a transition is ever made to 128-bit that will be the last. There aren't 128-bits worth of atoms in the visible universe.
(Imagine installing 2^256 sound cards in a system ...)
We're already on this path, Intel has proposed an "X86-S" subset which drops support for booting into 16/32-bit modes (though 32-bit applications would still be supported under a 64-bit OS), ARM Cortex-A cores already dropped support for 32-bit boot a few years ago and the latest ones are also dropping support for 32-bit applications, so the whole stack has to be 64-bit. Apple preemptively killed 32-bit apps even on hardware that could technically still support them, and their current hardware doesn't support 32-bit at all, not even in Rosetta.
Why not just start the CPU in "long mode", which is what everyone is using it for, in the first place?
These newer ARM processors support 32-bit code at EL0 only (userspace). That seems like a reasonable approach for x86 as well and the freebsd announcement has this to say:
> There is currently no plan to remove support for 32-bit binaries on 64-bit kernels.
So for the moment, you can run 32-bit applications just fine.
Even that is being phased out, starting from 2021 ARMs reference cores mostly dropped 32-bit support, with the Cortex-X2 big cores and Cortex-A510 small cores being 64-bit only, and only the medium Cortex-A710 cores retaining the ability to run 32-bit code in userspace. With the next generation the medium cores lost 32-bit support, but the small cores gained 32-bit support again, so the chips can barely still run 32-bit code but it's relegated to only running on the least performant cores. I'm sure they'll drop it altogether as soon as they think the market will accept it.
Are you sure it's "everyone"? No doubt it's "overwhelming majority", but that's not the same, and "everyone" is a lot of people.
As I understand how this works, the compatibility is perhaps slightly inconvenient to a small group of developers, but not that inconvenient and generally relatively cheap. So why not have and keep it?
ARM has a lot less history than x86. Yes, it goes back to 1985 in the BBC Micro, but didn't really see serious usage as a "generic platform" until the late 90s/early 2000s.
I'm not saying remove the possibility of 32-bit userspace and nor are, it seems, freebsd. I am saying don't bother with a 32-bit kernel. Otherwise you're limited to a 4GB address space and hacks like PAE. No harm in running 32-bit binaries if you want and, I think Solaris actually left userspace as 32-bit only even on their 64-bit OS, unless the application really benefited from a 64-bit setup. Not sure what they do now, been a while since I used it.
It's arguable ASLR only works well in a 64-bit mode, as well.
No, but I'm not everyone.
Or let me put it this way: I don't know the motivation for why the things work like they do. It's entirely possible there is no good reason at all. Or maybe there is? Either way, I wouldn't assume anything so quickly.
Why not indeed?
https://www.intel.com/content/www/us/en/developer/articles/t...
https://en.wikipedia.org/wiki/Intel_80376
> It differed from the 80386 in not supporting real mode (the processor booted directly into 32-bit protected mode)
... although it didn't support paging.
Slightly related: visionOS references "iOS" for old 32-bit apps when you view them on the App Store. https://rr.judge.sh/Acaciarat%2FIMG_0002.PNG
An extra #include and more typing?
Plus, all the C89 users are out of luck...
Unless they don't provide the corresponding type natively at all (which can be the case for some 16-bit platforms and 64-bit). But then you have a bigger problem anyway.
That's not an issue on mainstream Linux, since uintptr_t and long always have the same size, both on 32-bit and on 64-bit. It's an issue only when using some new experimental stuff which uses two machine words per pointer, or when trying to port to Windows (where long is always 32-bit even when compiling for 64-bit).
What a relief it is that we have reached the final architecture and will never have to worry about anything like that again!
That's not an issue in mainstream Linux, since 16-bit Linux (ELKS) never caught on. Other than ELKS and perhaps some new experimental stuff, since its first release Linux always had long and pointer with the same size.
The there is of course no clean separation between the two, but by many definitions the "64-bit era" has already lasted longer than the "32-bit era". The real lesson from history is that we moved for specific practical reasons, and that these reasons don't exist with 64-bit architectures today. 64-bit is and most likely will remain the standard size for the foreseeable future. I predict that even embedded will (slowly) move to 64-bit because again, there is great value in standardizing these types of things.
It helps to look at the history of C integer type names and its context. Its origin lies not with C, but with ALGOL-68 - as the name implies, this is a language that was standardized in 1968, although the process began shortly after ALGOL-60 Report was published. That is, it hails from that very point in history when even 8-bit bytes weren't really standard yet nor even the most widespread - indeed, even the notion of storing numbers in binary wasn't standard (lots of things still used BCD as their native encoding!). ALGOL-60 only had a single integer type, but ALGOL-68 designers wanted to come up with a facility that could be adapted in a straightforward way to all those varied architectures. So they came up with a scheme they called "sizety", whereby you could append any number of SHORT or LONG modifiers to INT and REAL in conformant code. Implementations could then use as many distinct sequences as they needed to express all of their native types, and beyond that adding more SHORT/LONG would simply be a no-op on that platform. K&R C (1978) adopted a simplified version of this, limiting it to a single "short" or "long" modifier.
Obviously, this arrangement makes sense in a world where platforms vary so widely on one hand, and the very notion of "portable code" beyond basic numeric algorithms is still in its infancy. Much less so 40 years later, though, so the only reason why we still use this naming scheme is backwards-compatibility. Why use it for new code, then, when we had explicitly sized integer types since C99?
Starting C in 2024 is like starting Game of Thrones in the middle of Season 5. Dubbed in Esperanto.
Wine is going to stop being an issue somewhat soon. The Wine developers are adapting it to work more like Windows, by making even 32-bit applications call the 64-bit libraries.
I expect that, not long after Wine switches to always using 64-bit libraries, distributions (probably starting with faster-moving ones like Fedora) will completely (or almost completely, leaving only glibc and its dependencies) drop the 32-bit libraries. And we're already close to the Y2038 deadline, which gives distributions another incentive to drop 32-bit libraries (instead of having to go through a migration to the 64-bit time API, similar to the migration to 64-bit file offsets we had some time ago).
https://www.openbsd.org/i386.html
Luckily NetBSD still exists, I very much doubt they will depreciate 32 bit:
https://www.netbsd.org/ports/i386/hardware.html
NetBSD to me is a cool system, doing some unique things. But, sadly they need more support than they get these days.
(Do I recommend this myself? Well, I think techies find all kinds of weird things fun. :))
Is that in reference to this line?
> Due to the increased usage of OpenBSD/amd64, as well as the age and practicality of most i386 hardware, only easy and critical security fixes are backported to i386. The project has more important things to focus on.
This has been on the i386 page for quite a while. I haven't specifically heard of the developers dropping i386, but I also don't follow the mailing lists as much as I used to.
I really hope OpenBSD doesn't drop i386 as it's my go-to operating system for a lot of otherwise not very useful hardware - retro PCs, 32-bit laptops, etc. One can take any bog standard Pentium or higher box and turn it into a usable machine with OpenBSD.
It's almost a miracle that the quantum fireball in it still lives, it's over 20 years old now.
The motherboard also has a UW SCSI interface, but I have no disks left sadly. The 10k rpm Seagate died a long time ago.
Which hopefully gives some comfort. There isn't a shortage of cheap 32-bit x86 machines. The biggest problem are probably like sparc machines that getting your hands on one in good condition can still be pricey. But you can find a functional 32-bit x86 desktop machine on ebay for 30 bucks.
I love NetBSD and their focus ppears to be so you can run a modern supported/bugfixed OS on legacy hardware.
So FreeBSD and NetBSD are perfect compliments to each other.
> time_t is 8 bytes on all supported architectures except i386.
* https://man.freebsd.org/cgi/man.cgi?arch
* https://en.wikipedia.org/wiki/Year_2038_problem#Implemented_...
Even if there still are plenty of obsolete 32-bit CPUs running Linux or *BSD, since many years I have never seen a case where using them is the right technical choice.
When a UNIX-like OS is desired, it is a mistake to use anything less than a very cheap 64-bit CPU, like one with ARM Cortex-A55 cores.
For the many embedded applications where a 32-bit CPU is appropriate, either one of the many open-source RTOSes should be used or a bare-metal program, which is the best choice in many cases. For such embedded applications, a UNIX-like OS is much too bloated and it does not allow deterministic control of the hardware.
For modern home routers or security appliances you want them to be able to easily execute firewalls with complex sets of rules at multi-gigabit per second throughput, so that the router throughput should not be limited by the CPU instead of the Ethernet or WiFi interfaces.
For this, you really need something like Cortex-A55. The routers with obsolete CPUs limit the performance without any worthwhile price reduction.
On the other hand, for many embedded projects where a 32-bit CPU is the right choice, the developers choose Linux just because they are familiar with it and they are too lazy to read the manuals of some free real-time operating system, even if in fact the latter might require less development work and maintenance work for their software project.
There are some socs with A35 cores though, that is probably lowest end that is actually available.
> For open-source operating systems there will always remain the older stable 32-bit releases like FreeBSD 16 in this case.
I have a couple WD NATs which chug along on 32-bit PowerPC, a patched kernel and the last version of Debian before they dropped support for 32-bit PowerPC. Don't really plan to replace them before they break...do need to work out a backup "story" (as the kids would say) but they just hold old TV shows so if they let out the magic smoke then nothing important is lost.
Would be nice if I could keep them up to date on the latest and greatest but nobody cares about the 32-bits anymore...
Sadly not all on the mainline, but having worked in the embedded world, Linux is a massive part of that space.