1 # Expect script for RISC-V ELF linker tests
2 # Copyright (C) 2017-2019 Free Software Foundation, Inc.
4 # This file is part of the GNU Binutils.
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.
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.
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,
22 if [istarget "riscv*-*-*"] {
24 run_dump_test "disas-jalr"
25 run_dump_test "pcrel-lo-addend"
26 run_dump_test "pcrel-lo-addend-2"
28 { "Weak reference 32" "-T weakref.ld -melf32lriscv" ""
29 "-march=rv32i -mabi=ilp32" {weakref32.s}
30 {{objdump -d weakref32.d}} "weakref32"}
31 { "Weak reference 64" "-T weakref.ld -melf64lriscv" ""
32 "-march=rv64i -mabi=lp64" {weakref64.s}
33 {{objdump -d weakref64.d}} "weakref64"}
36 # The following tests require shared library support.
37 if ![check_shared_lib_support] {
41 set abis { rv32gc ilp32 elf32lriscv rv64gc lp64 elf64lriscv }
42 foreach { arch abi emul } $abis {
43 # This checks whether our linker scripts handle __global_pointer$
44 # correctly. It should be defined in executables and PIE, but not
45 # in shared libraries.
46 set suff64 [string map {ilp32 "" lp64 -64} $abi]
47 run_ld_link_tests [list \
48 [list "gp test ($abi shared library)" \
49 "-m$emul -shared" "" \
50 "-march=$arch -mabi=$abi -fpic" \
52 [list "readelf --syms gp-test-lib.sd"] \
53 "gp-test-lib-${abi}.so"] \
54 [list "gp test ($abi executable)" \
56 "-march=$arch -mabi=$abi" \
58 [list "readelf --syms gp-test.sd"] \