Page 2 of 2
Re: Porting Binutils: On the way to self hosting
Posted: Tue Dec 06, 2011 7:12 am
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
Re: Porting Binutils: On the way to self hosting
Posted: Tue Dec 06, 2011 9:18 am
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...
Re: Porting Binutils: On the way to self hosting
Posted: Tue Dec 06, 2011 10:13 am
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.
Re: Porting Binutils: On the way to self hosting
Posted: Tue Dec 06, 2011 1:41 pm
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.
Re: Porting Binutils: On the way to self hosting
Posted: Tue Dec 06, 2011 2:49 pm
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.