Page 1 of 1
Porting GCC
Posted: Mon Nov 26, 2007 3:27 pm
by Dandee Yuyo
Would it be to complex to port GCC to my OS once it's finished?
Has anyone tried this? Tips? Hints? Suggestions?
I'm also considering SmallC as an option...
...but I do want C++
Posted: Mon Nov 26, 2007 5:08 pm
by Yexo
That depends heavily on when you consider your os finished. Once you have a completed c library ported to your os, it should be relative easy.
Posted: Tue Nov 27, 2007 8:36 am
by maverick777
yeah getting a full gcc port would be a great achievement for a solo dev
, good luck with it !
Posted: Tue Nov 27, 2007 10:57 am
by Dandee Yuyo
Well, that's why I'm asking for some input, as to have an idea of the implied cost. I read somewhere on this forum that it was easier to port newlib than gcc's libc, so someone might already have done this.
btw, DJ Delorie
ported GCC to the Windows platform...
Posted: Tue Nov 27, 2007 11:02 am
by AJ
Hi,
Have you read
OS Specific Toolchain? Its worth it if you are considering porting GCC.
Cheers,
Adam[/wiki]
Posted: Tue Nov 27, 2007 11:12 am
by Dandee Yuyo
Thanks AJ! That's exactly what I was looking for
Posted: Tue Nov 27, 2007 12:50 pm
by jnc100
AJ wrote:Have you read OS Specific Toolchain? Its worth it if you are considering porting GCC.
I'm glad you said that, I was thinking I'd have to promote myself again
The tutorial linked to will get you as far as creating a cygwin/linux
hosted gcc/binutils/newlib that targets your os. Once you have that, you'd need to then use that toolchain to create native apps that actually run on your os. Of course one of these could be gcc, which in theory should compile and run with any standard c library (and you'll have just compiled newlib). Therefore, once you have finished the tutorial, using the same (modified) sources, you should be able to do something like
Code: Select all
../binutils/configure --target=i586-pc-myos --host=i586-pc-myos
and similarly for gcc. You'd need to make sure i586-pc-myos-gcc/as/ld etc are somewhere in your cygwin/linux $PATH. Obviously specify a different prefix to install the myos hosted apps in, then copy to whatever filesystem your os uses. This isn't in the wiki because I haven't verified that it works. Once you have that, all you need is an os that can load and execute programs and supports all the necessary syscalls.
Regards,
John.
Posted: Tue Nov 27, 2007 1:19 pm
by Solar
Dandee Yuyo wrote:I read somewhere on this forum that it was easier to port newlib than gcc's libc...
GCC doesn't have a libc. You are probably referring to the
glibc, which isn't related to GCC (aside from being a GNU project).
Posted: Tue Nov 27, 2007 2:53 pm
by Dandee Yuyo
You are probably referring to the glibc, which isn't related to GCC
Yes, you are right Solar. I was particulary referring to this thread:
http://www.osdev.org/phpBB2/viewtopic.php?t=15089
Posted: Tue Nov 27, 2007 3:19 pm
by AJ
jnc100 wrote:I'm glad you said that, I was thinking I'd have to promote myself again
I'm quite happy to promote it having got it working with (relatively) little problem (just one question about it on the forum - not too bad
)
Cheers,
Adam
Posted: Wed Nov 28, 2007 7:58 am
by AndrewAPrice
If you've ported a C standard library like Newlib, then it would be easy to get Binutils and GCC up and running.