got-page-5.s 761 B

12345678910111213141516171819202122232425262728293031
  1. # Create a mergeable section full of a single value,
  2. # and page references relative to one entry called "data".
  3. #
  4. # The mergeable entries collapse to one, but the offsets
  5. # from "data" must still be retained, and need 3 page entries.
  6. #
  7. # Technically this isn't valid, because it creates out-of-section
  8. # page references. It's still a useful way of making sure that
  9. # offsets in mergeable sections are handled correctly.
  10. .globl foo
  11. .ent foo
  12. foo:
  13. .set y,0
  14. .rept 4
  15. lw $4,%got_page(data + y)($gp)
  16. addiu $4,$4,%got_ofst(data + y)
  17. .set y,y+0x8000
  18. .endr
  19. .end foo
  20. .section .rodata.cst4,"aM",@progbits,4
  21. data:
  22. .rept 0x8000*4
  23. .word 123456
  24. .endr
  25. # Make sure the loadable size of the library is large.
  26. .section .bss
  27. .globl g
  28. g:
  29. .space 0x800000