mn10300.exp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. # Expect script for ld-mn10300 tests
  2. # Copyright (C) 2007-2022 Free Software Foundation, Inc.
  3. #
  4. # This file is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  17. # MA 02110-1301, USA.
  18. #
  19. if {!([istarget "am3*-*-*"]) && !([istarget "mn10300*-*-*"]) } {
  20. return
  21. }
  22. # Set up a list as described in ld-lib.exp
  23. set mn10300_tests {
  24. {
  25. "am33 string merging"
  26. "-relax -Ttext 0x8000074" ""
  27. ""
  28. { "i36434.s" "i36434-2.s" }
  29. { {objdump -dz i36434.d} }
  30. "i36434.x"
  31. }
  32. {
  33. "difference of two same-section symbols"
  34. "-Ttext 0" ""
  35. ""
  36. { "i112045-1.s" }
  37. { {objdump -d i112045-1.d} }
  38. "i112045-1.x"
  39. }
  40. {
  41. "difference of two same-section symbols where the difference is held in another section"
  42. "-relax -Ttext 100" ""
  43. ""
  44. { "i112045-3.s" }
  45. { {objdump -D i112045-3.d} }
  46. "i112045-3.x"
  47. }
  48. {
  49. "relaxation and alignment directives"
  50. "-relax -Ttext 100 -Tbss 300" ""
  51. ""
  52. { "i127740.s" }
  53. { {objdump -d i127740.d} }
  54. "i127740.x"
  55. }
  56. {
  57. "adjustment of symbols due to relaxation"
  58. "-Tdata 1f -Ttext 0 -relax" ""
  59. ""
  60. { "i135409-1.s" }
  61. { {readelf --syms i135409-1.d} }
  62. "i135409-1.x"
  63. }
  64. {
  65. "adjustment of symbols due to relaxation (with alignment directives)"
  66. "-Tdata 1f -Ttext 0 -relax" ""
  67. ""
  68. { "i135409-2.s" }
  69. { {readelf --syms i135409-2.d} }
  70. "i135409-2.x"
  71. }
  72. {
  73. "adjustment of symbols due to relaxation (with a symbol in the deleted region)"
  74. "-Tdata 1f -Ttext 0 -relax" ""
  75. ""
  76. { "i135409-3.s" }
  77. { {objdump -d i135409-3.d} }
  78. "i135409-3.x"
  79. }
  80. {
  81. "adjusting a 16-bit forward branch"
  82. "-Ti135409-4.t -relax" ""
  83. ""
  84. { "i135409-4.s" }
  85. { {objdump -d i135409-4.d} }
  86. "i135409-4.x"
  87. }
  88. {
  89. "adjusting a 16-bit backward branch"
  90. "-Ti135409-5.t -relax" ""
  91. ""
  92. { "i135409-5.s" }
  93. { {objdump -d i135409-5.d} }
  94. "i135409-5.x"
  95. }
  96. {
  97. "relaxing offsets into a merged string section"
  98. "-Ti143317.t -shared -relax" ""
  99. ""
  100. { "i143317.s" }
  101. { {objdump -d i143317.d} }
  102. "i143317.x"
  103. }
  104. }
  105. run_ld_link_tests $mn10300_tests
  106. if {!([istarget "am3*-*-*"])} {
  107. return
  108. }
  109. set am33_tests {
  110. {
  111. "difference of two same-section symbols (in a shared library)"
  112. "-shared" ""
  113. ""
  114. { "i112045-2.s" }
  115. { {objdump -R i112045-2.d} }
  116. "i112045-2.x"
  117. }
  118. }
  119. run_ld_link_tests $am33_tests
  120. proc i126256-test { } {
  121. global CC_FOR_TARGET
  122. global ld
  123. global srcdir
  124. global subdir
  125. set tmpdir tmpdir
  126. set testname "Seg fault whilst linking one shared library into another when relaxation is enabled."
  127. if { ![check_compiler_available] } then {
  128. return
  129. }
  130. if { ![ld_compile "$CC_FOR_TARGET -mrelax -fPIC" $srcdir/$subdir/i126256-1.c $tmpdir/i126256-1.o] } {
  131. unsupported $testname
  132. return
  133. }
  134. if { ![ld_compile "$CC_FOR_TARGET -mrelax -fPIC" $srcdir/$subdir/i126256-2.c $tmpdir/i126256-2.o] } {
  135. unsupported $testname
  136. return
  137. }
  138. if { ![ld_link $ld $tmpdir/i126256-1.so "-shared $tmpdir/i126256-1.o -e 0"]} {
  139. fail $testname
  140. return
  141. }
  142. if { ![ld_link $ld $tmpdir/i126256-2.so "--relax -shared $tmpdir/i126256-2.o $tmpdir/i126256-1.so -e 0"]} {
  143. fail $testname
  144. return
  145. }
  146. pass $testname
  147. }
  148. i126256-test