title: LLVM crosscompile can't create dynamic relocation R_ARM_ABS32
body: <p>I am trying to cross-compile for the Raspberry Pi with LLVM using LLD as the linker with the gnu stdlib implementation. I get a load of the following warnings, which refer to relocations inside read-only sections, all contained within the standard library implementation (seems to happen for c and cpp).</p>
  
  <pre><code>ld.lld: error: can't create dynamic relocation R_ARM_ABS32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
      &gt;&gt;&gt; defined in /home/ted/cross.llvm.raspbian/sysroot/usr/lib/gcc/arm-linux-gnueabihf/6.3.0/../../../arm-linux-gnueabihf/libm.a(s_atan.o)
      &gt;&gt;&gt; referenced by s_atan.o:(atanMp.constprop.0) in archive /home/ted/cross.llvm.raspbian/sysroot/usr/lib/gcc/arm-linux-gnueabihf/6.3.0/../../../arm-linux-gnueabihf/libm.a
  </code></pre>
  
  <p>While the diagnostic tells me to use <code>-z,notext</code> this is <a href="http://llvm.1065342.n5.nabble.com/llvm-dev-LLD-Can-t-create-dynamic-relocation-R-X86-64-64-against-local-symbol-in-readonly-segment-tp107341p107383.html" rel="nofollow noreferrer">apparently bad</a>. Is there another way to fix the issue, or am I using incorrect flags for the cross-compilation?</p>
  
  <p>Side note: for the cross-compilation I use</p>
  
  <pre><code>clang++ --target=arm-linux-gnueabihf --sysroot=./sysroot -fuse-ld=lld --verbose test.cpp -o test
  </code></pre>
  
  <p><code>./sysroot</code> contains <code>/usr</code> and <code>/lib</code> from the Raspberry.</p>