An agentic LLM should be pretty good at Arm64 assembly generation, but maintainability of large code could become an issue. Why would it not run on Linux?
An agentic LLM should be pretty good at Arm64 assembly generation, but maintainability of large code could become an issue. Why would it not run on Linux?
I wrote it for MacOS because I don't have a Linux machine right now :( Once I get one up and running again, I'll probably work on porting this.
As for why it wouldn't run on Linux, there are some pretty big differences in the actual assembly. One pretty superficial difference is calling conventions -- MacOS uses the x16 register for syscall numbers, Linux uses x8. Calling the kernel in Mac uses "svc #0x80", in Linux it's "svc #0". That's ~120 lines that need to be replaced, but easy enough to just use sed. Syscall numbers are all different, as are the struct layouts for sigaction(), MacOS has an "sa_tramp" field that Linux doesn't have. Enforcing max processes is done here using the MacOS-specific proc_info() syscall, which can be used to get the number of children any given process has. Linux doesn't have an equivalent, so process tracking would need to be done differently. Finally, Linux has the getdents64() syscall, rather than getdirentries64(), which uses a different struct and is called differently.
I'm sure an LLM could make all those changes, but it's a pretty large codebase, so it would probably make some mistakes or miss things.
You could always start in a virtual environment.
Is it not possible to maintain a single codebase for both OS with appropriate .ifdef commands?
It would be possible, but impractical for where this project is now. In retrospect, I could have written it with more portability from the start, but since it was just a personal learning project I didn’t think too hard about it. Aside from syscall numbers all being different (which would just require changing the consts in defs.S), syscall numbers are stored in the x16 register on MacOS vs x8 on Linux, and the kernel is called with svc #0x80 on MacOS vs svc #0 on Linux. The bigger issue at this point is MacOS-specific syscalls. proc_info() doesn’t exist on Linux, so that would need to be rewritten. The sigaction struct also has different members (Linux doesn’t have sa_tramp), as well as every other struct having different offsets and sizes. getdirentries64() also doesn’t exist on Linux, it has getdents64() which is called differently and has different output as well I believe, so directory.S would need to be reworked too.
The first paragraph of the README says this was hand written so I’m not sure why you’re bringing up LLMs
Because it's absurd for most people to write too much Assembly by hand.
What if the author wants to learn? Is learning just out of style now?
I'd be doing the same kind of thing if I had more free time.
So go learn, and stop harassing others who are okay with using an LLM for some tasks.
You're the only person harassing anyone here; someone wanted to show off a handwritten project they did to learn a thing, and you came in with unsolicited LLM crap.
Pay closer attention. Using an LLM is the only way to get it be cross-compatible with Mac and Linux, since the author admitted that it would be too much to do this by hand. What good is code that can't even run? Heck it can't even run on Docker on a Mac.
Have you considered that as a hobby project, cross-compatibility (and especially on a tight timeline) might not be a priority, or even the point?
How is that relevant to a general audience? Why does such an obscure hobby project deserve attention by a broad audience if one can't even run it on a Linux-like VPS? It doesn't, and I was faithfully attempting to bridge that gap, with your nasty trolling interruption coming in the way.
I don't know how much you know about assembly code, but people write it professionally to squeeze performance, typically on a server, and servers are lot more likely to run Linux than Mac. The project in question literally is a web server. Who runs a real production-grade web server on a Mac?
Show HN has a long history of people just posting random shit they’ve built that they think is cool.
Some of it is in pursuit of productization feedback. Some of it isn’t.
The general audience here is (or at least, used to be) tech enthusiasts, and you can usually assume that crowd will enjoy cool shit in tech.
Personally I’ve had to occasionally hand write x86 assembly for work on a handful of occasions to ensure certain runtime guarantees were met that the programming language i was using couldn’t provide directly. I’ve used it a ton in hobby projects because it’s just kinda cool, and i want to have a better understanding of that world.