šŸ§ Better Linux Support - June 2021 Mass Progress Update

Dmitriy Kubyshkin ā€”
The major item this month for me was the feature between Windows and Linux JIT implementations. Getting Linux to run some bytes I passed to it was the easy part and took like 30 min to do .
The hard part was getting System V ABI to a workable state. One reason is the fundamental complexity of the algorithm used to determine how arguments are packed to register, but it is also made worse by the fact that the technical documentation leaves much to be desired.

Also on the Linux front there is now support for referencing dynamic libraries in the JIT:

1
2
3
4
5
6
7
8
write :: fn(descriptor : s32, buffer : &u8, size : u64)
  -> (s64) external("libc.so.6", "write")
STDOUT_FILENO :: 1
main :: fn() -> () {
  hello :: "Hello, world!\n"
  write(STDOUT_FILENO, hello.bytes, hello.length)
  import("std/process").exit(0)
}


Besides a ton of refactoring here are some more highlights:


A year ago I tried to understand the System V ABI for passing arguments when I was doing some assembly on linux and was very confused. I didn't pushed a lot since I needed only the basics for a specific case, but if you ever do the full arguments passing and return values, I would be interested to watch it.