s390.exp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # Expect script for ld-s390 tests
  2. # Copyright (C) 2003-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. # Test s390 linking; all types of relocs. This tests the assembler and
  22. # tools like objdump as well as the linker.
  23. if { !([istarget "s390-*-*"] || [istarget "s390x-*-*"]) } {
  24. return
  25. }
  26. # List contains test-items with 3 items followed by 2 lists:
  27. # 0:name 1:ld early options 2:ld late options 3:assembler options
  28. # 4:filenames of assembler files 5: action and options. 6: name of output file
  29. # Actions:
  30. # objdump: Apply objdump options on result. Compare with regex (last arg).
  31. # nm: Apply nm options on result. Compare with regex (last arg).
  32. # readelf: Apply readelf options on result. Compare with regex (last arg).
  33. set s390tests {
  34. {"TLS -fpic -shared transitions" "-shared -melf_s390 --hash-style=sysv" ""
  35. "-m31" {tlspic1.s tlspic2.s}
  36. {{readelf -Ssrl tlspic.rd} {objdump -dzrj.text tlspic.dd}
  37. {objdump -sj.got tlspic.sd} {objdump -sj.tdata tlspic.td}}
  38. "libtlspic.so"}
  39. {"Helper shared library" "-shared -melf_s390" ""
  40. "-m31" {tlslib.s} {} "libtlslib.so"}
  41. {"TLS -fpic and -fno-pic exec transitions"
  42. "-melf_s390 tmpdir/libtlslib.so --hash-style=sysv" ""
  43. "-m31" {tlsbinpic.s tlsbin.s}
  44. {{readelf -Ssrl tlsbin.rd} {objdump -dzrj.text tlsbin.dd}
  45. {objdump -sj.got tlsbin.sd} {objdump -sj.tdata tlsbin.td}}
  46. "tlsbin"}
  47. {"GOT: symbol address load from got to larl"
  48. "-shared -melf_s390 --hash-style=sysv --version-script=gotreloc-1.ver" ""
  49. "-m31" {gotreloc-1.s}
  50. {{objdump -dzrj.text gotreloc_31-1.dd}}
  51. "gotreloc_31-1"}
  52. }
  53. set s390xtests {
  54. {"TLS -fpic -shared transitions" "-shared -melf64_s390 --hash-style=sysv" ""
  55. "-m64 -Aesame" {tlspic1_64.s tlspic2_64.s}
  56. {{readelf -WSsrl tlspic_64.rd} {objdump -dzrj.text tlspic_64.dd}
  57. {objdump -sj.got tlspic_64.sd} {objdump -sj.tdata tlspic_64.td}}
  58. "libtlspic_64.so"}
  59. {"Helper shared library" "-shared -melf64_s390" ""
  60. "-m64 -Aesame" {tlslib_64.s} {} "libtlslib_64.so"}
  61. {"TLS -fpic and -fno-pic exec transitions"
  62. "-melf64_s390 tmpdir/libtlslib_64.so --hash-style=sysv" ""
  63. "-m64 -Aesame" {tlsbinpic_64.s tlsbin_64.s}
  64. {{readelf -WSsrl tlsbin_64.rd} {objdump -dzrj.text tlsbin_64.dd}
  65. {objdump -sj.got tlsbin_64.sd} {objdump -sj.tdata tlsbin_64.td}}
  66. "tlsbin_64"}
  67. {"GOT: norelro symbol address load from got to larl"
  68. "-shared -melf64_s390 -z norelro --hash-style=sysv --version-script=gotreloc-1.ver" ""
  69. "-m64" {gotreloc-1.s}
  70. {{objdump -dzrj.text gotreloc_64-norelro-1.dd}}
  71. "gotreloc_64-1"}
  72. {"GOT: relro symbol address load from got to larl"
  73. "-shared -melf64_s390 -z relro --hash-style=sysv --version-script=gotreloc-1.ver" ""
  74. "-m64" {gotreloc-1.s}
  75. {{objdump -dzrj.text gotreloc_64-relro-1.dd}}
  76. "gotreloc_64-1"}
  77. {"PLT: offset test"
  78. "-shared -m elf64_s390 -dT pltoffset-1.ld" ""
  79. "-m64" {pltoffset-1.s}
  80. {{objdump "-dzrj.text --stop-address=16" pltoffset-1.dd}}
  81. "pltoffset-1"}
  82. }
  83. if [istarget "s390-*-*"] {
  84. run_ld_link_tests $s390tests
  85. }
  86. if [istarget "s390x-*-*"] {
  87. run_ld_link_tests $s390tests
  88. run_ld_link_tests $s390xtests
  89. }
  90. set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
  91. foreach t $test_list {
  92. # We need to strip the ".d", but can leave the dirname.
  93. verbose [file rootname $t]
  94. run_dump_test [file rootname $t]
  95. }