This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cross Compile Process


Xun, All,

On Saturday 02 April 2011 07:57:07 Xun Li wrote:
> On Fri, Apr 1, 2011 at 12:10 AM, Yann E. MORIN
> <yann.morin.1998@anciens.enib.fr> wrote:
> ?http://ymorin.is-a-geek.org/hg/crosstool-ng/file/tip/docs/9%20-%20How%20is%20a%20toolchain%20constructed.txt
>
> I have read the whole document and now understand most of the concepts.
> One more question, why building GCC requires the C library? GCC only
> compiles programs into assemblies while LD from binuntils links them
> with C libraries. Why binutils doesn't need to understand C library
> but GCC needs to?

Short answer: that's the way it works! ;-)

Long answer:

This is theory. In theory, the compiler should not care about the C library.

But gcc is not just a compiler. It also comes with some libraries, such as
the runtimes for some languages: libjava, libada, libstdc++, and so on...
plus a few other 'helper' libraries: libssp (Stack Smashing Protection),
libmudflap (pointer debugging), libgomp (OpenMP by GNU)...

gcc needs to know the C library features to see if some runtime features
can be enabled. For example: using setjmp/longjmp (SJLJ) for exception
handling.

Also, some features may require support from both the C library and the
compiler, so gcc has to know if the C library supports such or such
feature before it can enable that support in the compiler. This is the
case (I think!) for Thread Local Storage (TLS).

gcc may also has some functions that can also be implemented in the C
library. So gcc needs to know if it has to provide its own implementation,
or if it can rely on the C library to provide them (sorry, no example).

Plus a lot of other nitty-gritty stuff you do not even wish to hear about!
And that even I do not want to hear about! ;-)

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


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