Add mpx1static, mpx2 and mpx2static tests
[deliverable/binutils-gdb.git] / ld / testsuite / ld-x86-64 / mpx.exp
1 # Expect script for ELF MPX tests.
2 # Copyright 2013
3 # Free Software Foundation, Inc.
4 #
5 # This file is part of the GNU Binutils.
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 # MA 02110-1301, USA.
21 #
22
23 # The following tests require running the executable generated by ld,
24 # or enough of a build environment to create a fully linked executable.
25 # This is not commonly available when testing a cross-built linker.
26 if ![isnative] {
27 return
28 }
29
30 # Only on Linux for now.
31 if ![istarget "x86_64-*-linux*"] {
32 return
33 }
34
35 # Check to see if the C compiler works
36 if { [which $CC] == 0 } {
37 return
38 }
39
40 set build_tests {
41 {"Build libmpx1a.a"
42 "" "-Wa,-madd-bnd-prefix -fPIC"
43 {mpx1a.c} {{readelf {-r --wide} mpx1a.rd}} "libmpx1a.a"}
44 {"Build libmpx1b.a"
45 "" ""
46 {mpx1b.c} {} "libmpx1b.a"}
47 {"Build libmpx1c.a"
48 "" "-Wa,-madd-bnd-prefix"
49 {mpx1c.c} {{readelf {-r --wide} mpx1c.rd}} "libmpx1c.a"}
50 {"Build libmpx2a.a"
51 "" "-Wa,-madd-bnd-prefix -fPIE"
52 {mpx2a.c} {{readelf {-r --wide} mpx2a.rd}} "libmpx2a.a"}
53 {"Build libmpx2b.a"
54 "" "-fPIE"
55 {mpx2b.c} {} "libmpx2b.a"}
56 {"Build libmpx2c.a"
57 "" "-Wa,-madd-bnd-prefix -fPIE"
58 {mpx2c.c} {{readelf {-r --wide} mpx2c.rd}} "libmpx2c.a"}
59 }
60
61 run_cc_link_tests $build_tests
62
63 set run_tests {
64 {"Run mpx1"
65 "tmpdir/mpx1a.o tmpdir/mpx1b.o tmpdir/mpx1c.o" ""
66 {dummy.s} "mpx1" "mpx1.out"}
67 {"Run mpx1 with -static"
68 "tmpdir/mpx1a.o tmpdir/mpx1b.o tmpdir/mpx1c.o -static" ""
69 {dummy.s} "mpx1static" "mpx1.out"}
70 {"Run mpx2"
71 "tmpdir/mpx2a.o tmpdir/mpx2b.o tmpdir/mpx2c.o -pie" ""
72 {dummy.s} "mpx2" "mpx2.out"}
73 {"Run mpx2 with -static"
74 "tmpdir/mpx2a.o tmpdir/mpx2b.o tmpdir/mpx2c.o -static" ""
75 {dummy.s} "mpx2static" "mpx2.out"}
76 }
77
78 run_ld_link_exec_tests [] $run_tests
This page took 0.046736 seconds and 5 git commands to generate.