# Expect script for ELF MPX tests.
-# Copyright 2013
-# Free Software Foundation, Inc.
+# Copyright (C) 2013-2020 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
}
# Check to see if the C compiler works
-if { [which $CC] == 0 } {
+if { ![check_compiler_available] } {
return
}
-set build_tests {
- {"Build libmpx1a.a"
- "" "-Wa,-madd-bnd-prefix -fPIC"
- {mpx1a.c} {{readelf {-r --wide} mpx1a.rd}} "libmpx1a.a"}
- {"Build libmpx1b.a"
- "" ""
- {mpx1b.c} {} "libmpx1b.a"}
- {"Build libmpx1c.a"
- "" "-Wa,-madd-bnd-prefix"
- {mpx1c.c} {{readelf {-r --wide} mpx1c.rd}} "libmpx1c.a"}
- {"Build libmpx2a.a"
- "" "-Wa,-madd-bnd-prefix -fPIE"
- {mpx2a.c} {{readelf {-r --wide} mpx2a.rd}} "libmpx2a.a"}
- {"Build libmpx2b.a"
- "" "-fPIE"
- {mpx2b.c} {} "libmpx2b.a"}
- {"Build libmpx2c.a"
- "" "-Wa,-madd-bnd-prefix -fPIE"
- {mpx2c.c} {{readelf {-r --wide} mpx2c.rd}} "libmpx2c.a"}
-}
-
-run_cc_link_tests $build_tests
+run_cc_link_tests [list \
+ [list \
+ "Build libmpx1a.a" \
+ "" \
+ "-Wa,-madd-bnd-prefix -fPIC $PLT_CFLAGS" \
+ {mpx1a.c} \
+ {{readelf {-r --wide} mpx1a.rd}} \
+ "libmpx1a.a" \
+ ] \
+ [list \
+ "Build libmpx1b.a" \
+ "" \
+ "" \
+ {mpx1b.c} \
+ {} \
+ "libmpx1b.a" \
+ ] \
+ [list \
+ "Build libmpx1c.a" \
+ "" \
+ "-Wa,-madd-bnd-prefix" \
+ {mpx1c.c} \
+ {{readelf {-r --wide} mpx1c.rd}} \
+ "libmpx1c.a" \
+ ] \
+ [list \
+ "Build libmpx2a.a" \
+ "" \
+ "-Wa,-madd-bnd-prefix -fPIE $PLT_CFLAGS" \
+ {mpx2a.c} \
+ {{readelf {-r --wide} mpx2a.rd}} \
+ "libmpx2a.a" \
+ ] \
+ [list \
+ "Build libmpx2b.a" \
+ "" \
+ "-fPIE" \
+ {mpx2b.c} \
+ {} \
+ "libmpx2b.a" \
+ ] \
+ [list \
+ "Build libmpx2c.a" \
+ "" \
+ "-Wa,-madd-bnd-prefix -fPIE $PLT_CFLAGS" \
+ {mpx2c.c} \
+ {{readelf {-r --wide} mpx2c.rd}} \
+ "libmpx2c.a" \
+ ] \
+]
set run_tests {
{"Run mpx1"
{dummy.s} "mpx2static" "mpx2.out"}
}
-run_ld_link_exec_tests [] $run_tests
+run_ld_link_tests {
+ {"Build libcall.so"
+ "-m elf_x86_64 -shared -z bndplt" ""
+ "--64" {mpx3b.s} {} "libcall.so"}
+ {"Build mpx3"
+ "-m elf_x86_64 -z bndplt tmpdir/libcall.so" ""
+ "--64" {mpx3a.s} {{objdump -dw mpx3.dd}} "mpx3"}
+ {"Build libcall1.so"
+ "-m elf_x86_64 -shared -z bndplt" ""
+ "--64" {mpx4b.s} {} "libcall1.so"}
+ {"Build mpx4"
+ "-m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall1.so \
+ -z max-page-size=0x200000 -z noseparate-code" ""
+ "--64 -mx86-used-note=no" {mpx4a.s} {{objdump -dw mpx4.dd}} "mpx4"}
+ {"Build mpx3 (-z now)"
+ "-z now -m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall.so \
+ -z max-page-size=0x200000 -z noseparate-code" ""
+ "--64 -mx86-used-note=no" {mpx3a.s} {{objdump -dw mpx3n.dd}} "mpx3n"}
+ {"Build mpx4 (-z now)"
+ "-z now -m elf_x86_64 -z bndplt --hash-style=sysv tmpdir/libcall1.so \
+ -z max-page-size=0x200000 -z noseparate-code" ""
+ "--64 -mx86-used-note=no" {mpx4a.s} {{objdump -dw mpx4n.dd}} "mpx4n"}
+}
+
+run_ld_link_exec_tests $run_tests
run_dump_test "bnd-branch-1"
+run_dump_test "bnd-ifunc-1"
+run_dump_test "bnd-ifunc-2"
+run_dump_test "bnd-plt-1"
+run_dump_test "bnd-branch-1-now"
+run_dump_test "bnd-ifunc-1-now"
+run_dump_test "bnd-ifunc-2-now"
+run_dump_test "bnd-plt-1-now"