5 ms·
Pros and cons to the libc ABI approach. It works very well for things that are C or mostly C-compatible (C++, maybe Rust, maybe other more esoteric languages),
by loeg 8y ago
Pros and cons to the libc ABI approach. It works very well for things that are C or mostly C-compatible (C++, maybe Rust, maybe other more esoteric languages), or interpreters with a strong grounding in C (Python; Ruby; historically, Java). It doesn't mesh well with Golang's choice to avoid linking libc, which in practice probably only works out because Linux maintains syscall ABI stability forever.
- tedunangst 8y agoGo works reasonably well on openbsd despite syscall churn. You really only need to make it to uname() to decide what to do.
- int_19h 8y agoIt also means that older compiled code might not necessarily work on new releases. This is probably not a big deal on OpenBSD, but on e.g. macOS it was big enough that they moved to libc.
- favorited 8y agoBy contrast, Go would break constantly on macOS betas. The Mac/iOS kernel interface is libSystem, not direct syscalls. Thankfully, they changed that in Go 1.11 (https://golang.org/doc/go1.11#runtime https://golang.org/doc/go1.11#runtime)
- loeg 8y agoThat's not really contrast; OpenBSD doesn't maintain syscall ABI stability and only supports releases for six months at a time. It's a similar problem.
- favorited 8y agoBy "contrast" I was referring to the statement "Go works reasonably well on openbsd." I don't consider breaking on macOS betas working "reasonably well."
- loeg 8y agoI expect the statement "Go works reasonably well on OpenBSD" is being overly charitable to how frequently it breaks across releases and in reality the experience is likely similar to MacOS betas.
- quotemstr 8y agoIf Golang decides to avoid the platform interface library, any resulting problems are on Golang. I totally get Go's "not C" ethos, but there's no incompatibility between being not C and making system calls the way that programs are expected to make them on a platform. Go is flagrantly and needlessly incompatible with a lot of things, and there's no functionality or performance rationale for it. There is absolutely nothing about the Go language or runtime environment that excuses them calling into libc to do platform things. Nothing. Every other managed language environment does it, and Go can too.
- int_19h 8y ago> Go is flagrantly and needlessly incompatible with a lot of things If you don't mind me asking, what are you thinking about, syscalls aside? The way they handle stack?
- johncolanduoni 8y agoThe big reason on Linux is libc symbol versioning. You can inadvertently link to newer versions of glibc symbols if you don’t build on a platform using the oldest libc you support. Go binaries have the advantage of being able to run on any Linux kernel they support, regardless of what distro and version they were built on. With Rust I usually end up having to compile a bunch of build-time dependencies from source on my build images because of this, instead of just using a version of Debian etc. new enough to have the right dependencies in the package repo. However I don’t think Go ‘s approach makes sense on some other platforms (e.g. macOS) that don’t suffer from this issue. In those cases you sacrifice forward compatibility for no real benefit.
- gok 8y agoGolang is the extreme exception here