Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Getting the GNU EFI toolchain to work is somewhat involved. The result is also convoluted for reasons I don’t understand. For example, it uses a perfectly normal GCC that is perfectly capable of defining and invoking __stdcall functions, but instead it has assembly thunks you’re supposed to use to translate to and from __cdecl. AFAICT it shouldn’t be that much harder than a bunch of header files, a freestanding compiler invocation with a custom crt0 and an objcopy to make the PE file (OK, yeah, PE relocations are different from ELF ones, but still), yet the standard C setup you’ll find on OSDev Wiki or similar is, in fact, quite annoying to use.


I've never actually used gcc to target UEFI, but under Clang and other LLVM based compilers it really is just a few flags and header files. If I recall correctly my little demo linked above predates any sort of UEFI support in zig and just uses what LLVM provides, you can see how straightforward the whole thing is in the makefile (the little bit of assembly is unrelated to UEFI): https://github.com/liampwll/zig-efi-os/blob/master/Makefile

Edit: Here's a minimal example using clang from someone else: https://github.com/AndreVallestero/minimal-efi




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: