Successful gcc-3.2.3 for powerpc-eabi but some strange workarounds needed.
Anders Becker
anders.becker@audiodev.com
Fri May 23 12:00:00 GMT 2003
Hi,
I have succeded to update my gcc-2.95.3-5 toolchain and built a toolchain for
powerpc-eabi based on:
binutils-2.13.2.1
gcc-3.2.3
newlib-1.11.0
insight-5.3
Just pretty much following the instructions from http://billgatliff.com (See my
build steps below)
However, after the crosscompiler build was done I needed to do two workarounds
to get my project to build and run properly so I am posting them here to see if
somebody can explain why it happens:
--First problem:
In file included from /home/crossgcc/powerpc-eabi/include/stdio.h:47,
from /home/crossgcc/include/c++/3.2.3/cstdio:52,
from
/cygdrive/c/projects/Husky/SW/Drv_Cntrlr/Frmwr/Source/main.cpp:32:
/home/crossgcc/powerpc-eabi/include/sys/types.h:364:26: cygwin/types.h: No such
file or directory
make[1]: *** [main.d] Error 1
make: *** [all] Error 2
Apparently the compiler is missing the path to /usr/include but I didn't
understand why my crosscompiled program would need cygwin headers so I
added -U__CYGWIN__ to CFLAGS in my project makefile and after that it builds
without further problem.
--Second problem:
My program crashed at the first function call in _start due to that the .rodata
section was linked to the wrong place. The reason for this linking error was
that the .rodata section is set as writable/allocable instead of just
allocatable (see section headers below). After a small change in the linker
script I managed to work around it. Hoverver, it still feels strange that
.rodata is writable, can anybody else reproduce this or is it just something
wrong with my setup?
bash-2.05b$ powerpc-eabi-readelf.exe -S main.exe
There are 35 section headers, starting at offset 0x272ab0:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00002000 002000 03bfcc 00 AX 0 0 4
[ 2] .init PROGBITS 0003dfcc 03dfcc 000024 00 AX 0 0 4
[ 3] .fini PROGBITS 0003dff0 03dff0 000020 00 AX 0 0 4
[ 4] .rodata PROGBITS 0003e010 03e010 004afc 00 WA 0 0 8
[ 5] .gcc_except_table PROGBITS 00042b0c 042b0c 000000 00 WA 0 0 1
[ 6] .sdata2 PROGBITS 00042b0c 042b0c 000000 00 A 0 0 4
[ 7] .sbss2 PROGBITS 00042b0c 042b0c 000000 00 A 0 0 1
[ 8] .data PROGBITS 00852b10 042b10 0008ec 00 WA 0 0 8
[ 9] .eh_frame PROGBITS 008533fc 0433fc 007384 00 WA 0 0 4
[10] .data1 PROGBITS 008533fc 04b394 000000 00 W 0 0 1
[11] .jcr PROGBITS 0085a780 04a780 000004 00 WA 0 0 4
[12] .got1 PROGBITS 0085a784 04a784 000000 00 WA 0 0 1
[13] .got2 PROGBITS 0085a784 04a784 0003c0 00 WA 0 0 4
[14] .dynamic DYNAMIC 0085a784 04b394 000000 08 W 0 0 1
[15] .ctors PROGBITS 0085ab44 04ab44 000020 00 WA 0 0 4
[16] .dtors PROGBITS 0085ab64 04ab64 000014 00 WA 0 0 4
[17] .fixup PROGBITS 0085ab78 04ab78 0004a8 00 WA 0 0 4
[18] .got PROGBITS 0085b020 04b020 000010 04 WAX 0 0 4
[19] .sdata PROGBITS 0085b030 04b030 000364 00 WA 0 0 8
[20] .got.plt PROGBITS 0085b030 04b394 000000 00 W 0 0 1
[21] .sbss NOBITS 0085b394 04b394 00012c 00 WA 0 0 8
[22] .bss NOBITS 0085b4c0 04b394 000f28 00 WA 0 0 8
[23] .debug_aranges PROGBITS 00000000 04b398 002c78 00 0 0 8
[24] .debug_pubnames PROGBITS 00000000 04e010 0162e0 00 0 0 1
[25] .debug_info PROGBITS 00000000 0642f0 18a55d 00 0 0 1
[26] .debug_abbrev PROGBITS 00000000 1ee84d 01992b 00 0 0 1
[27] .debug_line PROGBITS 00000000 208178 03385c 00 0 0 1
[28] .debug_frame PROGBITS 00000000 23b9d4 00a230 00 0 0 4
[29] .debug_str PROGBITS 00000000 245c04 02ace5 01 MS 0 0 1
[30] .comment PROGBITS 00000000 2708e9 000a96 00 0 0 1
[31] .debug_ranges PROGBITS 00000000 27137f 001600 00 0 0 1
[32] .shstrtab STRTAB 00000000 27297f 000130 00 0 0 1
[33] .symtab SYMTAB 00000000 273028 0091e0 10 34 156 4
[34] .strtab STRTAB 00000000 27c208 011630 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
--------------------------My build steps---------------------
target=powerpc-eabi
prefix=/home/crossgcc
cd build-binutils-2.13.2.1/
../binutils-2.13.2.1/configure --target=$target --prefix=$prefix -v
make all install 2>&1 | tee buildlog.txt
cd ../build-bootstrap-gcc-3.2.3/
../gcc-3.2.3/configure --target=$target --prefix=$prefix --without-headers --wit
h-newlib --with-gnu-as --with-gnu-ld --with-local-prefix=${prefix}/${target} --d
isable-shared
make all-gcc install-gcc 2>&1 | tee buildlog.txt
cd ../build-newlib-1.11/
../newlib/configure --target=$target --prefix=$prefix -v
make all install 2>&1 | tee buildlog.txt
cd ../build-gcc-3.2.3/
../gcc-3.2.3/configure --target=$target --prefix=$prefix --with-gnu-as --with-g
nu-ld --enable-languages=c,c++ -v
make all install 2>&1 | tee buildlog.txt
make CFLAGS="-O2 -myellowknife" install
#Known workaround: Deleted build-gcc-3.2.3/gcc/include/stdlib.h
#See http://sources.redhat.com/ml/crossgcc/2002-11/msg00057.html
Best regards,
Anders
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list