protected-data-2b.S 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. .section .rodata.str1.8,"aMS",@progbits,1
  2. .align 8
  3. .LC0:
  4. .string "'protected_data_1a' in main and shared library doesn't have same address"
  5. .align 8
  6. .LC1:
  7. .string "'protected_data_1a' in main and shared library doesn't have same value"
  8. .align 8
  9. .LC2:
  10. .string "'protected_data_1b' in main and shared library has same address"
  11. .section .rodata.str1.1,"aMS",@progbits,1
  12. .LC3:
  13. .string "PASS"
  14. .section .text.startup,"ax",@progbits
  15. .p2align 4,,15
  16. .globl main
  17. .type main, @function
  18. main:
  19. .LFB11:
  20. .cfi_startproc
  21. pushq %rbp
  22. .cfi_def_cfa_offset 16
  23. .cfi_offset 6, -16
  24. xorl %eax, %eax
  25. pushq %rbx
  26. .cfi_def_cfa_offset 24
  27. .cfi_offset 3, -24
  28. xorl %ebx, %ebx
  29. subq $8, %rsp
  30. .cfi_def_cfa_offset 32
  31. call protected_data_1a_p
  32. movq protected_data_1a@GOTPCREL(%rip), %rbp
  33. cmpq %rbp, %rax
  34. je .L2
  35. leaq .LC0(%rip), %rdi
  36. movb $1, %bl
  37. call puts
  38. .L2:
  39. movl $-1, %edi
  40. movl $-1, 0(%rbp)
  41. call check_protected_data_1a
  42. testl %eax, %eax
  43. jne .L17
  44. .L3:
  45. movl $-3, %edi
  46. call set_protected_data_1a
  47. cmpl $-3, 0(%rbp)
  48. je .L4
  49. leaq .LC1(%rip), %rdi
  50. movl $1, %ebx
  51. call puts
  52. .L4:
  53. xorl %eax, %eax
  54. call protected_data_1b_p
  55. leaq protected_data_1b(%rip), %rdx
  56. cmpq %rdx, %rax
  57. je .L18
  58. .L5:
  59. movl $2, %edi
  60. movl $-10, protected_data_1b(%rip)
  61. call check_protected_data_1b
  62. testl %eax, %eax
  63. jne .L19
  64. movl $-30, %edi
  65. call set_protected_data_1b
  66. cmpl $-10, protected_data_1b(%rip)
  67. je .L9
  68. .L7:
  69. leaq .LC2(%rip), %rdi
  70. movl $1, %ebx
  71. call puts
  72. .L8:
  73. addq $8, %rsp
  74. .cfi_remember_state
  75. .cfi_def_cfa_offset 24
  76. movl %ebx, %eax
  77. popq %rbx
  78. .cfi_def_cfa_offset 16
  79. popq %rbp
  80. .cfi_def_cfa_offset 8
  81. ret
  82. .L9:
  83. .cfi_restore_state
  84. testl %ebx, %ebx
  85. jne .L11
  86. leaq .LC3(%rip), %rdi
  87. call puts
  88. jmp .L8
  89. .L19:
  90. leaq .LC2(%rip), %rdi
  91. call puts
  92. movl $-30, %edi
  93. call set_protected_data_1b
  94. cmpl $-10, protected_data_1b(%rip)
  95. jne .L7
  96. .L11:
  97. movl $1, %ebx
  98. jmp .L8
  99. .L17:
  100. leaq .LC1(%rip), %rdi
  101. movl $1, %ebx
  102. call puts
  103. jmp .L3
  104. .L18:
  105. leaq .LC2(%rip), %rdi
  106. movl $1, %ebx
  107. call puts
  108. jmp .L5
  109. .cfi_endproc
  110. .LFE11:
  111. .size main, .-main
  112. .globl protected_data_1b
  113. .data
  114. .align 4
  115. .type protected_data_1b, @object
  116. .size protected_data_1b, 4
  117. protected_data_1b:
  118. .long 3
  119. .section .note.GNU-stack,"",@progbits