Cross compile error question: i686 to powerpc--linux-gnu
William A. Gatliff
Wed Oct 17 12:35:00 GMT 2001
> 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?
$ <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.
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to email@example.com
More information about the crossgcc