Page 1 of 1
OS toolchain for non Unix like OS
Posted: Thu Jul 23, 2020 1:49 pm
by nexos
Hello,
NexOS is ready for an OS specific toolchain. However being non Unix-like, how would I port Newlib? My API is going to different then POSIX. Could I just stub the functions required for libgcc?
Thanks,
nexos
Re: OS toolchain for non Unix like OS
Posted: Thu Jul 23, 2020 2:02 pm
by crosssans
I think it's one of the disadvantages of making a unique API (but don't get me wrong, I don't say this is bad practice - I also plan on making my own API) - One way to address this problem is by providing a bridge between your API and POSIX. That way, you can then provide the headers required & link the program against your bridge (which would be a separate library on it's own). The other solution would be to literally develop your tools (which can be fun to do BUT time consuming ALTHOUGH this would be a good thing anyways since that way you would test your API as you develop it; see this article on the OSDev Wiki that talks about on how to create a compiler from scratch:
https://wiki.osdev.org/Making_a_Compiler)
Note: I may be wrong in what I'm saying here, correct me if I'm wrong - I'll be happy to hear a correct answer to this question
Re: OS toolchain for non Unix like OS
Posted: Thu Jul 23, 2020 2:30 pm
by iansjack
Are you getting confused between libgcc (provided by gcc) and libc (provided by newlib)?
If you are going to use your own api then you could always just write your own libc to fit your api. Having your own api and then trying to shoehorn it into a library that is Posix-based seems a bit pointless to me.
Re: OS toolchain for non Unix like OS
Posted: Thu Jul 23, 2020 2:36 pm
by crosssans
iansjack wrote:If you are going to use your own api then you could always just write your own libc to fit your api. Having your own api and then trying to shoehorn it into a library that is Posix-based seems a bit pointless to me.
Oh well, fair enough - I also though that this was not the best solution to choose from although I couldn't find much better when I wrote my answer
Re: OS toolchain for non Unix like OS
Posted: Thu Jul 23, 2020 3:44 pm
by Octacone
Porting newlib... Just write your own. Go big or go home. POSIX sucks anyways, why would you want to have a custom api with newlib, ewww.
Re: OS toolchain for non Unix like OS
Posted: Thu Jul 23, 2020 4:55 pm
by nexos
I just read the wiki article
Hosted GCC Cross-Compiler, and that answered my question.
Re: OS toolchain for non Unix like OS
Posted: Wed Jul 29, 2020 1:57 am
by ITchimp
nexos can you help me on this question?
viewtopic.php?f=1&t=37051