Really fix riscv shared library __global_pointer$ problem.
[external/binutils.git] / ld / testsuite / ld-riscv-elf / ld-riscv-elf.exp
1 # Expect script for RISC-V ELF linker tests
2 #   Copyright (C) 2017 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 "c-lui"
24
25     set abis { rv32gc ilp32 elf32lriscv rv64gc lp64 elf64lriscv }
26     foreach { arch abi emul } $abis {
27         # This checks whether our linker scripts handle __global_pointer$
28         # correctly.  It should be defined in executables and PIE, but not
29         # in shared libraries.
30         set suff64 [string map {ilp32 "" lp64 -64} $abi]
31         run_ld_link_tests [list \
32                                [list "gp test ($abi shared library)" \
33                                     "-m$emul -shared" "" \
34                                     "-march=$arch -mabi=$abi -fpic" \
35                                     { gp-test.s } \
36                                     [list "readelf --syms gp-test-lib.sd"] \
37                                     "gp-test-lib-${abi}.so"] \
38                                [list "gp test ($abi executable)" \
39                                     "-m$emul" "" \
40                                     "-march=$arch -mabi=$abi" \
41                                     { gp-test.s } \
42                                     [list "readelf --syms gp-test.sd"] \
43                                     "gp-test-${abi}"]]
44     }
45 }