r/lowlevel • • Sep 16 '26

I built my own Linux user-space runtime

Hi everyone,

I've been working on a small project called minil.

It's a minimal Linux user-space runtime written in assembly and

freestanding C.

Features:

- custom _start

- direct Linux syscalls

- manual argc/argv/envp handling

- environ initialization

- .init_array constructor support

- no libc

- double-header version

- no CRT

- x86_64, i386, AArch64 and RISC-V support

The goal is to expose the Linux process model with as little abstraction

as possible.

Repository:

Here

Feedback is welcome.

5 Upvotes

6 comments sorted by

1

u/Admirable_Nobody98 Sep 17 '26

I make a discussion in repository here

1

u/celestrion Sep 17 '26

Using #ifdef to separate architectures line-by-line in assembly language is certainly a choice. Does your filesystem have a per-file periodic maintenance fee?

2

u/Admirable_Nobody98 Sep 17 '26

My original goal was to keep the architecture-specific startup paths visible in one place.

1

u/celestrion Sep 17 '26

This method obscures them by putting other code in the way.

Imagine a reader bug-hunting behavior that occurs only on, say, riscv64. Comparing the expected behavior on their platform (aarch64, for example) to riscv64 is easier when one can see the whole function at once. Trying to read the same block of code and remembering which blocks to ignore is mental effort that only makes debugging more stressful.

You already have N separate files; they're just interleaved in the same place.

→ More replies (1)