3 ms·
At the end he mentions openbsd sharing the same ABI (as linux?). Is this correct?
by etaioinshrdlu 5y ago
At the end he mentions openbsd sharing the same ABI (as linux?). Is this correct?
- geofft 5y agoYes, the ABI in the sense of calling convention is the same on just about all amd64 UNIXes, including even macOS. Wikipedia has a good reference: https://en.wikipedia.org/wiki/X86_calling_conventions#System_V_AMD64_ABI https://en.wikipedia.org/wiki/X86_calling_conventions#System... And Linux and OpenBSD both use ELF binaries. But that only really helps you if you're writing a self-contained library with no dependencies (which, I suppose you could be writing something like a SHA-256 implementation that takes a const char * and writes to a char *, or something). For just about any real program, you'll run into the problem that the libcs are different and the system call interfaces are different. If you want to use libc, most immediately, the filenames and symbol versions are different (e.g., you won't find libc.so.6 on OpenBSD, let alone /lib64/ld-linux-x86-64.so.2 or GLIBC_2.24). But also structure layouts will potentially be different, the values of constants will be different, etc. If you don't want to use libc, you'll run into the problem that the system call numbers aren't the same (even if the actual system call mechanism is the same!).
- fomine3 5y agoIt's time to cosmopolitan libc https://news.ycombinator.com/item?id=27180182 https://news.ycombinator.com/item?id=27180182