OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 9:15 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Porting newlib without execve
PostPosted: Thu Nov 19, 2009 4:51 pm 
Offline
Member
Member
User avatar

Joined: Thu Nov 05, 2009 5:04 pm
Posts: 234
Location: UK
Hi,

I am planning when i am far enough into OS development to port newlib to my OS then from there use that to compile gcc and binutils for my OS. However, i am unsure as to what will happen if i do not implement execve() in newlib, would this break any possibility of running gcc?

It seems gcc is pretty much tied to unix style schemantics, and i do not want to implement execve() in my OS, i am going to be going for a more CreateProcess style function instead. exec however has special behaviour in that it replaces the text portion of the code and leaves the environment, file handles etc intact, and causes the actual caller to be *replaced* (e.g. it never actually returns) where createprocess would return, and spawn a second process much like fork() and exec() combined.

So in short, can i get away with not implementing execve() and still be able to port gcc?

_________________
My homepage. | Discord RPG Bot | D++ - The C++ Discord API Library for Bots


Top
 Profile  
 
 Post subject: Re: Porting newlib without execve
PostPosted: Thu Nov 19, 2009 6:36 pm 
Offline
Member
Member

Joined: Sun Jan 14, 2007 9:15 pm
Posts: 2566
Location: Sydney, Australia (I come from a land down under!)
Simply put, no.

Vanilla ports of GCC (no patching) use execve several times during a conventional run (at least once to run "cc1" or "cc1plus", and once more to run "as", and then "collect2" and "ld" if you don't specify "-c"). If you want to port applications which depend on POSIX semantics, you can't get around it.

In my OS, I have a POSIX subsystem which will be separate from the native OS-specific native API, which means it's possible to run POSIX applications alongside native applications. In your case, this would mean a set of POSIX system calls with POSIX semantics (exec and so on), and a set of native system calls with your semantics (CreateProcess).

_________________
Pedigree | GitHub | Twitter | LinkedIn


Last edited by pcmattman on Fri Nov 20, 2009 3:14 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Porting newlib without execve
PostPosted: Fri Nov 20, 2009 3:04 am 
Offline
Member
Member

Joined: Sun Feb 01, 2009 6:11 am
Posts: 1070
Location: Germany
If patching gcc (or rather libiberty) is an option for you, it's quite possible to run gcc without separate fork/exec functions. Internally it uses an abstraction on your CreateProcess level, so we implemented pex_tyndur_exec_child and were happy. Of course, with the next POSIX program expecting fork/exec, you need to patch again...

_________________
Developer of tyndur - community OS of Lowlevel (German)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], SemrushBot [Bot] and 114 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group