libgcc

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
protecyon
Posts: 5
Joined: Mon Dec 13, 2010 8:56 pm

libgcc

Post by protecyon »

In the tutorial it states that to create libgcc you can run the following commands after creating the bootstrap gcc:
make all-target-libgcc
make install-target-libgcc

However, in order for these commands to run succesfully wouldn't you need to provide headers for your target platform and given that we configures the bootstrap gcc with the --without-headers flag wouldn't the libgcc library fail to build complaining about missing headers such as string.h.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: libgcc

Post by pcmattman »

No.

libgcc provides a variety of functions for your target machine that provide for special math operations (eg, 64-bit division on x86), atomic builtins, and other such functions.

Any dependencies on C functions, if any, will be resolved when libgcc is linked to your binary, not during libgcc build.
protecyon
Posts: 5
Joined: Mon Dec 13, 2010 8:56 pm

Re: libgcc

Post by protecyon »

If that is the case what might cause libgcc to fail to find string.h after running make all-target-libgcc with gcc 4.5.1?

Thank you in advance for your help.
pcmattman wrote:No.

libgcc provides a variety of functions for your target machine that provide for special math operations (eg, 64-bit division on x86), atomic builtins, and other such functions.

Any dependencies on C functions, if any, will be resolved when libgcc is linked to your binary, not during libgcc build.
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Re: libgcc

Post by JackScott »

If make all-target-libgcc is failing to build, the best thing to do is to paste the last few lines (10-20) here so we can see what the exact problem is. It's all just guesswork otherwise. You mention GCC v4.5.1, is that the host system version, or the target system version?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: libgcc

Post by Combuster »

My personal experience with libgcc (especially for freestanding targets that behave like they are not) is that some parts do drag in references to system headers. Mostly, the problem cases deal with unwinding and debugging.

I you don't need C++, you can just assemble an empty .S file to the failing unwind_xxxx.o and then run make again (repeating the process where necessary), but it is a really ugly hack, and so far I haven't found it necessary on intel platforms. Then again, I'm still mostly using compilers between 3.4.x and 4.2.x since it's a waste of time to upgrade a toolchain when it's working - especially when you have 7 different crosscompilers to upgrade.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
qw
Member
Member
Posts: 792
Joined: Mon Jan 26, 2009 2:48 am

Re: libgcc

Post by qw »

Combuster wrote:Then again, I'm still mostly using compilers between 3.4.x and 4.2.x since it's a waste of time to upgrade a toolchain when it's working - especially when you have 7 different crosscompilers to upgrade.
And then Solar is asking me why I need two!
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: libgcc

Post by Solar »

Hobbes wrote:
Combuster wrote:Then again, I'm still mostly using compilers between 3.4.x and 4.2.x since it's a waste of time to upgrade a toolchain when it's working - especially when you have 7 different crosscompilers to upgrade.
And then Solar is asking me why I need two!
:P
Every good solution is obvious once you've found it.
protecyon
Posts: 5
Joined: Mon Dec 13, 2010 8:56 pm

Re: libgcc

Post by protecyon »

The following is the error when libgcc fails:

-fexceptions -fnon-call-exceptions
/home/dir/tools/./gcc/xgcc -B/home/dir/tools/./gcc/ -B/home/dir/tools/powerpc/powerpc-none-linux-gnu/bin/ -B/home/dir/tools/powerpc/powerpc-none-linux-gnu/lib/ -isystem /home/dir/tools/powerpc/powerpc-none-linux-gnu/include -isystem /home/dir/tools/powerpc/powerpc-none-linux-gnu/sys-include -g -O2 -msoft-float -fPIC -mstrict-align -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -mlong-double-128 -I. -I. -I../../.././gcc -I/home/dir/Desktop/gcc-4.5.1/libgcc -I/home/dir/Desktop/gcc-4.5.1/libgcc/. -I/home/dir/Desktop/gcc-4.5.1/libgcc/../gcc -I/home/dir/Desktop/gcc-4.5.1/libgcc/../include -I/home/dir/Desktop/gcc-4.5.1/libgcc/../libdecnumber/dpd -I/home/dir/Desktop/gcc-4.5.1/libgcc/../libdecnumber -DHAVE_CC_TLS -o decContext.o -MT decContext.o -MD -MP -MF decContext.dep -c /home/dir/Desktop/gcc-4.5.1/libgcc/../libdecnumber/decContext.c
/home/dir/Desktop/gcc-4.5.1/libgcc/../libdecnumber/decContext.c:33:43: fatal error: string.h: No such file or directory
compilation terminated.
make[4]: *** [decContext.o] Error 1
make[4]: Leaving directory `/home/dir/tools/powerpc-none-linux-gnu/nof/libgcc'
make[3]: *** [multi-do] Error 1
make[3]: Leaving directory `/home/dir/tools/powerpc-none-linux-gnu/libgcc'
make[2]: *** [all-multi] Error 2
make[2]: Leaving directory `/home/dir/tools/powerpc-none-linux-gnu/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory `/home/dir/tools'
make: *** [all] Error 2

GCC v4.5.1 is the target system version, GCC v4.4.5 is the host system version.

Does it look like the target(powerpc) system headers need to be included for libgcc to compile?
JackScott wrote:If make all-target-libgcc is failing to build, the best thing to do is to paste the last few lines (10-20) here so we can see what the exact problem is. It's all just guesswork otherwise. You mention GCC v4.5.1, is that the host system version, or the target system version?
Post Reply