Writing bare metal code in Odin #1081
AlectronikForge
started this conversation in
Planning
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm intending to write a toy kernel in primarily Odin. Read under "Issues" that freestanding target is mentioned but didn't find the corresponding thread here. so I'm posting new.
Tried to compile an exported hello world function with -no-crt and linked it with a corresponding C main void which calls said hello world routine. Linking only worked with -extra-linker-flags:-fPIE and the symbol main was defined even with -no-entry-point but these are minor issues.
Problem is that the resulting binary crashes with SIGSEGV, invalid address 0x0. By the way, is there yet a way to get debug information for use with lldb/gdb?
I'd offer to port the runtime library either to bare metal or to a minimum amount of hardware abstracting C code which then could be ported to any os one wants. Where to start with this, as far as I see either -no-crt doesn't work or it refers to different stuff but a main() and some runtime stuff is still compiled in.
Could you guide me into the right direction?
Also I'd love to see classes and/or solid macro features which could be used to write a classes module in Odin, as features of it, possibly also in the sense of the 'pony' language's actors which have multithreading built in but just thread safety might fit more with the system programming approach.
Beta Was this translation helpful? Give feedback.
All reactions