title: Assembly coding strdup. Malloc calling in shared library
body: <p>I have a problem, I can't compile my strdup while calling malloc.
  When I don't call malloc, it compiles my shared library perfectly, so if someone could help me that would be great !</p>
  
  <p>here is my code:</p>
  
  <hr>
  
  <pre><code>BITS 64
  DEFAULT REL
          global my_strdup:function
          extern malloc
  my_strdup:
  
  [...]
  
      call malloc
  </code></pre>
  
  <hr>
  
  <p>I compile with this:</p>
  
  <p>$> nasm -f elf64 my_strdup.S</p>
  
  <p>$> gcc -shared -o libmy.so my_strdup.o</p>
  
  <p>/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: my_strdup.o: relocation R_X86_64_PC32 against undefined symbol `malloc@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
  /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: final link failed: Bad value
  collect2: error: ld returned 1 exit status</p>
  
  <p>I have this error. I don't understand it ! I have a 64bit computer. 
  It is the first time I try Assembly.</p>
  
  <p>Thanks !</p>