x86: Extend assembler to generate GNU property notes
[deliverable/binutils-gdb.git] / ld / testsuite / ld-x86-64 / mpx.exp
CommitLineData
c3320543 1# Expect script for ELF MPX tests.
219d1afa 2# Copyright (C) 2013-2018 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.
25if ![isnative] {
26 return
27}
28
29# Only on Linux for now.
30if ![istarget "x86_64-*-linux*"] {
31 return
32}
33
34# Check to see if the C compiler works
35if { [which $CC] == 0 } {
36 return
37}
38
ea9fb8b3
L
39# Add $PLT_CFLAGS if PLT is expected.
40global PLT_CFLAGS
c3320543 41
ea9fb8b3
L
42run_cc_link_tests [list \
43 [list \
44 "Build libmpx1a.a" \
45 "" \
46 "-Wa,-madd-bnd-prefix -fPIC $PLT_CFLAGS" \
47 {mpx1a.c} \
48 {{readelf {-r --wide} mpx1a.rd}} \
49 "libmpx1a.a" \
50 ] \
51 [list \
52 "Build libmpx1b.a" \
53 "" \
54 "" \
55 {mpx1b.c} \
56 {} \
57 "libmpx1b.a" \
58 ] \
59 [list \
60 "Build libmpx1c.a" \
61 "" \
62 "-Wa,-madd-bnd-prefix" \
63 {mpx1c.c} \
64 {{readelf {-r --wide} mpx1c.rd}} \
65 "libmpx1c.a" \
66 ] \
67 [list \
68 "Build libmpx2a.a" \
69 "" \
70 "-Wa,-madd-bnd-prefix -fPIE $PLT_CFLAGS" \
71 {mpx2a.c} \
72 {{readelf {-r --wide} mpx2a.rd}} \
73 "libmpx2a.a" \
74 ] \
75 [list \
76 "Build libmpx2b.a" \
77 "" \
78 "-fPIE" \
79 {mpx2b.c} \
80 {} \
81 "libmpx2b.a" \
82 ] \
83 [list \
84 "Build libmpx2c.a" \
85 "" \
86 "-Wa,-madd-bnd-prefix -fPIE $PLT_CFLAGS" \
87 {mpx2c.c} \
88 {{readelf {-r --wide} mpx2c.rd}} \
89 "libmpx2c.a" \
90 ] \
91]
c3320543
L
92
93set run_tests {
94 {"Run mpx1"
95 "tmpdir/mpx1a.o tmpdir/mpx1b.o tmpdir/mpx1c.o" ""
96 {dummy.s} "mpx1" "mpx1.out"}
9a231012
L
97 {"Run mpx1 with -static"
98 "tmpdir/mpx1a.o tmpdir/mpx1b.o tmpdir/mpx1c.o -static" ""
99 {dummy.s} "mpx1static" "mpx1.out"}
100 {"Run mpx2"
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"}
c3320543
L
106}
107
d258b828
IZ
108run_ld_link_tests {
109 {"Build libcall.so"
bab55c05
AM
110 "-m elf_x86_64 -shared -z bndplt" ""
111 "--64" {mpx3b.s} {} "libcall.so"}
d258b828 112 {"Build mpx3"
bab55c05
AM
113 "-m elf_x86_64 -z bndplt tmpdir/libcall.so" ""
114 "--64" {mpx3a.s} {{objdump -dw mpx3.dd}} "mpx3"}
d258b828 115 {"Build libcall1.so"
bab55c05
AM
116 "-m elf_x86_64 -shared -z bndplt" ""
117 "--64" {mpx4b.s} {} "libcall1.so"}
d258b828 118 {"Build mpx4"
197741f1
L
119 "-m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall1.so \
120 -z max-page-size=0x200000 -z noseparate-code" ""
bab55c05 121 "--64" {mpx4a.s} {{objdump -dw mpx4.dd}} "mpx4"}
38b12349 122 {"Build mpx3 (-z now)"
197741f1
L
123 "-z now -m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall.so \
124 -z max-page-size=0x200000 -z noseparate-code" ""
bab55c05 125 "--64" {mpx3a.s} {{objdump -dw mpx3n.dd}} "mpx3n"}
38b12349 126 {"Build mpx4 (-z now)"
197741f1
L
127 "-z now -m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall1.so \
128 -z max-page-size=0x200000 -z noseparate-code" ""
bab55c05 129 "--64" {mpx4a.s} {{objdump -dw mpx4n.dd}} "mpx4n"}
d258b828
IZ
130}
131
982c6f26 132run_ld_link_exec_tests $run_tests
97122a4c
L
133
134run_dump_test "bnd-branch-1"
0ff2b86e 135run_dump_test "bnd-ifunc-1"
144bed8d 136run_dump_test "bnd-ifunc-2"
0ff2b86e 137run_dump_test "bnd-plt-1"
38b12349
L
138run_dump_test "bnd-branch-1-now"
139run_dump_test "bnd-ifunc-1-now"
140run_dump_test "bnd-ifunc-2-now"
141run_dump_test "bnd-plt-1-now"
This page took 0.455808 seconds and 4 git commands to generate.