Porting GCC

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Dandee Yuyo
Member
Member
Posts: 47
Joined: Fri Nov 09, 2007 6:46 pm
Location: Argentina

Porting GCC

Post 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... :roll: ...but I do want C++ :wink:
NaN - Not a Nerd
Working on: Physical Memory Management with a 5-lod mipmap XD
Yexo
Posts: 2
Joined: Sat Mar 10, 2007 8:20 am

Post 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.
maverick777
Member
Member
Posts: 65
Joined: Wed Nov 14, 2007 3:19 pm

Post by maverick777 »

yeah getting a full gcc port would be a great achievement for a solo dev :-) , good luck with it !
User avatar
Dandee Yuyo
Member
Member
Posts: 47
Joined: Fri Nov 09, 2007 6:46 pm
Location: Argentina

Post 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...
NaN - Not a Nerd
Working on: Physical Memory Management with a 5-lod mipmap XD
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Hi,

Have you read OS Specific Toolchain? Its worth it if you are considering porting GCC.

Cheers,
Adam[/wiki]
User avatar
Dandee Yuyo
Member
Member
Posts: 47
Joined: Fri Nov 09, 2007 6:46 pm
Location: Argentina

Post by Dandee Yuyo »

Thanks AJ! That's exactly what I was looking for :wink:
NaN - Not a Nerd
Working on: Physical Memory Management with a 5-lod mipmap XD
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Post 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 :wink:

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.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post 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).
Every good solution is obvious once you've found it.
User avatar
Dandee Yuyo
Member
Member
Posts: 47
Joined: Fri Nov 09, 2007 6:46 pm
Location: Argentina

Post 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
NaN - Not a Nerd
Working on: Physical Memory Management with a 5-lod mipmap XD
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

jnc100 wrote:I'm glad you said that, I was thinking I'd have to promote myself again :wink:
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 8) )

Cheers,
Adam
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post 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.
My OS is Perception.
Post Reply