1# Expect script for VAX ELF linker tests 2# Copyright (C) 2012-2021 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 22if { ![istarget vax-*-*] || ![is_elf_format] } { 23 return 24} 25 26run_ld_link_tests [list \ 27 [list "PLT test (shared library)" \ 28 "-shared -T plt-local-lib.ld --hash-style=sysv" "" \ 29 "-k" \ 30 { plt-local-lib.s } \ 31 { { objdump -d plt-local-lib.dd } } \ 32 "plt-local-lib.so"] \ 33 [list "PLT test (object 1)" \ 34 "-r" "" \ 35 "-k" \ 36 { plt-local-hidden-pic.s } \ 37 {} \ 38 "plt-local-hidden-pic-r.o"] \ 39 [list "PLT test (object 2)" \ 40 "-r" "" \ 41 "-k" \ 42 { plt-local-rehidden-pic.s } \ 43 {} \ 44 "plt-local-rehidden-pic-r.o"] \ 45 [list "PLT test (executable)" \ 46 "-T plt-local.ld --hash-style=sysv tmpdir/plt-local-hidden-pic-r.o \ 47 tmpdir/plt-local-rehidden-pic-r.o tmpdir/plt-local-lib.so" "" \ 48 "" \ 49 { plt-local.s } \ 50 { { objdump -d plt-local.dd } } \ 51 "plt-local"]] 52 53# Global offset table tests. Make sure hidden symbols do not get GOT 54# assignments. Also verify offset references. 55run_ld_link_tests [list \ 56 [list "GOT test (auxiliary shared library)" \ 57 "-shared" "" \ 58 "-k" \ 59 { got-local-aux.s } \ 60 {} \ 61 "got-local-aux.so"] \ 62 [list "GOT test (auxiliary shared library for offsets)" \ 63 "-shared" "" \ 64 "-k" \ 65 { got-local-aux-off.s } \ 66 {} \ 67 "got-local-aux-off.so"] \ 68 [list "GOT test (object 1)" \ 69 "-r" "" \ 70 "-k" \ 71 { got-local-ref.s } \ 72 {} \ 73 "got-local-ref-r.o"] \ 74 [list "GOT test (object 1 hidden reference with offset)" \ 75 "-r" "" \ 76 "-k" \ 77 { got-local-ref-off-hidden.s } \ 78 {} \ 79 "got-local-ref-off-hidden-r.o"] \ 80 [list "GOT test (object 1 visible reference with offset)" \ 81 "-r" "" \ 82 "-k" \ 83 { got-local-ref-off-visible.s } \ 84 {} \ 85 "got-local-ref-off-visible-r.o"] \ 86 [list "GOT test (object 1 external reference with offset)" \ 87 "-r" "" \ 88 "-k" \ 89 { got-local-ref-off-external.s } \ 90 {} \ 91 "got-local-ref-off-external-r.o"] \ 92 [list "GOT test (object 2)" \ 93 "-r" "" \ 94 "-k" \ 95 { got-local-def.s } \ 96 {} \ 97 "got-local-def-r.o"] \ 98 [list "GOT test (object 2 for offsets)" \ 99 "-r" "" \ 100 "-k" \ 101 { got-local-def-off.s } \ 102 {} \ 103 "got-local-def-off-r.o"] \ 104 [list "GOT test (executable)" \ 105 "-e 0 tmpdir/got-local-aux.so tmpdir/got-local-ref-r.o \ 106 tmpdir/got-local-def-r.o" "" \ 107 "" \ 108 {} \ 109 { { readelf "-x .got" got-local-exe.xd } } \ 110 "got-local-exe"] \ 111 [list "GOT test (shared library)" \ 112 "-shared tmpdir/got-local-aux.so tmpdir/got-local-ref-r.o \ 113 tmpdir/got-local-def-r.o" "" \ 114 "" \ 115 {} \ 116 { { readelf "-x .got" got-local-lib.xd } } \ 117 "got-local-lib.so"] \ 118 [list "GOT test (executable hidden reference with offset)" \ 119 "-e 0 -T got-local.ld tmpdir/got-local-aux-off.so \ 120 tmpdir/got-local-ref-off-hidden-r.o \ 121 tmpdir/got-local-def-off-r.o" "" \ 122 "" \ 123 {} \ 124 { { readelf "-x .got" got-local-exe-off.xd } \ 125 { objdump -d got-local-exe-off-hidden.dd } } \ 126 "got-local-exe-off-hidden"] \ 127 [list "GOT test (shared library hidden reference with offset)" \ 128 "-shared -T got-local.ld tmpdir/got-local-aux-off.so \ 129 tmpdir/got-local-ref-off-hidden-r.o \ 130 tmpdir/got-local-def-off-r.o" "" \ 131 "" \ 132 {} \ 133 { { readelf "-x .got" got-local-lib-off.xd } \ 134 { objdump -d got-local-lib-off-hidden.dd } } \ 135 "got-local-lib-off-hidden.so"] \ 136 [list "GOT test (executable visible reference with offset)" \ 137 "-e 0 -T got-local.ld tmpdir/got-local-aux-off.so \ 138 tmpdir/got-local-ref-off-visible-r.o \ 139 tmpdir/got-local-def-off-r.o" "" \ 140 "" \ 141 {} \ 142 { { readelf "-x .got" got-local-exe-off.xd } \ 143 { objdump -d got-local-exe-off-visible.dd } } \ 144 "got-local-exe-off-visible"] \ 145 [list "GOT test (shared library visible reference with offset)" \ 146 "-shared -T got-local.ld tmpdir/got-local-aux-off.so \ 147 tmpdir/got-local-ref-off-visible-r.o \ 148 tmpdir/got-local-def-off-r.o" "" \ 149 "" \ 150 {} \ 151 { { ld got-local-lib-off-visible.ed } } \ 152 "got-local-lib-off-visible.so"] \ 153 [list "GOT test (executable external reference with offset)" \ 154 "-e 0 -T got-local.ld tmpdir/got-local-aux-off.so \ 155 tmpdir/got-local-ref-off-external-r.o \ 156 tmpdir/got-local-def-off-r.o" "" \ 157 "" \ 158 {} \ 159 { { ld got-local-off-external.ed } } \ 160 "got-local-exe-off-external"] \ 161 [list "GOT test (shared library external reference with offset)" \ 162 "-shared -T got-local.ld tmpdir/got-local-aux-off.so \ 163 tmpdir/got-local-ref-off-external-r.o \ 164 tmpdir/got-local-def-off-r.o" "" \ 165 "" \ 166 {} \ 167 { { ld got-local-off-external.ed } } \ 168 "got-local-lib-off-external.so"]] 169 170# Export class relocation tests. 171run_ld_link_tests [list \ 172 [list \ 173 "VAX export class call relocation test" \ 174 "-shared -Ttext 0x12340000 -T export-class.ld --hash-style=sysv" "" \ 175 "-k" \ 176 [list export-class-call.s export-class-def.s] \ 177 [list \ 178 [list objdump -d export-class-call.dd] \ 179 [list readelf -r export-class-call.rd] \ 180 [list readelf "-x .got" export-class-call.xd]] \ 181 "export-class-call.so"] \ 182 [list \ 183 "VAX export class data relocation test" \ 184 "-shared -Ttext 0x12340000 -T export-class.ld --hash-style=sysv" "" \ 185 "-k" \ 186 [list export-class-data.s export-class-def.s] \ 187 [list \ 188 [list objdump -d export-class-data.dd] \ 189 [list readelf -r export-class-data.rd] \ 190 [list readelf "-x .got" export-class-data.xd]] \ 191 "export-class-data.so"]] 192