aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/testsuite/ChangeLog10
-rw-r--r--ld/testsuite/ld-x86-64/mpx.exp60
-rw-r--r--ld/testsuite/ld-x86-64/mpx1.out2
-rw-r--r--ld/testsuite/ld-x86-64/mpx1a.c7
-rw-r--r--ld/testsuite/ld-x86-64/mpx1a.rd3
-rw-r--r--ld/testsuite/ld-x86-64/mpx1b.c7
-rw-r--r--ld/testsuite/ld-x86-64/mpx1c.c10
-rw-r--r--ld/testsuite/ld-x86-64/mpx1c.rd3
8 files changed, 102 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 63db4e3..2462cd3 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld-x86-64/mpx.exp: New file.
+ * ld-x86-64/mpx1.out: Likewise.
+ * ld-x86-64/mpx1a.c: Likewise.
+ * ld-x86-64/mpx1a.rd: Likewise.
+ * ld-x86-64/mpx1b.c: Likewise.
+ * ld-x86-64/mpx1c.c: Likewise.
+ * ld-x86-64/mpx1c.rd: Likewise.
+
2013-11-14 Will Newton <will.newton@linaro.org>
* ld-arm/script-type.sym: Remove redundant STT_FILE symbol.
diff --git a/ld/testsuite/ld-x86-64/mpx.exp b/ld/testsuite/ld-x86-64/mpx.exp
new file mode 100644
index 0000000..a2f5996
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx.exp
@@ -0,0 +1,60 @@
+# Expect script for ELF MPX tests.
+# Copyright 2013
+# Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+# The following tests require running the executable generated by ld,
+# or enough of a build environment to create a fully linked executable.
+# This is not commonly available when testing a cross-built linker.
+if ![isnative] {
+ return
+}
+
+# Only on Linux for now.
+if ![istarget "x86_64-*-linux*"] {
+ return
+}
+
+# Check to see if the C compiler works
+if { [which $CC] == 0 } {
+ 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"}
+}
+
+run_cc_link_tests $build_tests
+
+set run_tests {
+ {"Run mpx1"
+ "tmpdir/mpx1a.o tmpdir/mpx1b.o tmpdir/mpx1c.o" ""
+ {dummy.s} "mpx1" "mpx1.out"}
+}
+
+run_ld_link_exec_tests [] $run_tests
diff --git a/ld/testsuite/ld-x86-64/mpx1.out b/ld/testsuite/ld-x86-64/mpx1.out
new file mode 100644
index 0000000..4630211
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1.out
@@ -0,0 +1,2 @@
+foo1
+foo2
diff --git a/ld/testsuite/ld-x86-64/mpx1a.c b/ld/testsuite/ld-x86-64/mpx1a.c
new file mode 100644
index 0000000..e1185b5
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1a.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void
+foo1 (void)
+{
+ printf ("foo1\n");
+}
diff --git a/ld/testsuite/ld-x86-64/mpx1a.rd b/ld/testsuite/ld-x86-64/mpx1a.rd
new file mode 100644
index 0000000..9bebc82
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1a.rd
@@ -0,0 +1,3 @@
+#...
+[0-9a-f ]+R_X86_64_PLT32_BND +0+ +.*
+#...
diff --git a/ld/testsuite/ld-x86-64/mpx1b.c b/ld/testsuite/ld-x86-64/mpx1b.c
new file mode 100644
index 0000000..389ac10
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1b.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void
+foo2 (void)
+{
+ printf ("foo2\n");
+}
diff --git a/ld/testsuite/ld-x86-64/mpx1c.c b/ld/testsuite/ld-x86-64/mpx1c.c
new file mode 100644
index 0000000..12c7806
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1c.c
@@ -0,0 +1,10 @@
+extern void foo1 (void);
+extern void foo2 (void);
+
+int
+main (void)
+{
+ foo1 ();
+ foo2 ();
+ return 0;
+}
diff --git a/ld/testsuite/ld-x86-64/mpx1c.rd b/ld/testsuite/ld-x86-64/mpx1c.rd
new file mode 100644
index 0000000..2b050bd
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mpx1c.rd
@@ -0,0 +1,3 @@
+#...
+[0-9a-f ]+R_X86_64_PC32_BND +0+ +.*
+#...