GCC instructions in GCC Cross Compiler

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

GCC instructions in GCC Cross Compiler

Post by davidv1992 »

My personal project is slowly moving towards supporting a meaningfull userspace, and in preparation for that I've started to delve deeper into building crosscompilers, and systems in general. In looking at the approach taken by the linuxfromscratch book at building what is essentially a cross compiler I find it's approach (explicitly indicating what we dont need during the configure step) more elegant (http://www.linuxfromscratch.org/lfs/vie ... pass1.html).

I have tried compiling a cross compiler to i686-elf using these --disable flags and so far haven't noticed any downsided. Is there a reason the wiki currently suggests using the individual make targets all-gcc and all-libgcc instead of taking the other approach?
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: GCC instructions in GCC Cross Compiler

Post by dozniak »

Afaik, the cross-GCC in the LFS is only used to build actual target gcc and start of the userspace so that you could move into the system chroot and start building packages on the host system itself.

After you build a local copy of libc and some packages with it you will need to build the actual working host GCC later.

The flags specified in this article do not make this gcc a functional freestanding cross-compiler for OSdev.
Learn to read.
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

Re: GCC instructions in GCC Cross Compiler

Post by davidv1992 »

OK, for clarity, i did not mean the exact flags as used in those instructions, as those are clearly for producing a compiler targetting i686-lfs-linux-gnu. In fact, the actual steps I used for my current i686-elf targetting compiler are:

Code: Select all

../gcc-5.4.0/configure --target=i686-elf --prefix=/home/david/osdev-tools --disable-nls --enable-languages=c, --without-headers --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatomic --disable-libgomp --disable-libmpx --disable-libquadmath --disable-libssp --disable-libvtv --disable-libstdcxx
make
make install
To the best of my understanding, this produces a freestanding compiler, but does not require the use of the all-gcc and all-libgcc targets, which I see as a more elegant approach. Are there any things I am missing that make this different from the wiki suggested method in a way that could produce problems?
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: GCC instructions in GCC Cross Compiler

Post by dozniak »

I've long ago switched to Clang for osdev, so i can't help you with details.
Learn to read.
Post Reply