How Small Can You Make A C Executable?

It’s well known that the difference in executable size between a compiled binary and one hand-written in optimized assembler will be significant. The compiler brings in all manner of boilerplate whether it needs all of it or not, which is responsible for the extra space. [Weineng] has fallen down the rabbit hole of trying to make the smallest possible gcc-compiled C executable, and the resulting write-up is a fascinating read.

Surprisingly the smallest C program isn’t “Hello World”, but one which simply does nothing but return 0. This results in a binary weighing in at a surprisingly large 15,816 bytes — something which surely could be improved. There follows a set of clever compiler flags and bits of code manipulation to remove some debugging information, and strip out unnecessary stuff executed before void main().

At 13,632 bytes it’s still a little on the chunky side, so it’s time to examine what libraries it brings in. More compiler flags get it down to 8,704 bytes. Removing a code comment section and error handling with more flags takes it to 4,320 bytes. Then there’s code which dictates how memory is allocated, which brings it down to 400 bytes. That’s an impressive reduction!

Reading this as hardware people we maybe don’t have the elite knowledge of compiler flags it takes to manage something like this. But we’ve all at times had to reduce the size of a bit of software, so we’re sure some of the techniques used are going to be interesting to quite a few readers.

After all, even hardware people need to trim the fat at times.

Linux Fu: Taming Strace

While many operating systems seem to try to prevent you from peeking under the hood, Unix and Linux positively encourage it. One great tool that we’ve looked at before is strace. Using this tool, you can see details about every system call a program makes. As you might imagine, for any significant program, the output from strace can be huge.

While I’m not always a fan of GUIs, this is one of those cases where making the data easier to browse is a great idea. Enter strace-tui, a text-based GUI for strace from [Rodrigodd]. The program can parse output from strace or manage the strace execution itself, and either way, display the data in a useful way.

I started out looking at [janestreet’s] strace_ui, but the OCaml setup was throwing errors for me, so I just gave up. The strace-tui installs like many Rust programs, using cargo, and it went smoothly.

Continue reading “Linux Fu: Taming Strace”

The Virtual OS museum, screenshot

Virtual Museum Hosts Every OS You Haven’t Heard Of

OK, every operating system is a bit of a stretch — Windows Vista notably didn’t make the cut — but [Andrew]’s Virtual OS museum has a good claim to being the most comprehensive archive of operating systems yet assembled.

[Andrew] has a blog post describing the project, as well as a YouTube video that we’ve embedded below. But the real fun is in the downloading and spinning up one of 570+ operating systems for more than 250 platforms on pre-configured virtual machines that have been packaged up for us.

This isn’t just the usual retrocomputer nostalgia-fest of Macintosh System and DOSBox. There’s everything from IBM Big Iron and VAXen to Texas Instrument graphing calculators emulated in the museum, with software to run on them, too. If you’ve ever wondered what you could do with the Manchester Baby, well, all known software for that machine is included with its ‘operating system’.

Admission is free, but like any good museum you’ll be waiting in line a while to get in, so expect the full 128 GB download to take some time. If you’re into computer history, though, it’s going to very much be worth the wait. If you try it and like it, you could help others by seeding the torrent.

The actual museum launches in a VM as a modern Linux system — perhaps that can be considered an exhibit itself — with a launcher to select any of the other system/OS combos, including various other, older Linuxes hosted on their own VMs. There are more to come, too, as [Andrew] continues the long debugging process of making sure everything works as expected.

Purists may decry this virtual emulation as not being quite the real thing, which is true. But while MiSTer supports a lot of cores via FPGA, you probably won’t find everything here on that platform. We have, however, seen an FPGA recreation of the Manchester Baby. More than once, even.

Continue reading “Virtual Museum Hosts Every OS You Haven’t Heard Of”

Linux Fu: The Bluetooth Regression

There’s a line in a [Weird Al] (no relation) song that says, “I upgrade my system at least twice a day…” I know how that is. I primarily use a rolling distro, OpenSuse Tumbleweed, and if I’m having a problem that I’m too lazy to run down, it is extremely tempting to do an upgrade and see if it just happens to fix the problem.

Of course, the problem is often caused by a previous upgrade. Recently, I’ve been having a lot of trouble with the NVIDIA proprietary drivers, so I updated them yet again. After a huge amount of effort to sort out the video problems, I found that the latest kernel didn’t like my MediaTek Bluetooth adapter, which is built into the motherboard’s WiFi chipset.

This post isn’t about how to fix your Bluetooth problem. You probably don’t have the same setup I do, and even if you do, it will be sorted out in a week or two anyway. But how I temporarily fixed this issue is worth documenting. The details are going to apply to Tumbleweed and this particular adapter, but the general approach should work anywhere with any sort of kernel module problem.

My Own Fault

Part of my problem is my own fault, of course. I have a complex disk setup and do not use the recommended btrfs root file system. That means I can’t do the snapshot thing where I can just undo a bad upgrade. If I did, then sure, I should just roll back and wait for an upstream fix.

I do have “normal” backups, but they are not always totally up to date. Worse, I have found that for things like NVIDIA, the user stuff and the kernel module stuff have to match up. That makes it very hard to roll back a kernel with older modules. The modules themselves live with the kernel, but the user space stuff gets pushed out. Or, if you uninstall things, it uninstalls it for all kernels.

Truthfully, NVIDIA and others like that should keep all the user space stuff in a kernel-specific place, and then symlink it at boot to /usr/bin or wherever. But they don’t. In the end, I didn’t want to go through the trouble of rolling things back and decided to push ahead.

Continue reading “Linux Fu: The Bluetooth Regression”

Remember When Flash Drives Were Going To Make Your PC Faster?

The 2000s was a decade of great change in the computer industry. The world had grown accustomed to corruptible floppy disks, blue screens of death, and achingly slow load times. In a few short years, all of that would change, as USB drives, better operating systems, and faster processors brought forth a new age of stability and speed.

Amidst this era of upheaval, Microsoft introduced a new technology. It was intended to increase performance on the cheap to a new generation of machines, but it would turn out to be little more than a gimmick that never really caught on. Let’s explore the easily-forgotten legacy of ReadyBoost.

Continue reading “Remember When Flash Drives Were Going To Make Your PC Faster?”

Wayland Comes To Minecraft

The overall adoption and implementation of Wayland — intended as a replacement for the decades-old X11 windowing system — in the Linux world has been full of fits and starts. But perhaps the most surprising adopter we’ve seen yet is this Minecraft patch which brings a full Wayland compositor into the game.

This software project, called Waylandcraft, is the brainchild of a developer known as [EVVIE] who spent a considerable amount of time and effort getting this to work. According to a post on GamingOnLinux it was also done the old fashioned way, with no AI involved.

Users wanting to run this compositor need a Linux system to run Minecraft, as well as the Fabric mod loader and a few other tools. For those wishing to show off to their friends, though, they’ll need to do so in-person as streaming the Wayland windows to other users in the server is not possible.

With everything running, you’ll be able to launch arbitrary programs and have the windows placed within the Minecraft world as if they were in-game. Users can place the windows in any orientation and can interact with them like any other desktop environment. [EVVIE] has released all of the code under the GPL for anyone wanting to try it out or build on the project itself.

If you haven’t spun up a Minecraft server at all yet, all you really need is something like an ESP32 to get started.

Continue reading “Wayland Comes To Minecraft

Bring Back That Aged Scanner, In Your Browser

We have probably all at some point had to replace a peripheral not because it is faulty, but because it is no longer supported by our operating system. It’s especially bad for Windows users, but for older hardware this is increasingly a part of the Linux experience too. [George MacKerron] is here with what may prove to be a valuable technique to keep these devices active. He’s running a minimalist x86 computer in the browser, with just enough OS to support the device.

In this case the hardware is a USB scanner, and the resulting software takes a WebAssembly x86 emulator and adds a bit of glue software allowing it to use WebUSB to talk to the real-world hardware. It runs a minimal Alpine Linux environment with SANE — something that’s normal for Linux users but which has never been there on a Windows machine. The result is something which needs no installation, but can be run on any machine with a powerful enough web browser.

While such an approach might at first seem like overkill, we’re told it runs surprisingly quickly. In this case it’s for scanner, but we can see it could find a use with many other pieces of aged hardware.

If WebAssembly is new to you, we gave it a primer a few years ago.


Header image: Fir0002/Flagstaffotos, GFDL 1.2.