title: How to load address of function or label into register
body: <p>I am trying to load the address of 'main' into a register (R10) in the GNU Assembler. I am unable to. Here I what I have and the error message I receive.</p>
  
  <pre><code>main:
     lea main, %r10
  </code></pre>
  
  <p>I also tried the following syntax (this time using mov)</p>
  
  <pre><code>main:
     movq $main, %r10
  </code></pre>
  
  <p>With both of the above I get the following error:</p>
  
  <pre><code>/usr/bin/ld: /tmp/ccxZ8pWr.o: relocation R_X86_64_32S against symbol `main' can not be used when making a shared object; recompile with -fPIC
  /usr/bin/ld: final link failed: Nonrepresentable section on output
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>Compiling with -fPIC does not resolve the issue and just gives me the same exact error.</p>