title: Inline assembly --> Error: internal_relocation (type: OFFSET_IMM) not fixed up
body: <p>I have this test file:</p>
  
  <pre><code>extern long int VALUE;
  extern int *vMEMORY;
  
  void main() {
          (*vMEMORY) = VALUE;
  } 
  </code></pre>
  
  <p>I want the arm assembly code for it, so I use this:</p>
  
  <pre><code>arm-linux-gnueabi-gcc -S -march=armv4 test.c
  </code></pre>
  
  <p>And I get the following file test.s:</p>
  
  <pre><code>    .arch armv4
  .eabi_attribute 27, 3
  .fpu vfpv3-d16
  .eabi_attribute 20, 1
  .eabi_attribute 21, 1
  .eabi_attribute 23, 3
  .eabi_attribute 24, 1
  .eabi_attribute 25, 1
  .eabi_attribute 26, 2
  .eabi_attribute 30, 6
  .eabi_attribute 34, 0
  .eabi_attribute 18, 4
  .file   "test.c"
  .text
  .align  2
  .global main
  .type   main, %function
  
  main:
  
  @ Function supports interworking.
  @ args = 0, pretend = 0, frame = 0
  @ frame_needed = 1, uses_anonymous_args = 0
  @ link register save eliminated.
  str fp, [sp, #-4]!
  add fp, sp, #0
  ldr r3, .L2
  ldr r3, [r3, #0]
  ldr r2, .L2+4
  ldr r2, [r2, #0]
  str r2, [r3, #0]
  add sp, fp, #0
  ldmfd   sp!, {fp}
  bx  lr
  
  .L3:
  .align  2
  
  .L2:
  .word   vMEMORY
  .word   VALUE
  .size   main, .-main
  .ident  "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
  .section    .note.GNU-stack,"",%progbits
  </code></pre>
  
  <p>I want to change this test.s code into inline assembly code in a C function.
  But I don't know how to do it. 
  I've tried this:</p>
  
  <pre><code>asm volatile (
       "ldr   r3, %0\n"
       "ldr   r3, [r3, #0]\n"
       "ldr   r2, %1\n"
       "ldr   r2, [r2, #0]\n"
       "str   r2, [r3, #0]\n"
       : "=r" (*vMEMORY)
       : "r" (VALUE)
       : "r2", "r3"
  );
  </code></pre>
  
  <p>But I get the following error, when I compile the C function:</p>
  
  <p>/tmp/cckOasvT.s: Assembler messages:</p>
  
  <p>/tmp/cckOasvT.s:254: Error: internal_relocation (type: OFFSET_IMM) not fixed up</p>
  
  <p>/tmp/cckOasvT.s:256: Error: internal_relocation (type: OFFSET_IMM) not fixed up</p>
  
  <p>Could anyone help me to solve the error or tell me how I should change the code?</p>