Mips 32r2 big-endian toolchain

Khem Raj raj.khem@gmail.com
Wed Mar 9 05:22:00 GMT 2011


On 3/8/2011 12:40 PM, ANDY KENNEDY wrote:
>> I started to look at this a week or so back while I was trying to
>> build an octeon toolchain. I found that there seems to be an issue
>> with how ct-ng handles tuples for mips, but I didn't have enough time
>> to fully debug/figure it out.
>>
>> The problem is somewhere in here:
>> http://ymorin.is-a-geek.org/hg/crosstool-ng/file/f4e5daf96796/scripts/build/arch/mips.sh
>
> Perhaps, though there is nothing really there.
>


FWIW

CT_DoArchTupleValues() {
     # The architecture part of the tuple, override only for 64-bit
     if [ "${CT_ARCH_64}" = "y" ]; then
         CT_TARGET_ARCH="mips64${target_endian_el}"
     else
         # The architecture part of the tuple:
         CT_TARGET_ARCH="${CT_ARCH}${target_endian_el}"
     fi


mips/mips64-*-* generally means big-endian triplet so you dont need to 
append anything to make it behave big endian by default. Where as for 
little endian it should be mipsel/mips64el-*-* which is ok in above case

may be its an issue may be not.

> I get an error during the second pass of eglibc crt1.o is little-
> endian and we are building for a big-endian system.  So, I change
>
>
> CC=${cross_cc}                                      \
>
> to
>
> CC="${cross_cc} -EB"                                     \
>
> in the file:
> <http://ymorin.is-a-geek.org/hg/crosstool-ng/file/f4e5daf96796/scripts/build/libc/glibc-eglibc.sh-common#l42>
>
> and then I get a gcc build error (not even going to try to wrap this puppy):
>
> [ALL  ]    /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/build-cc-core-shared/./gcc/xgcc -B/root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/build-cc-core-shared/./gcc/ -B/root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/bin/ -B/root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/lib/ -isystem /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/include -isystem /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/sys-include    -O2   -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wo
ld-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -g -Os -B./ _m16addsf3_s.o _m16subsf3_s.o _m16mulsf3_s.o _m16divsf3_s.o _m16eqsf2_s.o _m16nesf2_s.o _m16gtsf2_s.o _m16gesf2_s.o _m16lesf2_s.o _m16ltsf2_s.o _m16unordsf2_s.o _m16fltsisf_s.o _m16fix_truncsfsi_s.o _m16fltuns
>
>
>   <snip all the .o files>
>
> bc_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o&&  rm -f ./libgcc_s.so&&  if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi&&  mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1&&  ln -s libgcc_s.so.1 ./libgcc_s.so
> [ALL  ]    /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/bin/ld: /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/mips-nfs_devel-linux-gnu/mips-nfs_devel-linux-gnu/sysroot/usr/lib/crti.o: compiled for a big endian system and target is little endian
> [ALL  ]    /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/bin/ld: /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/mips-nfs_devel-linux-gnu/mips-nfs_devel-linux-gnu/sysroot/usr/lib/crti.o: endianness incompatible with that of the selected emulation
> [ALL  ]    /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/bin/ld: failed to merge target specific data of file /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/mips-nfs_devel-linux-gnu/mips-nfs_devel-linux-gnu/sysroot/usr/lib/crti.o
> [ALL  ]    /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/bin/ld: /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/mips-nfs_devel-linux-gnu/mips-nfs_devel-linux-gnu/sysroot/usr/lib/crtn.o: compiled for a big endian system and target is little endian
> [ALL  ]    /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/bin/ld: /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/mips-nfs_devel-linux-gnu/mips-nfs_devel-linux-gnu/sysroot/usr/lib/crtn.o: endianness incompatible with that of the selected emulation
> [ALL  ]    /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/bin/ld: failed to merge target specific data of file /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/mips-nfs_devel-linux-gnu/mips-nfs_devel-linux-gnu/sysroot/usr/lib/crtn.o
> [ALL  ]    /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/bin/ld: BFD (GNU Binutils) 2.21 assertion fail /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/src/binutils-2.21/bfd/elfxx-mips.c:3157
> [ALL  ]    /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/gcc-core-shared/mips-nfs_devel-linux-gnu/bin/ld: BFD (GNU Binutils) 2.21 assertion fail /root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/src/binutils-2.21/bfd/elfxx-mips.c:3157
> [ALL  ]    collect2: ld returned 1 exit status
> [ERROR]    make[2]: *** [libgcc_s.so] Error 1
> [ALL  ]    make[2]: Leaving directory `/root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/build-cc-core-shared/mips-nfs_devel-linux-gnu/libgcc'
> [ERROR]    make[1]: *** [all-target-libgcc] Error 2
> [ALL  ]    make[1]: Leaving directory `/root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/.build/mips-nfs_devel-linux-gnu/build/build-cc-core-shared'
> [ERROR]    Build failed in step 'Installing shared core C compiler'
> [ERROR]    Error happened in '/root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/scripts/functions' in function 'CT_DoExecLog' (line unknown, sorry)
> [ERROR]          called from '/root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/scripts/build/cc/gcc.sh' at line # 334 in function 'do_cc_core'
> [ERROR]          called from '/root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/scripts/build/cc/gcc.sh' at line # 89 in function 'do_cc_core_pass_2'
> [ERROR]          called from '/root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/scripts/crosstool-NG.sh' at line # 607 in function 'main'
> [ERROR]    Look at '/root/src/buildroot-retool/crosstool-ng/new/crosstool-ng/mips-nfs_devel-linux-gnu/build.log' for more info on this error.
> [ERROR]  (elapsed: 10:53.39)
> make: *** [build] Error 2
>
>
>
> So, how do we get xgcc to start passing the "-mips32r2 -EB" so that libgcc_s.so.1 gets built correctly?
>
> If you see the issue, please help.  I've been at this for over a week and I cannot find how to get the GCC build to behave itself.
>
> Thanks,
> Andy


--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list