public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* conceptual help
@ 2010-02-08 20:32 Diego Saravia
  2010-02-09  0:53 ` Martin Guy
  2010-02-09  8:15 ` Thomas Petazzoni
  0 siblings, 2 replies; 5+ messages in thread
From: Diego Saravia @ 2010-02-08 20:32 UTC (permalink / raw)
  To: crossgcc

I dont understand why to use i586 i686 x86_64, etc as targets if gcc
produces only one excecutable for all i386 and x86_64 processors

it is not better to have only one gcc-binary, aka i386-gcc for all
that processors and use "i386-gcc -march=i586",  "i386-gcc
-march=i686" and  "i386-gcc -march=x86_64"?

I was reading http://wiki.osdev.org/GCC_Cross-Compiler and I cant find
any reason to have diferent gcc binaries and binutils for each
processor, only one for each -b gcc backends

thank you for your attention.


-- 
Diego Saravia
Diego.Saravia@gmail.com
NO FUNCIONA->dsa@unsa.edu.ar

--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: conceptual help
  2010-02-08 20:32 conceptual help Diego Saravia
@ 2010-02-09  0:53 ` Martin Guy
  2010-02-09  2:59   ` Diego Saravia
  2010-02-09  8:15 ` Thomas Petazzoni
  1 sibling, 1 reply; 5+ messages in thread
From: Martin Guy @ 2010-02-09  0:53 UTC (permalink / raw)
  To: Diego Saravia; +Cc: crossgcc

On 2/8/10, Diego Saravia <dsa@unsa.edu.ar> wrote:
> I dont understand why to use i586 i686 x86_64, etc as targets if gcc
>  produces only one excecutable for all i386 and x86_64 processors

I guess it's so you can say "gcc" and have it produce optimal code for
your target system, instead of needing to hack the build system to
accept extra parameters.

   M

BTW, Diego, your reply address fails,

--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: conceptual help
  2010-02-09  0:53 ` Martin Guy
@ 2010-02-09  2:59   ` Diego Saravia
  0 siblings, 0 replies; 5+ messages in thread
From: Diego Saravia @ 2010-02-09  2:59 UTC (permalink / raw)
  To: crossgcc

> BTW, Diego, your reply address fails,


dsa@unsa.edu.ar it's having problems, but I receive it anyway,
directly and by the list

thank you

-- 
Diego Saravia
Diego.Saravia@gmail.com
NO FUNCIONA->dsa@unsa.edu.ar

--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: conceptual help
  2010-02-08 20:32 conceptual help Diego Saravia
  2010-02-09  0:53 ` Martin Guy
@ 2010-02-09  8:15 ` Thomas Petazzoni
  2010-02-09 17:53   ` Yann E. MORIN
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2010-02-09  8:15 UTC (permalink / raw)
  To: crossgcc

On Mon, 8 Feb 2010 17:32:45 -0300
Diego Saravia <dsa@unsa.edu.ar> wrote:

> I dont understand why to use i586 i686 x86_64, etc as targets if gcc
> produces only one excecutable for all i386 and x86_64 processors
> 
> it is not better to have only one gcc-binary, aka i386-gcc for all
> that processors and use "i386-gcc -march=i586",  "i386-gcc
> -march=i686" and  "i386-gcc -march=x86_64"?

Yann will correct me if I'm wrong, but the thing is that the C library
is built as part of the cross-compiling toolchain. And the C library is
compiled for the target, and we might want to compile this code for the
target with a specific CPU in mind, in order to generate better code
when possible. Otherwise, we would always have to compile the C library
for the smallest common denominator: i386, which prevents us from using
improvements of the instruction sets on i486, Pentium and further
families.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: conceptual help
  2010-02-09  8:15 ` Thomas Petazzoni
@ 2010-02-09 17:53   ` Yann E. MORIN
  0 siblings, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2010-02-09 17:53 UTC (permalink / raw)
  To: crossgcc

Hello All!

On Tuesday 09 February 2010 09:15:15 Thomas Petazzoni wrote:
> On Mon, 8 Feb 2010 17:32:45 -0300
> Diego Saravia <dsa@unsa.edu.ar> wrote:
> > I dont understand why to use i586 i686 x86_64, etc as targets if gcc
> > produces only one excecutable for all i386 and x86_64 processors
> > it is not better to have only one gcc-binary, aka i386-gcc for all
> > that processors and use "i386-gcc -march=i586",  "i386-gcc
> > -march=i686" and  "i386-gcc -march=x86_64"?

When configured for x86, gcc can generate code for all of the i?86
variants, _and_ all the x86_64 variants as well (and conversely if
configured for x86_64).

What we want, although, is to select the _default_ CPU targeted by
the compiler. That is, just calling the cross-compiler (say:
i686-linux-gnu-gcc), then proper code is generated, and is optimised
for the i686 class of CPUs (eg. PentiumPro). This selection in deed
propagates down to the C library (and a few others) that then get
optimised for this very CPU, but might not run on any other.

See the gcc man page, section titled "Intel 386 and AMD x86-64 Options"
for options -mtune and -march.

> Yann will correct me if I'm wrong, but the thing is that the C library
> is built as part of the cross-compiling toolchain. And the C library is
> compiled for the target, and we might want to compile this code for the
> target with a specific CPU in mind, in order to generate better code
> when possible. Otherwise, we would always have to compile the C library
> for the smallest common denominator: i386, which prevents us from using
> improvements of the instruction sets on i486, Pentium and further
> families.

Basically, that's right. You have to know, however, that there is no such
thing as a "generic instruction set applicable to all [x86] processors"
(again, from the gcc man page). As an embedded point of view, we seldom
need to address different processors of the same kind; eg. your board
either has an i386 or an i586, not both. If you have two (or more) boards
with different CPUs, then I'd suggest you build one toolchain for each
board, as the C library and some gcc libs, such as libgcc, get optimised
for each of board.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'



--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

end of thread, other threads:[~2010-02-09 17:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-08 20:32 conceptual help Diego Saravia
2010-02-09  0:53 ` Martin Guy
2010-02-09  2:59   ` Diego Saravia
2010-02-09  8:15 ` Thomas Petazzoni
2010-02-09 17:53   ` Yann E. MORIN

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).