OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Jul 28, 2017 12:59 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 28 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Cross compiler step one`
PostPosted: Tue Jan 31, 2017 1:58 pm 
Offline

Joined: Tue Aug 26, 2014 9:12 pm
Posts: 15
I am still a little confused on what gcc or binutils compilation options to build for the i686-elf target. I have 6.3 gcc and 2.27 binutils and I think they're the latest. I am in a linux x64 enviornment but bare bones wants i686-elf. I am considering,

--enable-multilib, i686-elf --disable-nls --without-headers

Now do I need -ffreestanding ?

I am not sure what that's for.


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Tue Jan 31, 2017 3:02 pm 
Offline

Joined: Sun Apr 05, 2015 3:15 pm
Posts: 16
Location: Belgium
If you are building a crosscompiler for your kernel, you are not providing a standard C library and you are also not providing include headers (as you can see in your configure command). So you don't need to provide -ffreestanding.

_________________
OS: https://github.com/SharpNative/


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Tue Jan 31, 2017 3:10 pm 
Offline

Joined: Tue Aug 26, 2014 9:12 pm
Posts: 15
ndke wrote:
If you are building a crosscompiler for your kernel, you are not providing a standard C library and you are also not providing include headers (as you can see in your configure command). So you don't need to provide -ffreestanding.


Ok so not providing the C library is what I want to do. What about this libgcc library. It's not a standard C library but you don't want it for kernel creation either do you?


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Tue Jan 31, 2017 3:12 pm 
Offline
Member
Member
User avatar

Joined: Sun Dec 25, 2016 1:54 am
Posts: 195
x86_64 kernel - don't forget

Code:
-mno-red-zone


libgcc multilib --- http://wiki.osdev.org/Libgcc_without_red_zone

libgcc is almost required for kernel depending on what code you write... http://wiki.osdev.org/Libgcc

In my case, it was preferable to go the full distance for a full cross compiler with sysroot

http://wiki.osdev.org/OS_Specific_Toolchain

It worth learning the options for configuring binutils and gcc

_________________
Plagiarize. Plagiarize. Let not one line escape thine eyes...


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Tue Jan 31, 2017 3:24 pm 
Offline

Joined: Tue Aug 26, 2014 9:12 pm
Posts: 15
dchapiesky wrote:
x86_64 kernel - don't forget

Code:
-mno-red-zone


libgcc multilib --- http://wiki.osdev.org/Libgcc_without_red_zone

libgcc is almost required for kernel depending on what code you write... http://wiki.osdev.org/Libgcc

In my case, it was preferable to go the full distance for a full cross compiler with sysroot

http://wiki.osdev.org/OS_Specific_Toolchain

It worth learning the options for configuring binutils and gcc


What do you mean "x86_64 kernel..." That is my host environment yeah but I want to build a 32 bit kernel for a 32 bit OS.


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Tue Jan 31, 2017 3:31 pm 
Offline
Member
Member
User avatar

Joined: Sun Dec 25, 2016 1:54 am
Posts: 195
sorry - missed i686 -- but still full os specific compiler is worth it

_________________
Plagiarize. Plagiarize. Let not one line escape thine eyes...


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Tue Jan 31, 2017 10:27 pm 
Offline
Member
Member

Joined: Mon Jan 03, 2011 6:58 pm
Posts: 269
Are you building a cross compiler to build your kernel? In which case see http://wiki.osdev.org/GCC_Cross-Compiler
If you are trying to build (on your host platform) a compiler that will compile programs to run on your OS, see http://wiki.osdev.org/OS_Specific_Toolchain

- Monk


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Thu Feb 02, 2017 2:55 pm 
Offline
Member
Member
User avatar

Joined: Tue Mar 06, 2007 11:17 am
Posts: 984
I made a video that shows how to compile a cross compiler for your custom OS kernel step by step.

If you watch it and repeat everything you see done to make the compile, or if you watch it and then repeat, then you will be able to understand how to build your cross compiler:

OSDev.org Tutorial: Build an i686-elf Cross Compiler under 64-bit Ubuntu Desktop 16.04.1

_________________
Image http://www.archefire.org/_PROJECTS_/ (udocproject@yahoo.com)

YouTube Development Videos:
http://www.youtube.com/user/AltComp126/videos

Current IP address for hosts file (all subdomains):
190.150.9.244 archefire.org


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Thu Feb 02, 2017 3:57 pm 
Offline
Member
Member
User avatar

Joined: Sun Dec 25, 2016 1:54 am
Posts: 195
~ wrote:
I made a video that shows how to compile a cross compiler for your custom OS kernel step by step.



4 hours 51 minutes... sounds about right... will let play while I work.... can we get a transcript :wink:

either way your effort is acknowledged and appreciated.... =D>

Now start work on x86_64, arm, ppc, sparc, and z80....

_________________
Plagiarize. Plagiarize. Let not one line escape thine eyes...


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Mon Feb 06, 2017 2:23 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7094
Location: Germany
~ wrote:
I made a video...


...of written and annotated instructions, where people get explanations of every twist and turn involved in the process, and turned it into a five-hour video of "watch the compiler output"?

Unedited?

#-o

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Mon Feb 06, 2017 4:22 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 709
Location: Tallinn, Estonia
Solar wrote:
and turned it into a five-hour video of "watch the compiler output"?


Well, it's probably too slow machine; usually compiling full gnu toolchain fits into 1 hour, compiling LLVM into 1 hour and then some.

_________________
Learn to read.


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Mon Feb 06, 2017 7:54 am 
Offline
Member
Member
User avatar

Joined: Sun Dec 25, 2016 1:54 am
Posts: 195
3.2ghz 2 core I3 with hyperthreading does a gcc 6.3 bootstrap compiler/cross compiler/newlib/cross compiler w/sysroot in 25 minutes....

_________________
Plagiarize. Plagiarize. Let not one line escape thine eyes...


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Mon Feb 06, 2017 10:16 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 285
Location: East Riding of Yorkshire, UK
dchapiesky wrote:
3.2ghz 2 core I3 with hyperthreading does a gcc 6.3 bootstrap compiler/cross compiler/newlib/cross compiler w/sysroot in 25 minutes....
I'm sure it should be faster than that? Are you passing j4 or j5 to make?

_________________
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Mon Feb 06, 2017 11:37 am 
Offline

Joined: Tue Aug 26, 2014 9:12 pm
Posts: 15
Well the makefile broke on me. I am using gcc-6.0.3. I build with my compiler this "isl" library, gmp, mpc, mpfr that gcc needs. The binaries I put together in a directory called 'build'. With the compiler it said no linking allowed after GCC_NO_EXECUTABLES so what's that mean. Is there a linker switch somewhere that needs turned off? I compiled with the 'configure' script these options,

--with-gmp=
--with-isl=
--with=mpc=
--with-mpfr=

To tell the compiler where they are. I also used,

--enable-languages=c --enable-multilib --without-headers --prefix=/mnt --disable-nls i686-elf

What have I left out or do I need?


Top
 Profile  
 
 Post subject: Re: Cross compiler step one`
PostPosted: Mon Feb 06, 2017 11:59 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 886
Location: Athens, GA, USA
Let's dig a bit deeper here. Please start by telling us the development host environment - you have mentioned that it is an x86-64 CPU, but not the OS it is running under. If you could also post (or link to a repo of) the makefile and linker script, that would help as well.

Mind you, I mean the makefile and linker script for the cross-compiler build, not the one you would use for building the OS image from the cross-compiler. I have this suspicion that there is a bit of confusion there, in that it sounds as if your makefile is set to build an ELF32 file for the cross-compiler, which would not be the correct course of action if it is hosted on a 64-bit OS (and especially so if it is a host OS that doesn't use ELF as its executable format, such as Windows or MacOS). The cross-compiler might be set to target a 32-bit ELF, but the cross-compiler itself would run in the native executable format and bit width of the development host.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
μή εἶναι βασιλικήν ἀτραπόν ἐπί γεωμετρίαν
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

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