SHARE
TWEET

Untitled

a guest Aug 17th, 2012 2 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         .file   "libtest.c"
  2.         .text
  3.         .globl  test
  4.         .align  4
  5.         .type   test,@function
  6. test:
  7.         /* prologue */
  8.         l.sw    -4(r1), r9
  9.         l.sw    -8(r1), r2
  10.         l.addi  r2, r1, 0
  11.         l.addi  r1, r1, -12
  12.  
  13.         /* setup r9 to point to .got */
  14.         l.jal   .LPC0
  15.         l.nop
  16. .LPC0:
  17.         l.movhi r11, gotpchi(_GLOBAL_OFFSET_TABLE_+(.-.LPC0))
  18.         l.ori   r11, r11, gotpclo(_GLOBAL_OFFSET_TABLE_+(.-.LPC0))
  19.         l.add   r9, r9, r11
  20.  
  21.         /*
  22.          * load .L.str into r3 by using the relation
  23.          * .got - .L.str + r9 = .L.str
  24.          */
  25.         l.movhi r3, gotoffhi(.L.str)
  26.         l.ori   r3, r3, gotofflo(.L.str)
  27.         l.add   r3, r3, r9
  28.  
  29.         /* call printf through got table */
  30.         l.lwz   r11, got(printf)(r9)
  31.         l.jalr  r11
  32.         l.nop
  33.  
  34.         /* epilogue */
  35.         l.sw    -12(r2), r11
  36.         l.addi  r1, r2, 0
  37.         l.lwz   r9, -4(r1)
  38.         l.jr    r9
  39.         l.lwz   r2, -8(r1)
  40. .Ltmp0:
  41.         .size   test, .Ltmp0-test
  42.  
  43.         .type   .L.str,@object
  44.         .section        .rodata.str1.1,"aMS",@progbits,1
  45. .L.str:
  46.         .asciz   "hello from libtest!\n"
  47.         .size   .L.str, 21
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top