title: gcc shared library failed linking to glibc
body: <p>I'm writing a simple C shared library using Eclipse CDT under Linux 64bit.</p>
  
  <p>The code has one reference to the <code>rand()</code> function in the <code>&lt;stdlib.h&gt;</code> It compiles fine but when linking it reports the following error from the linker:</p>
  
  <pre><code>gcc -shared -o "libalg.so"  ./sort.o   
  /usr/bin/ld: ./sort.o: relocation R_X86_64_PC32 against undefined symbol `rand@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: final link failed: Bad value
  </code></pre>
  
  <p>sort.o is the object file compiled from the file. libalg.so is the target shared library name.</p>
  
  <p>Can anyone explaining why this happen? </p>
  
  <p>Thanks.</p>