This is the mail archive of the crossgcc@sources.redhat.com 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]

Re: Cross compile error question: i686 to powerpc--linux-gnu


David:

> Wait...what undefined references?  I wrote the small sample program
> below with NO external headers, and the linker choked...
> 
> int main (int x, int y)
> {
>     int sum;
>     int z = 9;
> 
>     sum = x + y;
> 
>     return sum;
> }
> 
> What can't it find?  I would assume that it's looking for some link
> info on how to lay out the memory, but it LOOKS to me like the PPC
> assembly code is being generated correctly.  Is this where I could
> run the linker manually (not with gcc -o, which is what I tried) and
> get through?  Or is it more likely because the newlib stuff is wrong
> for my target?

Try this:

$ <target>-gcc -c foo.c
$ <target>-objdump --disassemble foo.o

Or use the -S option to gcc, and look at the asm.

One of the things you'll see is gcc inserting a call to something like
__main() before it runs the first line of main().  This is where most
machines do their C environment setup (zeroing out bss, etc.).

> And, on Bill Gatliff's page, he refers to problems building the
> libiberty when building powerpc-eabi...will I still hit final
> compile issues there?

Yea, but a minor one.  You just have to run make one more time, with
some flags.  Trivial stuff, and very reliable.


b.g.
-- 
Bill Gatliff
bgat@billgatliff.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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