1 # Expect script for ELF MPX tests.
2 # Copyright (C) 2013-2016 Free Software Foundation, Inc.
4 # This file is part of the GNU Binutils.
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.
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.
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,
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.
29 # Only on Linux for now.
30 if ![istarget "x86_64-*-linux*"] {
34 # Check to see if the C compiler works
35 if { [which $CC] == 0 } {
39 # Add $PLT_CFLAGS if PLT is expected.
42 run_cc_link_tests [list \
46 "-Wa,-madd-bnd-prefix -fPIC $PLT_CFLAGS" \
48 {{readelf {-r --wide} mpx1a.rd}} \
62 "-Wa,-madd-bnd-prefix" \
64 {{readelf {-r --wide} mpx1c.rd}} \
70 "-Wa,-madd-bnd-prefix -fPIE $PLT_CFLAGS" \
72 {{readelf {-r --wide} mpx2a.rd}} \
86 "-Wa,-madd-bnd-prefix -fPIE $PLT_CFLAGS" \
88 {{readelf {-r --wide} mpx2c.rd}} \
95 "tmpdir/mpx1a.o tmpdir/mpx1b.o tmpdir/mpx1c.o" ""
96 {dummy.s} "mpx1" "mpx1.out"}
97 {"Run mpx1 with -static"
98 "tmpdir/mpx1a.o tmpdir/mpx1b.o tmpdir/mpx1c.o -static" ""
99 {dummy.s} "mpx1static" "mpx1.out"}
101 "tmpdir/mpx2a.o tmpdir/mpx2b.o tmpdir/mpx2c.o -pie" ""
102 {dummy.s} "mpx2" "mpx2.out"}
103 {"Run mpx2 with -static"
104 "tmpdir/mpx2a.o tmpdir/mpx2b.o tmpdir/mpx2c.o -static" ""
105 {dummy.s} "mpx2static" "mpx2.out"}
110 "-m elf_x86_64 -shared -z bndplt" "" "--64"
111 {mpx3b.s} {} "libcall.so"}
113 "-m elf_x86_64 -z bndplt tmpdir/libcall.so" "" "--64"
114 {mpx3a.s} {{objdump -dw mpx3.dd}} "mpx3"}
116 "-m elf_x86_64 -shared -z bndplt" "" "--64"
117 {mpx4b.s} {} "libcall1.so"}
119 "-m elf_x86_64 -z bndplt tmpdir/libcall1.so" "" "--64"
120 {mpx4a.s} {{objdump -dw mpx4.dd}} "mpx4"}
123 run_ld_link_exec_tests [] $run_tests
125 run_dump_test "bnd-branch-1"
126 run_dump_test "bnd-ifunc-1"
127 run_dump_test "bnd-ifunc-2"
128 run_dump_test "bnd-plt-1"