public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: help building gcc 3.2
@ 2002-10-09 10:16 Ralph Blach
  0 siblings, 0 replies; 6+ messages in thread
From: Ralph Blach @ 2002-10-09 10:16 UTC (permalink / raw)
  To: Rupert Wood; +Cc: gcc-help


Rup,

No, I had to copy crti.o and libc.a to my gcc directory to get gcc to
compile.

Agreed that crti will be written in assembler, but libc.a will be written
in C and one would need the compiler
to compile it.  It seems like a chicken and egg issue.

Chip


Rupert Wood <rup@kanat.pair.com> on 10/09/2002 01:08:53 PM

To:    Ralph Blach/Raleigh/IBM@IBMUS
cc:    gcc-help@gcc.gnu.org
Subject:    Re: help building gcc 3.2



Ralph Blach wrote:

> I understand that these files are needed to link with, but thats for
> ld, not GCC the compiller.

OK, but the gcc binary is really just the compiler driver. It wraps
invocation of the proper backend compilers (cc1, cc1plus, f771, etc.
depending on language), the assember *and* the linker. (And, where
required, the collect2 pass.) When you're devloping with gcc - or any
other unix compiler I've seen - you almost never run ld yourself.

> The compiler really should not have to understand crti.o or any
> libraries to compile an source into an object.

No, it doesn't. And what did get successfully built in your build tree
should do just that.

Rup.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help building gcc 3.2
  2002-10-09  9:54 Ralph Blach
@ 2002-10-09 10:08 ` Rupert Wood
  0 siblings, 0 replies; 6+ messages in thread
From: Rupert Wood @ 2002-10-09 10:08 UTC (permalink / raw)
  To: Ralph Blach; +Cc: gcc-help

Ralph Blach wrote:

> I understand that these files are needed to link with, but thats for
> ld, not GCC the compiller.

OK, but the gcc binary is really just the compiler driver. It wraps
invocation of the proper backend compilers (cc1, cc1plus, f771, etc.
depending on language), the assember *and* the linker. (And, where
required, the collect2 pass.) When you're devloping with gcc - or any
other unix compiler I've seen - you almost never run ld yourself.

> The compiler really should not have to understand crti.o or any
> libraries to compile an source into an object.

No, it doesn't. And what did get successfully built in your build tree
should do just that.

Rup.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help building gcc 3.2
@ 2002-10-09  9:54 Ralph Blach
  2002-10-09 10:08 ` Rupert Wood
  0 siblings, 1 reply; 6+ messages in thread
From: Ralph Blach @ 2002-10-09  9:54 UTC (permalink / raw)
  To: Rupert Wood; +Cc: gcc-help


I understand that these files are needed to link with, but thats for ld,
not GCC the compiller.
The compiler really should not have to understand crti.o or any libraries
to compile an source into an object.

Chip

Rupert Wood <rup@kanat.pair.com> on 10/09/2002 09:20:20 AM

To:    Ralph Blach/Raleigh/IBM@IBMUS
cc:    gcc-help@gcc.gnu.org
Subject:    Re: help building gcc 3.2



Ralph Blach wrote:

> crti.o and libc.a
:
> Whey would a compiler need these files or care about them.

It needs them to link applications. The first one in the C runtime
entrypoint/initialization and the second is the C library.

For example, the operating system knows nothing about main(). The
application's real entrypoint has to fetch the arguments from the OS, chop
them up into an array and then invoke main(). It usually also sets up
floating point state and, for C++, invokes constructors of global objects
and initializes the exception mechanism.

> After all, you might need the compiler to build theses files.

At this point you should have enough of the compiler to build these.
Likely crti will be compiled from assembler, and the C library source
should neither make assumptions about having a C library to link against
(!) nor that it can link an executable.

Your best bet is to fetch these, along with the /usr/include headers, from
the target powerpc-linux system or, if you don't have access to one, from
a PowerPC linux distribution; then see --with-headers and --with-libs in
the GCC configure documentation. Alternatively you could use these to
compile and install glibc for powerpc-linux.

> How do I specify the configure options so that these files are not
> needed.

Build and install newlib and configure --with-newlib. newlib (I think) can
now interface with a linux kernel. However, glibc's probably a better
bet.

Rup.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help building gcc 3.2
  2002-10-09  6:00 Ralph Blach
  2002-10-09  6:07 ` Joshua Nye
@ 2002-10-09  6:20 ` Rupert Wood
  1 sibling, 0 replies; 6+ messages in thread
From: Rupert Wood @ 2002-10-09  6:20 UTC (permalink / raw)
  To: Ralph Blach; +Cc: gcc-help

Ralph Blach wrote:

> crti.o and libc.a
:
> Whey would a compiler need these files or care about them.

It needs them to link applications. The first one in the C runtime
entrypoint/initialization and the second is the C library.

For example, the operating system knows nothing about main(). The
application's real entrypoint has to fetch the arguments from the OS, chop
them up into an array and then invoke main(). It usually also sets up
floating point state and, for C++, invokes constructors of global objects
and initializes the exception mechanism.

> After all, you might need the compiler to build theses files.

At this point you should have enough of the compiler to build these.
Likely crti will be compiled from assembler, and the C library source
should neither make assumptions about having a C library to link against
(!) nor that it can link an executable.

Your best bet is to fetch these, along with the /usr/include headers, from
the target powerpc-linux system or, if you don't have access to one, from
a PowerPC linux distribution; then see --with-headers and --with-libs in
the GCC configure documentation. Alternatively you could use these to
compile and install glibc for powerpc-linux.

> How do I specify the configure options so that these files are not
> needed.

Build and install newlib and configure --with-newlib. newlib (I think) can
now interface with a linux kernel. However, glibc's probably a better
bet.

Rup.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: help building gcc 3.2
  2002-10-09  6:00 Ralph Blach
@ 2002-10-09  6:07 ` Joshua Nye
  2002-10-09  6:20 ` Rupert Wood
  1 sibling, 0 replies; 6+ messages in thread
From: Joshua Nye @ 2002-10-09  6:07 UTC (permalink / raw)
  To: gcc-help, Ralph Blach


> How ever when I went to build my cross compiler, xgcc insisted on the
> following files
> crti.o and libc.a
> to build the cross compiler.

You need to build glibc or another C library for the target platform.

> Whey would a compiler need these files or care about them.  After all, you
> might need the compiler to build theses files.  How do I specify the
> configure options so that these files are not needed.  If they are needed,
> could somebody explain why they are needed.
>

I've had some troubles with 3.2 in this regard. I think I ended up using GCC
2.95.x to build a glibc for my target and then built a GCC 3.2
cross-compiler.

--josh


^ permalink raw reply	[flat|nested] 6+ messages in thread

* help building gcc 3.2
@ 2002-10-09  6:00 Ralph Blach
  2002-10-09  6:07 ` Joshua Nye
  2002-10-09  6:20 ` Rupert Wood
  0 siblings, 2 replies; 6+ messages in thread
From: Ralph Blach @ 2002-10-09  6:00 UTC (permalink / raw)
  To: gcc-help

I went to build a gcc3.2 cross compiler.  My host is a i386 and my target
is a powerpc-linux-gnu.  The build of the binutils wen flawlessly.

How ever when I went to build my cross compiler, xgcc insisted on the
following files
crti.o and libc.a
to build the cross compiler.

Whey would a compiler need these files or care about them.  After all, you
might need the compiler to build theses files.  How do I specify the
configure options so that these files are not needed.  If they are needed,
could somebody explain why they are needed.

Thanks

Chip


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-10-09 17:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-09 10:16 help building gcc 3.2 Ralph Blach
  -- strict thread matches above, loose matches on Subject: below --
2002-10-09  9:54 Ralph Blach
2002-10-09 10:08 ` Rupert Wood
2002-10-09  6:00 Ralph Blach
2002-10-09  6:07 ` Joshua Nye
2002-10-09  6:20 ` Rupert Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).