gcc binary format output

Kai Ruottu karuottu@mbnet.fi
Thu Jul 13 16:42:00 GMT 2006


Andrew Haley wrotes:
> Kai Ruottu writes:
>  > Victor Roman Archidona wrote:
>  > 
>  >  > I compiled by hand GCC, and when I compile some file the output format
>  >  > is "UNIX - System V". I got this with `readelf -h program`.
>  > 
>  > I tried a crosscompiler from 'i686-linux-gnu' to the 'x86_64-freebsd6.1'
>  > and got just the same result:
>
> This is way off-topic.  gcc produces assembly code, not binaries.  You
> should be talking to a binutils list.
>   
I myself haven't joined to the binutils list, only to this and the gcc list.
And generally did my try 'just for a fun' in this specific case,  but
Victor Roman Archidona could have some motives to get this thing
working in his own project...  Anyhow the fix being told after it was
invented could be nice.  At least to me if my message gave any clues
for where the bug could be :-)  Otherwise I will stop all the further
build tries and maybe can give misinformation about the binutils/GCC
situation with FreeBSD/x86_64 when not being informed that the bug
was fixed already...

 BTW, for those who (still) don't know "how to build a crosscompiler" (like
those who write the GNU docs :-) here is my usual method :

 For my crosscompiler to 'x86_64-freebsd6.1', I first built and 
installed the
binutils-2.17.50.0.2 for this target. Then I installed the target C 
library from
the FreeBSD 6.1/amd64 install CDs and finally built gcc-4.0.3 from its 
sources.
This is the method I have used to, and there should be some very good 
reasons
to get me learning how on earth the C libraries for FreeBSD could be built
from absolute scratch...

 The only problem during the build, for which I should have asked comments
here but forgot to do that, was that the target headers, specifically the
'<machine/_types.h>', already defined the '__gnuc_va_list' but the
'gcc-4.0.3/gcc/sys-types.h' tried to define this again.  My 
quick-and-dirty fix
was to wrap the 'gcc-4.0.3/gcc/sys-types.h' with the same:

    #ifndef __GNUC_VA_LIST
    #define __GNUC_VA_LIST
    <the '__gnuc_va_list' typedef>
    #endif

wrapper as this FreeBSD 6.1 header had.  Maybe the right fix could have been
to redefine this (gcc-4.0.3-wise) in the 'gcc/sys-types.h'.  This clash 
happened
when the new 'xgcc' & Co. tried to compile the '$build/gcc/SYSCALLS.c'...

 In any case my build method had not much to do with the current GNU site
'advices', I just did the build in the same way I have done a GCC build 
during
the last 10 years and during the last 1000  builds....

 I can quite well agree with Andrew about binutils and C library things 
not belonging
to GCC in any way, but how on earth this fact could be told to the GNU docs
writers?   The 'http://gcc.gnu.org/install/prerequisites.html' doesn't 
mention
anything about the C library and (almost) claims the binutils being 
something
'optional'.  For the crosscompiler builders both these are obligatory 
prerequisites
and in most cases the target C library already exists in the target 
system itself.

 The: 'http://gcc.gnu.org/install/build.html' tells instead :

   Build runtime libraries using the stage3 compiler from the previous step.

for the native case and:

    * Build the compiler (single stage only).
    * Build runtime libraries using the compiler from the previous step.

for the cross case.  But whether a newbie understands what these 
'runtime libraries'
are, is quite unclear.  After producing those 1000 and much more GCCs, 
neither
do I understand what these mean.  Should the native GCC builder try to 
build the
C libraries after the GCC build or what?  And the crosscompiler builder 
should do
the same?  In the embedded target cases this really happens, people like 
me usually
produce the C library (newlib) after getting GCC ('gcc', 'libiberty', 
'libstdc++',...)
built.   The "single stage only" is some sanity but as we have seen 
recently on this
list :

------------------ clip --------------------------
Raphael Zulliger wrote:

 > Building a crosscompiler should be done as described in the different 
docs/wikis/howtos.
------------------ clip --------------------------

all kind of  "how-to"s  and "wiki"s try to use the famous "code red" for 
the new 'recruits':

  http://en.wikipedia.org/wiki/A_Few_Good_Men

in their first crosscompiler builds, "a form of hazing unofficially 
sanctioned by
higher-ranking officers designed to make soldiers pay attention to 
orders and rules".
To their own "orders and rules", not to the GNU rules like this "single 
stage only" :-(

 As an corporal (now in reserves) in the Finnish recruit army, Signal 
Corps, I didn't like
using that 'code red' into those recruits.  And don't understand why 
anyone likes using
it nowadays for the newbies in GCC building, with their self-invented 
multi-stage builds
others "should use" (like Raphael writes).  Not funny at all but really 
sad...




More information about the Gcc-help mailing list