OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2024 5:23 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: GCC instructions in GCC Cross Compiler
PostPosted: Sat Apr 22, 2017 7:56 am 
Offline
Member
Member

Joined: Thu Jul 05, 2007 8:58 am
Posts: 223
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?


Top
 Profile  
 
 Post subject: Re: GCC instructions in GCC Cross Compiler
PostPosted: Sat Apr 22, 2017 8:27 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 723
Location: Tallinn, Estonia
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.


Top
 Profile  
 
 Post subject: Re: GCC instructions in GCC Cross Compiler
PostPosted: Sat Apr 22, 2017 8:37 am 
Offline
Member
Member

Joined: Thu Jul 05, 2007 8:58 am
Posts: 223
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?


Top
 Profile  
 
 Post subject: Re: GCC instructions in GCC Cross Compiler
PostPosted: Sat Apr 22, 2017 9:34 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 723
Location: Tallinn, Estonia
I've long ago switched to Clang for osdev, so i can't help you with details.

_________________
Learn to read.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 2 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