OSDev.org
https://forum.osdev.org/

GCC instructions in GCC Cross Compiler
https://forum.osdev.org/viewtopic.php?f=8&t=31559
Page 1 of 1

Author:  davidv1992 [ Sat Apr 22, 2017 7:56 am ]
Post subject:  GCC instructions in GCC Cross Compiler

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?

Author:  dozniak [ Sat Apr 22, 2017 8:27 am ]
Post subject:  Re: GCC instructions in GCC Cross Compiler

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.

Author:  davidv1992 [ Sat Apr 22, 2017 8:37 am ]
Post subject:  Re: GCC instructions in GCC Cross Compiler

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:
../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?

Author:  dozniak [ Sat Apr 22, 2017 9:34 am ]
Post subject:  Re: GCC instructions in GCC Cross Compiler

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

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/