Advertisement
cr1901

Reloc Fun

May 11th, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 0.96 KB | None | 0 0
  1. wjones@raspberrypi-ptrain ~/src/asm $ cat reloc2.s
  2. /* -- load01.s */
  3.  
  4. /* -- Data section */
  5. .data
  6.  
  7. /* Ensure variable is 4-byte aligned */
  8. .balign 4
  9. /* Define storage for myvar1 */
  10. myvar1:
  11.     /* Contents of myvar1 is just 4 bytes containing value '3' */
  12.     .word 3
  13.  
  14. /* Ensure variable is 4-byte aligned */
  15. .balign 4
  16. /* Define storage for myvar2 */
  17. myvar2:
  18.     /* Contents of myvar2 is just 4 bytes containing value '4' */
  19.     .word 4
  20.  
  21. /* -- Code section */
  22. .text
  23.  
  24. /* Ensure code is 4 byte aligned */
  25. .balign 4
  26. .global main
  27. main:
  28.     ldr r1, myvar1 /* r1 ← &myvar1 */
  29.     ldr r2, myvar2 /* r2 ← &myvar2 */
  30.     add r0, r1, r2         /* r0r1 + r2 */
  31.     bx lr
  32.  
  33. wjones@raspberrypi-ptrain ~/src/asm $ as -o reloc2.o reloc2.s
  34. reloc2.s: Assembler messages:
  35. reloc2.s:27: Error: internal_relocation (type: OFFSET_IMM) not fixed up
  36. reloc2.s:28: Error: internal_relocation (type: OFFSET_IMM) not fixed up
  37. wjones@raspberrypi-ptrain ~/src/asm $
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement