Replies: 4 comments 2 replies
-
Thank you for your feedback. There were several proposals to add new MIR insns. It is a pretty common request. I'd like to have a general solution for this. GCC has asm extension. It is probably too much as it practically requires assembler implementation. So I am thinking about simpler solution. I have some ideas but did not figure out the final solution yet. But I'll work on this as it is important feature for me too. |
Beta Was this translation helpful? Give feedback.
-
.. which is only an advantage (and a small one at that) if you dont want to link with any libraries written in C, unless they themselves use nothing of libc. otherwise your program has to go through C startup code anyway to have global structures like malloc heap, etc, set up. in the long run it's much easier to call e.g. libc |
Beta Was this translation helpful? Give feedback.
-
From another thread, the answer for calling external code is:
So you’d write a tiny C function that invokes the syscall, and use that resolver to link a Mir function to it. I don’t understand your point about avoiding libc, because whatever process is using Mir to run code already contains the Mir library, which is written in C and hence calls libc. Mir doesn’t produce standalone executables — it’s a JIT not an AOT compiler. |
Beta Was this translation helpful? Give feedback.
-
I guess there is a point for automatic import of libc functions for C code. Currently |
Beta Was this translation helpful? Give feedback.
-
From what I've seen, there are no built-in instructions for system calls and interrupts so could you consider adding them? We could probably get away with them by creating libraries in assembly and link with them but this is very clunky and doesn't feel good at all. I had the same problem with QBE and they didn't want to add it took. Tho, in QBE, you'll at least use assembly files and won't have to generate an ELF library which makes things a little bit better (still not as good as built in however).
Beta Was this translation helpful? Give feedback.
All reactions