]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / testsuite / ld-riscv-elf / ld-riscv-elf.exp
1 # Expect script for RISC-V ELF linker tests
2 # Copyright (C) 2017-2020 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
22 if [istarget "riscv*-*-*"] {
23 run_dump_test "call-relax"
24 run_dump_test "c-lui"
25 run_dump_test "c-lui-2"
26 run_dump_test "disas-jalr"
27 run_dump_test "pcrel-lo-addend"
28 run_dump_test "pcrel-lo-addend-2"
29 run_dump_test "attr-merge-arch-01"
30 run_dump_test "attr-merge-arch-02"
31 run_dump_test "attr-merge-arch-03"
32 run_dump_test "attr-merge-strict-align-01"
33 run_dump_test "attr-merge-strict-align-02"
34 run_dump_test "attr-merge-strict-align-03"
35 run_dump_test "attr-merge-strict-align-04"
36 run_dump_test "attr-merge-strict-align-05"
37 run_dump_test "attr-merge-stack-align"
38 run_dump_test "attr-merge-priv-spec"
39 run_dump_test "attr-merge-arch-failed-01"
40 run_dump_test "attr-merge-stack-align-failed"
41 run_ld_link_tests {
42 { "Weak reference 32" "-T weakref.ld -melf32lriscv" ""
43 "-march=rv32i -mabi=ilp32" {weakref32.s}
44 {{objdump -d weakref32.d}} "weakref32"}
45 { "Weak reference 64" "-T weakref.ld -melf64lriscv" ""
46 "-march=rv64i -mabi=lp64" {weakref64.s}
47 {{objdump -d weakref64.d}} "weakref64"}
48 }
49
50 # The following tests require shared library support.
51 if ![check_shared_lib_support] {
52 return
53 }
54
55 set abis { rv32gc ilp32 elf32lriscv rv64gc lp64 elf64lriscv }
56 foreach { arch abi emul } $abis {
57 # This checks whether our linker scripts handle __global_pointer$
58 # correctly. It should be defined in executables and PIE, but not
59 # in shared libraries.
60 set suff64 [string map {ilp32 "" lp64 -64} $abi]
61 run_ld_link_tests [list \
62 [list "gp test ($abi shared library)" \
63 "-m$emul -shared" "" \
64 "-march=$arch -mabi=$abi -fpic" \
65 { gp-test.s } \
66 [list "readelf --syms gp-test-lib.sd"] \
67 "gp-test-lib-${abi}.so"] \
68 [list "gp test ($abi executable)" \
69 "-m$emul" "" \
70 "-march=$arch -mabi=$abi" \
71 { gp-test.s } \
72 [list "readelf --syms gp-test.sd"] \
73 "gp-test-${abi}"]]
74 }
75
76 run_ld_link_tests {
77 { "Link non-pic code into a shared library (setup)"
78 "-shared" "" "" {lib-nopic-01a.s}
79 {} "lib-nopic-01a.so" }
80 }
81 run_dump_test "lib-nopic-01b"
82 }