vax-elf.exp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. # Expect script for VAX ELF linker tests
  2. # Copyright (C) 2012-2022 Free Software Foundation, Inc.
  3. #
  4. # This file is part of the GNU Binutils.
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  19. # MA 02110-1301, USA.
  20. #
  21. if { ![istarget vax-*-*] || ![is_elf_format] } {
  22. return
  23. }
  24. run_ld_link_tests [list \
  25. [list "PLT test (shared library)" \
  26. "-shared -T plt-local-lib.ld --hash-style=sysv" "" \
  27. "-k" \
  28. { plt-local-lib.s } \
  29. { { objdump -d plt-local-lib.dd } } \
  30. "plt-local-lib.so"] \
  31. [list "PLT test (object 1)" \
  32. "-r" "" \
  33. "-k" \
  34. { plt-local-hidden-pic.s } \
  35. {} \
  36. "plt-local-hidden-pic-r.o"] \
  37. [list "PLT test (object 2)" \
  38. "-r" "" \
  39. "-k" \
  40. { plt-local-rehidden-pic.s } \
  41. {} \
  42. "plt-local-rehidden-pic-r.o"] \
  43. [list "PLT test (executable)" \
  44. "-T plt-local.ld --hash-style=sysv tmpdir/plt-local-hidden-pic-r.o \
  45. tmpdir/plt-local-rehidden-pic-r.o tmpdir/plt-local-lib.so" "" \
  46. "" \
  47. { plt-local.s } \
  48. { { objdump -d plt-local.dd } } \
  49. "plt-local"]]
  50. # Global offset table tests. Make sure hidden symbols do not get GOT
  51. # assignments. Also verify offset references.
  52. run_ld_link_tests [list \
  53. [list "GOT test (auxiliary shared library)" \
  54. "-shared" "" \
  55. "-k" \
  56. { got-local-aux.s } \
  57. {} \
  58. "got-local-aux.so"] \
  59. [list "GOT test (auxiliary shared library for offsets)" \
  60. "-shared" "" \
  61. "-k" \
  62. { got-local-aux-off.s } \
  63. {} \
  64. "got-local-aux-off.so"] \
  65. [list "GOT test (object 1)" \
  66. "-r" "" \
  67. "-k" \
  68. { got-local-ref.s } \
  69. {} \
  70. "got-local-ref-r.o"] \
  71. [list "GOT test (object 1 hidden reference with offset)" \
  72. "-r" "" \
  73. "-k" \
  74. { got-local-ref-off-hidden.s } \
  75. {} \
  76. "got-local-ref-off-hidden-r.o"] \
  77. [list "GOT test (object 1 visible reference with offset)" \
  78. "-r" "" \
  79. "-k" \
  80. { got-local-ref-off-visible.s } \
  81. {} \
  82. "got-local-ref-off-visible-r.o"] \
  83. [list "GOT test (object 1 external reference with offset)" \
  84. "-r" "" \
  85. "-k" \
  86. { got-local-ref-off-external.s } \
  87. {} \
  88. "got-local-ref-off-external-r.o"] \
  89. [list "GOT test (object 2)" \
  90. "-r" "" \
  91. "-k" \
  92. { got-local-def.s } \
  93. {} \
  94. "got-local-def-r.o"] \
  95. [list "GOT test (object 2 for offsets)" \
  96. "-r" "" \
  97. "-k" \
  98. { got-local-def-off.s } \
  99. {} \
  100. "got-local-def-off-r.o"] \
  101. [list "GOT test (executable)" \
  102. "-e 0 tmpdir/got-local-aux.so tmpdir/got-local-ref-r.o \
  103. tmpdir/got-local-def-r.o" "" \
  104. "" \
  105. {} \
  106. { { readelf "-x .got" got-local-exe.xd } } \
  107. "got-local-exe"] \
  108. [list "GOT test (shared library)" \
  109. "-shared tmpdir/got-local-aux.so tmpdir/got-local-ref-r.o \
  110. tmpdir/got-local-def-r.o" "" \
  111. "" \
  112. {} \
  113. { { readelf "-x .got" got-local-lib.xd } } \
  114. "got-local-lib.so"] \
  115. [list "GOT test (executable hidden reference with offset)" \
  116. "-e 0 -T got-local.ld tmpdir/got-local-aux-off.so \
  117. tmpdir/got-local-ref-off-hidden-r.o \
  118. tmpdir/got-local-def-off-r.o" "" \
  119. "" \
  120. {} \
  121. { { readelf "-x .got" got-local-exe-off.xd } \
  122. { objdump -d got-local-exe-off-hidden.dd } } \
  123. "got-local-exe-off-hidden"] \
  124. [list "GOT test (shared library hidden reference with offset)" \
  125. "-shared -T got-local.ld tmpdir/got-local-aux-off.so \
  126. tmpdir/got-local-ref-off-hidden-r.o \
  127. tmpdir/got-local-def-off-r.o" "" \
  128. "" \
  129. {} \
  130. { { readelf "-x .got" got-local-lib-off.xd } \
  131. { objdump -d got-local-lib-off-hidden.dd } } \
  132. "got-local-lib-off-hidden.so"] \
  133. [list "GOT test (executable visible reference with offset)" \
  134. "-e 0 -T got-local.ld tmpdir/got-local-aux-off.so \
  135. tmpdir/got-local-ref-off-visible-r.o \
  136. tmpdir/got-local-def-off-r.o" "" \
  137. "" \
  138. {} \
  139. { { readelf "-x .got" got-local-exe-off.xd } \
  140. { objdump -d got-local-exe-off-visible.dd } } \
  141. "got-local-exe-off-visible"] \
  142. [list "GOT test (shared library visible reference with offset)" \
  143. "-shared -T got-local.ld tmpdir/got-local-aux-off.so \
  144. tmpdir/got-local-ref-off-visible-r.o \
  145. tmpdir/got-local-def-off-r.o" "" \
  146. "" \
  147. {} \
  148. { { ld got-local-lib-off-visible.ed } } \
  149. "got-local-lib-off-visible.so"] \
  150. [list "GOT test (executable external reference with offset)" \
  151. "-e 0 -T got-local.ld tmpdir/got-local-aux-off.so \
  152. tmpdir/got-local-ref-off-external-r.o \
  153. tmpdir/got-local-def-off-r.o" "" \
  154. "" \
  155. {} \
  156. { { ld got-local-off-external.ed } } \
  157. "got-local-exe-off-external"] \
  158. [list "GOT test (shared library external reference with offset)" \
  159. "-shared -T got-local.ld tmpdir/got-local-aux-off.so \
  160. tmpdir/got-local-ref-off-external-r.o \
  161. tmpdir/got-local-def-off-r.o" "" \
  162. "" \
  163. {} \
  164. { { ld got-local-off-external.ed } } \
  165. "got-local-lib-off-external.so"]]
  166. # Export class relocation tests.
  167. run_ld_link_tests [list \
  168. [list \
  169. "VAX export class call relocation test" \
  170. "-shared -Ttext 0x12340000 -T export-class.ld --hash-style=sysv" "" \
  171. "-k" \
  172. [list export-class-call.s export-class-def.s] \
  173. [list \
  174. [list objdump -d export-class-call.dd] \
  175. [list readelf -r export-class-call.rd] \
  176. [list readelf "-x .got" export-class-call.xd]] \
  177. "export-class-call.so"] \
  178. [list \
  179. "VAX export class data relocation test" \
  180. "-shared -Ttext 0x12340000 -T export-class.ld --hash-style=sysv" "" \
  181. "-k" \
  182. [list export-class-data.s export-class-def.s] \
  183. [list \
  184. [list objdump -d export-class-data.dd] \
  185. [list readelf -r export-class-data.rd] \
  186. [list readelf "-x .got" export-class-data.xd]] \
  187. "export-class-data.so"]]