RISC-V: The object without priv spec attributes can be linked with any object.
[deliverable/binutils-gdb.git] / ld / testsuite / ld-riscv-elf / ld-riscv-elf.exp
CommitLineData
3342be5d 1# Expect script for RISC-V ELF linker tests
b3adc24a 2# Copyright (C) 2017-2020 Free Software Foundation, Inc.
3342be5d
AW
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
da02107a 22if [istarget "riscv*-*-*"] {
c6261a00 23 run_dump_test "call-relax"
3342be5d 24 run_dump_test "c-lui"
080a4883 25 run_dump_test "c-lui-2"
35eeb78f 26 run_dump_test "disas-jalr"
2a0d9853 27 run_dump_test "pcrel-lo-addend"
551703cf 28 run_dump_test "pcrel-lo-addend-2"
7d7a7d7c
JW
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"
41285764
NC
38 run_dump_test "attr-merge-priv-spec-01"
39 run_dump_test "attr-merge-priv-spec-02"
40 run_dump_test "attr-merge-priv-spec-03"
7d7a7d7c
JW
41 run_dump_test "attr-merge-arch-failed-01"
42 run_dump_test "attr-merge-stack-align-failed"
41285764
NC
43 run_dump_test "attr-merge-priv-spec-failed-01"
44 run_dump_test "attr-merge-priv-spec-failed-02"
45 run_dump_test "attr-merge-priv-spec-failed-03"
46 run_dump_test "attr-merge-priv-spec-failed-04"
47 run_dump_test "attr-merge-priv-spec-failed-05"
48 run_dump_test "attr-merge-priv-spec-failed-06"
cf7a5066
JW
49 run_ld_link_tests {
50 { "Weak reference 32" "-T weakref.ld -melf32lriscv" ""
51 "-march=rv32i -mabi=ilp32" {weakref32.s}
52 {{objdump -d weakref32.d}} "weakref32"}
53 { "Weak reference 64" "-T weakref.ld -melf64lriscv" ""
54 "-march=rv64i -mabi=lp64" {weakref64.s}
55 {{objdump -d weakref64.d}} "weakref64"}
56 }
da02107a 57
7615ca1d
JW
58 # The following tests require shared library support.
59 if ![check_shared_lib_support] {
60 return
61 }
62
da02107a
JW
63 set abis { rv32gc ilp32 elf32lriscv rv64gc lp64 elf64lriscv }
64 foreach { arch abi emul } $abis {
0527614a
JW
65 # This checks whether our linker scripts handle __global_pointer$
66 # correctly. It should be defined in executables and PIE, but not
67 # in shared libraries.
da02107a
JW
68 set suff64 [string map {ilp32 "" lp64 -64} $abi]
69 run_ld_link_tests [list \
0527614a 70 [list "gp test ($abi shared library)" \
da02107a
JW
71 "-m$emul -shared" "" \
72 "-march=$arch -mabi=$abi -fpic" \
0527614a
JW
73 { gp-test.s } \
74 [list "readelf --syms gp-test-lib.sd"] \
75 "gp-test-lib-${abi}.so"] \
76 [list "gp test ($abi executable)" \
77 "-m$emul" "" \
da02107a 78 "-march=$arch -mabi=$abi" \
0527614a
JW
79 { gp-test.s } \
80 [list "readelf --syms gp-test.sd"] \
81 "gp-test-${abi}"]]
da02107a 82 }
330a6637
JW
83
84 run_ld_link_tests {
85 { "Link non-pic code into a shared library (setup)"
86 "-shared" "" "" {lib-nopic-01a.s}
87 {} "lib-nopic-01a.so" }
88 }
89 run_dump_test "lib-nopic-01b"
3342be5d 90}
This page took 0.142877 seconds and 4 git commands to generate.