This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Do I need binutils/newlib to configure and install gcc?


> From: Desmond Cheung <dycheung@cs.sfu.ca>
> Subject: Do I need binutils/newlib to configure and install gcc?

GCC needs an assembler and a linker. If you are building an all-GNU solution,
then you need binutils to provide them.

GCC itself doesn't (or at least shouldn't) require newlib or any other
libraries to build and to compile C code into object code. But if your C code
expects to be able to use the functionality of the standard C library, you
obviously need one. Newlib is one popular implementation thereof, the one used
by Cygnus toolchains.

If you are porting the GNU/Cygnus toolchain to a new target system, the usual
order of steps is:

1. Decide on the format of your object files (ELF is the first recommended
choice today), define the relocations you need, etc. and implement all this in
binutils. While doing this don't be concerned with anything other than
binutils, build and test binutils only as you go.

2. Decide on the calling convention, which registers are preserved across
function calls, put down the structure alignment rules, etc. and write the gcc
back-end for your target. In this step you write the machine description and
teach gcc everything about your instruction set, possible optimisations, etc.
When you do this you should already have your assembler, linker, and other
binutils stuff done. You should have all them installed and forget about them
at this stage, and think only about gcc.

3. Decide what libraries do you need. Do you need the standard C library? Do
you need math libraries? Do you need C++ and other language libraries? Do you
need startup code, special support code, dynamic linkers, etc? Write or port
the libraries you need.

4. (Only if you want debugging.) Decide on the debugging information format
(stabs or DWARF or whatever, I'm no expert on this), etc. and port gdb to your
target, possibly doing some work in gcc or binutils to support it, I'm not sure
about the details as I haven't playing with debugging yet.

I hope this helps.

--
Michael Sokolov		Harhan Engineering Laboratory
Public Service Agent	International Free Computing Task Force
			International Engineering and Science Task Force
			615 N GOOD LATIMER EXPY STE #4
			DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]