title: Linaro cross-compile Glibc for ARM errors with invalid swi expression
body: <p>I am trying to build glibc-2.13 with debugging symbols for ARM using the Linaro Toolchain on a 32-bit Ubuntu 10.04 Virtual Machine. From what I have researched, the steps to do so ( and the steps I've taken ) are shown here:</p>
  
  <pre><code>mkdir /home/user/Desktop/glibc
  cd /home/user/Desktop/glibc
  wget http://ftp.gnu.org/gnu/glibc/glibc-ports-2.13.tar.gz
  wget http://ftp.gnu.org/gnu/glibc/glibc-2.13.tar.bz2
  tar xvjf glibc-2.13.tar.bz2
  tar xvf glibc-ports-2.13.tar.gz
  mkdir -p glibc-2.13/ports
  cp -r glibc-ports-2.13/* glibc-2.13/ports
  mkdir tmp
  mkdir glibc-build
  cd glibc-build
  export CFLAGS="-O1 -g"
  export CPPFLAGS="-O1 -g"
  export CC=/home/user/proj/toolchain/linaro/bin/arm-linux-gnueabi-gcc
  export CXX=/home/user/proj/toolchain/linaro/bin/arm-linux-gnueabi-g++
  ../glibc-2.13/configure --host=arm-linux --prefix=/home/user/Desktop/glibc/tmp --enable-addons ports=yes
  make
  </code></pre>
  
  <p>The configure step completes and when I move on to make, the build errors after a short time with the following error:</p>
  
  <pre><code>In file included from ../ports/sysdeps/unix/sysv/linux/arm/ldsodefs.h:23:0,
                   from ../csu/libc-tls.c:21,
                   from ../ports/sysdeps/arm/libc-tls.c:20:
  ../sysdeps/unix/sysv/linux/ldsodefs.h:64:0: note: this is the location of the previous definition
  /tmp/ccgCNS8e.s: Assembler messages:
  /tmp/ccgCNS8e.s:174: Error: invalid swi expression
  /tmp/ccgCNS8e.s:174: Error: value of 983045 too large for field of 2 bytes at 196
  make[2]: *** [/home/user/Desktop/glibc/glibc-build/csu/libc-tls.o] Error 1
  make[2]: Leaving directory `/home/user/Desktop/glibc/glibc-2.13/csu'
  make[1]: *** [csu/subdir_lib] Error 2
  make[1]: Leaving directory `/home/user/Desktop/glibc/glibc-2.13'
  make: *** [all] Error 2
  </code></pre>
  
  <p>From what I've read 'tls' is required, and if I try to build --without-tls , it errors saying that I do need tls. I haven't found anything on Google for this problem.</p>
  
  <p>Does anyone know how I can resolve this and get past this error? Thanks -</p>
  
  <p>EDIT: I've added the following exports before the configure command and still get the same error:</p>
  
  <pre><code>export CC=/home/user/gemini/toolchain/linaro/bin/arm-linux-gnueabi-gcc
  export CXX=/home/user/gemini/toolchain/linaro/bin/arm-linux-gnueabi-g++
  export AR=/home/user/proj/toolchain/linaro/bin/arm-linux-gnueabi-ar
  export AS=/home/user/proj/toolchain/linaro/bin/arm-linux-gnueabi-as
  export LD=/home/user/proj/toolchain/linaro/bin/arm-linux-gnueabi-ld
  export RANLIB=/home/user/proj/toolchain/linaro/bin/arm-linux-gnueabi-ranlib
  </code></pre>