how to compile llvm-gcc whith lto support for ARM

i try compile with options:
binutils 2.20.1

../configure --target=arm-unknown-linux-gnueabi --program-prefix=arm-
--prefix=/home/kursh/arm --enable-gold --enable-plugins
--with-sysroot=/home/kursh/arms/sys-root

make && make install

LLVM:

CXXFLAGS="-fPIC" ../configure \
      --enable-jit \
      --enable-optimized \
--enable-shared\
      --enable-pic\
      --with-pic\
      --disable-muiltilib\
      --prefix=/home/kursh/arm \
      --target=arm-unknown-linux-gnueabi \
      --with-sysroot=/home/kursh/arms/sys-root\
      --with-binutils-include=/home/kursh/ctbuild/binutils-2.20.1/include \
      --with-llvmgccdir=/home/kursh/ctbuild/llvm-gcc-4.2

      make && make install

LLVM-GCC.
  
CXXFLAGS="-fPIC" CFLAGS="-g -O2 -fPIC" CPPFLAGS="-fPIC" ../configure \
      --enable-languages=c,c++ \
      --enable-llvm=/home/kursh/ctbuild/llvm/build \
      --prefix=/home/kursh/arm \
      --program-prefix=llvm- \
--enable-shared\
      --enable-pic\
      --with-pic\
      --disable-multilib\
      --target=arm-unknown-linux-gnueabi \
      --with-as=/home/kursh/arm/bin/arm-as \
      --with-ld=/home/kursh/arm/bin/arm-ld \
      --with-sysroot=/home/kursh/arms/sys-root \
      --disable-libssp --disable-bootstrap --disable-werror
      make && make install

build llvm-gcc break with error:

rm -f ./libgcc_eh.a
/home/kursh/arm/arm-unknown-linux-gnueabi/bin/ar rc ./libgcc_eh.a
libgcc/./unwind-arm.o libgcc/./libunwind.o libgcc/./pr-support.o
libgcc/./unwind-c.o
/home/kursh/arm/arm-unknown-linux-gnueabi/bin/ranlib ./libgcc_eh.a
/home/kursh/arm/bin/arm-ld: error: libgcc/./_udivsi3_s.o: unsupported reloc
40 against local symbol
/home/kursh/arm/bin/arm-ld: error: libgcc/./_udivsi3_s.o: unsupported reloc
40 against local symbol
/home/kursh/arm/bin/arm-ld: error: libgcc/./_udivsi3_s.o: unsupported reloc
40 against local symbol
/home/kursh/arm/bin/arm-ld: error: libgcc/./_udivsi3_s.o: unsupported reloc
40 against local symbol
/home/kursh/arm/bin/arm-ld: error: libgcc/./_udivsi3_s.o: requires
unsupported dynamic reloc; recompile with -fPIC
/home/kursh/arm/bin/arm-ld: error: libgcc/./_udivsi3_s.o: unsupported reloc
40 against local symbol
....
....
/home/kursh/arm/bin/arm-ld: libgcc/./libunwind_s.o: in function
___Unwind_Resume:../../gcc/config/arm/libunwind.S:237: error: unsupported
reloc 40
/home/kursh/arm/bin/arm-ld: libgcc/./libunwind_s.o: in function
___Unwind_Resume_or_Rethrow:../../gcc/config/arm/libunwind.S:237: error:
unsupported reloc 40
/home/kursh/arm/bin/arm-ld: libgcc/./libunwind_s.o: in function
___Unwind_ForcedUnwind:../../gcc/config/arm/libunwind.S:237: error:
unsupported reloc 40
collect2: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/home/kursh/ctbuild/llvm-gcc-4.2/build/gcc'

System ubuntu 9.10
gcc 4.4.1
llvm and llvm-gcc from svn

Hello

../configure --target=arm-unknown-linux-gnueabi --program-prefix=arm-
--prefix=/home/kursh/arm --enable-gold --enable-plugins
--with-sysroot=/home/kursh/arms/sys-root

It seems you've configured binutils with gold...

/home/kursh/arm/arm-unknown-linux-gnueabi/bin/ranlib ./libgcc_eh.a
/home/kursh/arm/bin/arm-ld: error: libgcc/./_udivsi3_s.o: unsupported reloc
40 against local symbol

But gold for ARM is known to be incomplete/broken/WIP

Hello
yes, i try configure binutills wiith gold, becouse i need LTO support in
llvm-gcc for arm targets.

May be possible to find workaround, for this ?

Anton Korobeynikov-2 wrote: