build errors while cross compiling llvm-gcc for ARM

ld-new works only with those objects which are compiled using native gcc but
doesn't work for cross-compiler gcc/arm.

Ok, please show:

ld --version
and last few lines of the ld --help output

ld-new works only with those objects which are compiled using native gcc but
doesn't work for cross-compiler gcc/arm.

And yes, please carefully read, understand and follow the "Usage"
section of http://llvm.org/docs/GoldPlugin.html

Did you mean ld-new ?

ld-new -v
GNU gold (GNU Binutils 2.20.51.20100707) 1.9

ld-new --help
./ld-new: supported targets: elf32-i386 elf32-i386-freebsd elf64-x86-64 elf64-x86-64-freebsd elf64-sparc elf32-sparc elf64-powerpcle elf64-powerpc elf32-powerpcle elf32-powerpc elf32-bigarm elf32-littlearm

Yes, I’m following this page only and did whatever is mentioned there.

Yes, I'm following this page only and did whatever is mentioned there.

It doesn't seem so. E.g. it contains the following line:
"The linker takes a -plugin option that points to the path of the
plugin .so file."
and
"Replace that with ld-new -plugin /path/to/libLLVMgold.so to test it out."

At least you are not telling ld-new to use any plugin. Thus ld-new
does not know how to deal with LLVM IR inside .o and you obtain:

Sorry for not explaining well.

After compiling with g+±cross
g+±cross -c a.c

I do link using this command
/gold_binutils/build/gold/ld-new -plugin ~/Desktop/Sanjeev/LLVM/llvm-2.7/Release/lib/libLLVMgold.so --eh-frame-hdr -melf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o
/usr/local/lib/gcc/i686-pc-linux-gnu/4.2.0/crtbegin.o -L/usr/local/lib/gcc/i686-pc-linux-gnu/4.2.0 -L/usr/local/lib -lgcc
–as-needed -lgcc_s --no-as-needed -lc -lgcc -lpthread -lrt --as-needed -lgcc_s --no-as-needed /usr/local/lib/gcc/i686-pc-linux-gnu/4.2.0/crtend.o
/usr/lib/crtn.o a.o -o sanjeevtest

~/Desktop/Sanjeev/LLVM/llvm-2.7/Release/lib/libLLVMgold.so --eh-frame-hdr
-melf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o

Ok, this way you're generating code for x86

/usr/lib/crti.o
/usr/local/lib/gcc/i686-pc-linux-gnu/4.2.0/crtbegin.o
-L/usr/local/lib/gcc/i686-pc-linux-gnu/4.2.0 -L/usr/local/lib -lgcc
--as-needed -lgcc_s --no-as-needed -lc -lgcc -lpthread -lrt --as-needed
-lgcc_s --no-as-needed /usr/local/lib/gcc/i686-pc-linux-gnu/4.2.0/crtend.o
/usr/lib/crtn.o a.o -o sanjeevtest

And you're using x86 libs. Surely you won't obtain ARM binary.

Hello,

I’m using gold linker now to see if there can be any performance gain. Also using latest gcc version (4.4.4) and latest binutils.

But when I’m compiling llvm-gcc, I’m getting this error.

/home/jal/llvm-gcc-4.2-2.7.source/host-i686-pc-linux-gnu/gcc/xgcc -B/home/jal/llvm-gcc-4.2-2.7.source/host-i686-pc-linux-gnu/gcc/ -B/usr/local/arm-v7a8-linux-gnueabi/bin/ -B/usr/local/arm-v7a8-linux-gnueabi/lib/ -isystem /usr/local/arm-v7a8-linux-gnueabi/include -isystem /usr/local/arm-v7a8-linux-gnueabi/sys-include -O2 -O2 -g -O2 --sysroot=/home/jal/VDLinux-armv7a8-toolchain/arm-v7a8-linux-gnueabi/libc -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I…/…/./gcc -I…/…/./gcc/. -I…/…/./gcc/…/include -I…/…/./gcc/…/libcpp/include -I…/…/./gcc/…/libdecnumber -I…/libdecnumber -I/home/jal/llvm-2.7/include -DL_mulsc3 -fvisibility=hidden -DHIDE_EXPORTS -c …/…/./gcc/libgcc2.c -o libgcc/./_mulsc3.o
/tmp/ccmyj0Hi.s: Assembler messages:
/tmp/ccmyj0Hi.s:60: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:62: Error: bad instruction vmrsvs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:71: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:76: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:83: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:87: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:105: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:109: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:112: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:118: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:125: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:130: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:136: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:146: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:158: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:161: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:167: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:171: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:186: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:190: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:193: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:199: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:206: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:211: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:217: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:222: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:236: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:240: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:244: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:248: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:252: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:256: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:260: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:264: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:269: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:274: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:280: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:285: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:291: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:296: Error: bad instruction vmrs apsr_nzcv,fpscr’
/tmp/ccmyj0Hi.s:302: Error: bad instruction vmrs apsr_nzcv,fpscr' /tmp/ccmyj0Hi.s:308: Error: bad instruction vmrs apsr_nzcv,fpscr’
make[3]: *** [libgcc/./_mulsc3.o] Error 1
make[3]: Leaving directory /home/jal/llvm-gcc-4.2-2.7.source/host-i686-pc-linux-gnu/gcc' make[2]: *** [stmp-multilib] Error 2 make[2]: Leaving directory /home/jal/llvm-gcc-4.2-2.7.source/host-i686-pc-linux-gnu/gcc’
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/jal/llvm-gcc-4.2-2.7.source’
make: *** [all] Error 2

Toolkit version is
Configured with: /scratch/julian_vda8/2010q1-release-linux-lite/src/gcc-4.4-2010q1/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-v7a8-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-gnu-as --with-gnu-ld --with-specs=’%{funwind-tables|fno-unwind-tables|mabi=|ffreestanding|nostdlib:;:-funwind-tables} %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}’ --enable-languages=c,c++ --enable-shared --disable-lto --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion=‘VDLinux ga-release 2010-06-30’ --with-bugurl=http://linux.sec.samsung.net/VDLinux/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-v7a8-linux-gnueabi/libc --with-build-sysroot=/scratch/julian_vda8/2010q1-release-linux-lite/install/arm-v7a8-linux-gnueabi/libc --with-gmp=/scratch/julian_vda8/2010q1-release-linux-lite/obj/host-libs-2010q1-202-arm-v7a8-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian_vda8/2010q1-release-linux-lite/obj/host-libs-2010q1-202-arm-v7a8-linux-gnueabi-i686-pc-linux-gnu/usr --with-ppl=/scratch/julian_vda8/2010q1-release-linux-lite/obj/host-libs-2010q1-202-arm-v7a8-linux-gnueabi-i686-pc-linux-gnu/usr --with-host-libstdcxx=’-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm’ --with-cloog=/scratch/julian_vda8/2010q1-release-linux-lite/obj/host-libs-2010q1-202-arm-v7a8-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian_vda8/2010q1-release-linux-lite/install/arm-v7a8-linux-gnueabi/bin --with-build-time-tools=/scratch/julian_vda8/2010q1-release-linux-lite/install/arm-v7a8-linux-gnueabi/bin --with-interwork --with-cpu=cortex-a8 --with-arch=armv7-a --with-mode=arm --with-tune=cortex-a8 --with-fpu=vfp3 --with-float=softfp
Thread model: posix
gcc version 4.4.1 (VDLinux ga-release 2010-06-30)

And llvm-gcc configured with
/configure --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=arm-v7a8-linux-gnueabi --enable-cross --with-sysroot=/home/jal/VDLinux-armv7a8-toolchain/arm-v7a8-linux-gnueabi/libc --with-build-sysroot=/home/jal/VDLinux-armv7a8-toolchain/arm-v7a8-linux-gnueabi/libc --enable-languages=c,c++ --with-as=/home/jal/VDLinux-armv7a8-toolchain/bin/arm-v7a8-linux-gnueabi-as --with-ld=/home/jal/VDLinux-armv7a8-toolchain/bin/arm-v7a8-linux-gnueabi-ld --enable-checking=release --disable-multilib --enable-llvm=/home/jal/llvm-2.7 --enable-clocale=gnu --with-cpu=cortex-a8 --with-interwork --with-arch=armv7-a --with-mode=arm --with-tune=cortex-a8 --with-fpu=vfp3 --with-float=softfp --disable-bootstrap --disable-libmudflap --disable-libssp

Thanks & Regards
Sanjeev

Hello

I'm using gold linker now to see if there can be any performance gain. Also
using latest gcc version (4.4.4) and latest binutils.

Sorry, I misinformed you last time. The necessary fixes were *not*
pushed into the binutils 2.20.1 release. You should grab so-called
development snapshot (aka 2.20.51). Make sure it's recent (say, after
January 2010).

PS: Note that gold is currently not pretty much usable for ARM code.

Does you mean that these assembler errors are due to this particular version of binutils(2.20.1) and may get resolved if used 2.20.51.

Does you mean that these assembler errors are due to this particular version
of binutils(2.20.1) and may get resolved if used 2.20.51.

Yes, they are.