pr28827-1.s 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. .globl _start
  2. .type _start,@function
  3. .text
  4. _start:
  5. .cfi_startproc
  6. 0:
  7. addis 2,12,(.TOC.-0b)@ha
  8. addi 2,2,(.TOC.-0b)@l
  9. .localentry _start,.-0b
  10. mflr 0
  11. std 0,16(1)
  12. stdu 1,-32(1)
  13. .cfi_def_cfa_offset 32
  14. .cfi_offset 65, 16
  15. .macro call f
  16. bl \f
  17. nop
  18. .endm
  19. # 3000 plt calls, giving over 64k in .plt size. With a small .got
  20. # this guarantees some plt call stubs can use a 16-bit signed offset
  21. # from .TOC. while others need a 32-bit signed offset (and are larger).
  22. .irpc t4,012
  23. .irpc t3,0123456789
  24. .irpc t2,0123456789
  25. .irpc t1,0123456789
  26. .if \t4
  27. call f\t4\t3\t2\t1
  28. .elseif \t3
  29. call f\t3\t2\t1
  30. .elseif \t2
  31. call f\t2\t1
  32. .else
  33. call f\t1
  34. .endif
  35. .endr
  36. .endr
  37. .endr
  38. .endr
  39. addi 1,1,32
  40. .cfi_def_cfa_offset 0
  41. ld 0,16(1)
  42. mtlr 0
  43. .cfi_restore 65
  44. blr
  45. .cfi_endproc
  46. .size _start,.-_start
  47. # Padding to trigger a stub sizing error with commit 2f83249c13 and
  48. # c804c6f98d (relro changes). This particular testcase gives a decrease
  49. # in .got to .plt gap after .eh_frame editing, resulting in some plt
  50. # call stubs being smaller. If the very last one is smaller the size
  51. # error triggers. Arguably, the ppc64 backend should not report an
  52. # error for shrinkage. However, the actual PR object files showed an
  53. # *increase* in .got to .plt gap after .eh_frame editing, resulting in
  54. # some plt call stubs being larger. That hit an assertion failure
  55. # when a long branch stub followed the larger plt call stub and
  56. # overwrote the end of the plt call stub.
  57. # With enough fiddling of this testcase it likely would be possible to
  58. # find the right padding here and .eh_frame sizing to trigger an
  59. # increase in .got to .plt gap. The point of this testcase is to show
  60. # that the .got to .plt gap should not change after sizing.
  61. .space 50000
  62. # Generate some .eh_frame info that -gc-sections will trim
  63. .macro fundef f
  64. .section .text.\f,"ax",@progbits
  65. .type \f,@function
  66. \f:
  67. .cfi_startproc
  68. blr
  69. .cfi_endproc
  70. .size \f,.-\f
  71. .endm
  72. .irpc t2,0123456789
  73. .irpc t1,0123456789
  74. fundef dummy\t2\t1
  75. .endr
  76. .endr