Porting Binutils: On the way to self hosting

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.
User avatar
Muneer
Member
Member
Posts: 104
Joined: Tue Nov 02, 2010 2:05 am
Location: India

Re: Porting Binutils: On the way to self hosting

Post by Muneer »

Thanks to all who helped. Next is an attempt on GCC and then I guess I will drop this porting business for sometime and concentrate on my Os.
porting of binutils is over. porting of gcc is about to begin :)
Even the smallest person could change the course of the future - Lord Of The Rings.

In the end all that matters is what you have done - Alexander.

Even after a decade oh god those still gives me the shivers.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Porting Binutils: On the way to self hosting

Post by Solar »

HardCoder wrote:The output is different from ld "-v" on my ubuntu
GNU ld (GNU Binutils for Ubuntu) 2.21.0.20110327
Virtually all Linux distributions employ customized / patched versions of common tools like binutils / GCC. One of the reasons (for me, at least) to use a cross-compiler even under Linux - I don't want to end up having relied on something distro-specific and being caught unaware by some system update. (The sources for the Cygwin binutils / GCC, for example, don't even compile when following our tutorial.)

Congratulations on going self-hosted. I believe it's the most important step in the history of any hobbyist OS - being capable to compile itself.

Some commercial operating systems weren't...
Every good solution is obvious once you've found it.
User avatar
Muneer
Member
Member
Posts: 104
Joined: Tue Nov 02, 2010 2:05 am
Location: India

Re: Porting Binutils: On the way to self hosting

Post by Muneer »

@Solar
Thanks man.


And finally I got my wish. SUCCESSFULLY PORTED GCC.
For anyone who wishes to port GCC, you must have to implement these functions apart from newlib essentials and binutils-essentials(see earlier post)

Code: Select all

mkdir
pipe 
dup2 
alarm
execvp
closedir
opendir
readdir
chdir
execv
And also have to modify the newlib <sys/dirent.h>

Code: Select all

/* <dirent.h> includes <sys/dirent.h>, which is this file.  On a
   system which supports <dirent.h>, this file is overridden by
   dirent.h in the libc/sys/.../sys directory.  On a system which does
   not support <dirent.h>, we will get this file which uses #error to force
   an error.  */

// as per unix dirstreams.h
struct __dirstream { 
	int fd;
};

typedef struct __dirstream DIR;

struct dirent {
	ino_t  d_ino    ;//   file serial number
	char   d_name[512];//    name of entry
};

#ifdef __cplusplus
extern "C" {
#endif

int            closedir(DIR *);
DIR           *opendir(const char *);
struct dirent *readdir(DIR *);
int            readdir_r(DIR *, struct dirent *, struct dirent **);
void           rewinddir(DIR *);
void           seekdir(DIR *, long int);
long int       telldir(DIR *);

#ifdef __cplusplus
}
#endif


I feel very self-hosted. :)
Even the smallest person could change the course of the future - Lord Of The Rings.

In the end all that matters is what you have done - Alexander.

Even after a decade oh god those still gives me the shivers.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Porting Binutils: On the way to self hosting

Post by gerryg400 »

That is cool, well done. I hope to be there by the middle of next year.

Next step is to run configure and make in your shell and build binutils, gcc and newlib natively.
If a trainstation is where trains stop, what is a workstation ?
User avatar
Muneer
Member
Member
Posts: 104
Joined: Tue Nov 02, 2010 2:05 am
Location: India

Re: Porting Binutils: On the way to self hosting

Post by Muneer »

gerryg400 wrote:That is cool, well done
Thanks.
gerryg400 wrote: Next step is to run configure and make in your shell and build binutils, gcc and newlib natively.
Not anytime soon though.
Even the smallest person could change the course of the future - Lord Of The Rings.

In the end all that matters is what you have done - Alexander.

Even after a decade oh god those still gives me the shivers.
Post Reply