Commit | Line | Data |
---|---|---|
c3320543 | 1 | # Expect script for ELF MPX tests. |
4b95cf5c | 2 | # Copyright (C) 2013-2014 Free Software Foundation, Inc. |
c3320543 L |
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 | # The following tests require running the executable generated by ld, | |
23 | # or enough of a build environment to create a fully linked executable. | |
24 | # This is not commonly available when testing a cross-built linker. | |
25 | if ![isnative] { | |
26 | return | |
27 | } | |
28 | ||
29 | # Only on Linux for now. | |
30 | if ![istarget "x86_64-*-linux*"] { | |
31 | return | |
32 | } | |
33 | ||
34 | # Check to see if the C compiler works | |
35 | if { [which $CC] == 0 } { | |
36 | return | |
37 | } | |
38 | ||
39 | set build_tests { | |
40 | {"Build libmpx1a.a" | |
41 | "" "-Wa,-madd-bnd-prefix -fPIC" | |
42 | {mpx1a.c} {{readelf {-r --wide} mpx1a.rd}} "libmpx1a.a"} | |
43 | {"Build libmpx1b.a" | |
44 | "" "" | |
45 | {mpx1b.c} {} "libmpx1b.a"} | |
46 | {"Build libmpx1c.a" | |
47 | "" "-Wa,-madd-bnd-prefix" | |
48 | {mpx1c.c} {{readelf {-r --wide} mpx1c.rd}} "libmpx1c.a"} | |
9a231012 L |
49 | {"Build libmpx2a.a" |
50 | "" "-Wa,-madd-bnd-prefix -fPIE" | |
51 | {mpx2a.c} {{readelf {-r --wide} mpx2a.rd}} "libmpx2a.a"} | |
52 | {"Build libmpx2b.a" | |
53 | "" "-fPIE" | |
54 | {mpx2b.c} {} "libmpx2b.a"} | |
55 | {"Build libmpx2c.a" | |
56 | "" "-Wa,-madd-bnd-prefix -fPIE" | |
57 | {mpx2c.c} {{readelf {-r --wide} mpx2c.rd}} "libmpx2c.a"} | |
c3320543 L |
58 | } |
59 | ||
60 | run_cc_link_tests $build_tests | |
61 | ||
62 | set run_tests { | |
63 | {"Run mpx1" | |
64 | "tmpdir/mpx1a.o tmpdir/mpx1b.o tmpdir/mpx1c.o" "" | |
65 | {dummy.s} "mpx1" "mpx1.out"} | |
9a231012 L |
66 | {"Run mpx1 with -static" |
67 | "tmpdir/mpx1a.o tmpdir/mpx1b.o tmpdir/mpx1c.o -static" "" | |
68 | {dummy.s} "mpx1static" "mpx1.out"} | |
69 | {"Run mpx2" | |
70 | "tmpdir/mpx2a.o tmpdir/mpx2b.o tmpdir/mpx2c.o -pie" "" | |
71 | {dummy.s} "mpx2" "mpx2.out"} | |
72 | {"Run mpx2 with -static" | |
73 | "tmpdir/mpx2a.o tmpdir/mpx2b.o tmpdir/mpx2c.o -static" "" | |
74 | {dummy.s} "mpx2static" "mpx2.out"} | |
c3320543 L |
75 | } |
76 | ||
d258b828 IZ |
77 | run_ld_link_tests { |
78 | {"Build libcall.so" | |
79 | "-shared -z bndplt" "" "" | |
80 | {mpx3b.s} {} "libcall.so"} | |
81 | {"Build mpx3" | |
82 | "tmpdir/libcall.so -z bndplt" "" "" | |
83 | {mpx3a.s} {{objdump -dw mpx3.dd}} "mpx3"} | |
84 | {"Build libcall1.so" | |
85 | "-shared -z bndplt" "" "" | |
86 | {mpx4b.s} {} "libcall1.so"} | |
87 | {"Build mpx4" | |
88 | "tmpdir/libcall1.so -z bndplt" "" "" | |
89 | {mpx4a.s} {{objdump -dw mpx4.dd}} "mpx4"} | |
90 | } | |
91 | ||
c3320543 | 92 | run_ld_link_exec_tests [] $run_tests |
97122a4c L |
93 | |
94 | run_dump_test "bnd-branch-1" | |
0ff2b86e | 95 | run_dump_test "bnd-ifunc-1" |
144bed8d | 96 | run_dump_test "bnd-ifunc-2" |
0ff2b86e | 97 | run_dump_test "bnd-plt-1" |